/* =========================================================
   Document Manager – Public Styles
   ========================================================= */

/* ----- Wrapper -------------------------------------------- */
.dm-documents-wrapper {
    font-family: inherit;
    margin: 20px 0;
}

/* ----- Filter Bar ----------------------------------------- */
.dm-filter-bar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.dm-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.dm-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dm-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.dm-select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #212529;
    min-width: 150px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 32px;
}

.dm-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.dm-filter-btn-wrap {
    flex-direction: row;
    align-items: center;
    margin-top: 22px;
}

/* ----- Buttons -------------------------------------------- */
.dm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1.4;
}

.dm-btn-filter {
    background: #2271b1;
    color: #fff;
}

.dm-btn-filter:hover {
    background: #135e96;
}

.dm-btn-reset {
    background: #fff;
    color: #6c757d;
    border: 1px solid #ced4da;
}

.dm-btn-reset:hover {
    background: #f8f9fa;
    color: #495057;
}

.dm-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: #f0f6fc;
    color: #2271b1 !important;
    border: 1px solid #b4d3f5;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.dm-btn-download:hover {
    background: #2271b1;
    color: #fff !important;
    border-color: #2271b1;
}

/* ----- Document List -------------------------------------- */
.dm-documents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ----- Document Item -------------------------------------- */
.dm-document-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px 18px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.dm-document-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #b4d3f5;
}

/* ----- File Icon ------------------------------------------ */
.dm-document-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 56px;
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    font-size: 0;
}

.dm-document-icon::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.dm-icon-pdf {
    background: #fde8e8;
}

.dm-icon-pdf .dm-ext-label {
    color: #c62828;
}

.dm-icon-word {
    background: #e3f0ff;
}

.dm-icon-word .dm-ext-label {
    color: #1565c0;
}

.dm-icon-excel {
    background: #e8f5e9;
}

.dm-icon-excel .dm-ext-label {
    color: #2e7d32;
}

.dm-icon-file {
    background: #f3f4f6;
}

.dm-icon-file .dm-ext-label {
    color: #555;
}

.dm-ext-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: absolute;
    bottom: 8px;
    width: 100%;
    text-align: center;
}

/* Document icon file shape */
.dm-document-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 26px;
    border-radius: 2px 6px 2px 2px;
    background: rgba(0, 0, 0, 0.08);
}

/* ----- Document Info -------------------------------------- */
.dm-document-info {
    flex: 1;
    min-width: 0;
}

.dm-document-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-document-link {
    color: #2271b1;
    text-decoration: none;
}

.dm-document-link:hover {
    text-decoration: underline;
    color: #135e96;
}

.dm-document-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.dm-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6c757d;
}

.dm-meta-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ----- Document Actions ----------------------------------- */
.dm-document-actions {
    flex-shrink: 0;
}

/* ----- No Documents --------------------------------------- */
.dm-no-documents {
    text-align: center;
    padding: 32px;
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

/* ----- Loading Spinner ------------------------------------ */
.dm-loading {
    text-align: center;
    padding: 32px;
    color: #6c757d;
}

.dm-spinner-ring {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 4px solid #dee2e6;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: dm-spin 0.7s linear infinite;
    margin-bottom: 10px;
}

@keyframes dm-spin {
    to { transform: rotate(360deg); }
}

/* ----- Pagination ----------------------------------------- */
.dm-pagination {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dm-pagination-summary {
    font-size: 13px;
    color: #6c757d;
}

.dm-pagination-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.dm-pagination-list .dm-page-item {
    display: inline-block;
}

.dm-pagination-list .dm-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #2271b1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.dm-pagination-list .dm-page-link:hover {
    background: #f1f3f5;
    border-color: #adb5bd;
    text-decoration: none;
}

.dm-pagination-list .dm-page-active .dm-page-link {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    cursor: default;
}

.dm-pagination-list .dm-page-active .dm-page-link:hover {
    background: #2271b1;
    border-color: #2271b1;
}

.dm-pagination-list .dm-page-disabled .dm-page-link {
    color: #adb5bd;
    cursor: not-allowed;
    background: #f8f9fa;
}

.dm-pagination-list .dm-page-disabled .dm-page-link:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #adb5bd;
}

.dm-pagination-list .dm-page-ellipsis span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 6px;
    color: #6c757d;
}

/* ----- Responsive ----------------------------------------- */
@media (max-width: 600px) {
    .dm-filter-group {
        flex-direction: column;
        gap: 10px;
    }

    .dm-filter-item,
    .dm-filter-btn-wrap {
        width: 100%;
        margin-top: 0;
    }

    .dm-select {
        width: 100%;
    }

    .dm-btn-filter,
    .dm-btn-reset {
        width: 100%;
        justify-content: center;
    }

    .dm-document-item {
        flex-wrap: wrap;
        gap: 12px;
    }

    .dm-document-title {
        white-space: normal;
    }

    .dm-document-actions {
        width: 100%;
    }

    .dm-btn-download {
        width: 100%;
        justify-content: center;
    }

    .dm-pagination-list .dm-page-link {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 13px;
    }
}
