.document-viewer-page {
    box-sizing: border-box;
    max-width: 1180px;
    padding-top: 34px;
    width: calc(100% - 5em);
}

.document-viewer-hero {
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin: 24px 0 18px;
    padding: 28px;
}

#main > header.document-viewer-hero {
    margin: 24px 0 18px;
    text-align: start;
}

#main > header.document-viewer-hero > div:first-child {
    flex: 1 1 auto;
    text-align: center;
}

.document-eyebrow {
    color: #043270;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.2;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.document-viewer-hero h3 {
    color: #111827;
    font-family: "Source Sans Pro", sans-serif;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 8px;
    text-align: start;
}

.document-viewer-hero p,
#main > header.document-viewer-hero p {
    border-top: 0;
    color: #64748b;
    display: block;
    font-size: 1rem;
    font-style: italic;
    line-height: 1.5;
    margin: 0;
    max-width: 640px;
    padding: 0;
    position: relative;
    text-align: start;
}

#main > header.document-viewer-hero > div:first-child h3,
#main > header.document-viewer-hero > div:first-child p {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.document-summary {
    border-left: 1px solid #e5e7eb;
    min-width: 132px;
    padding-left: 24px;
    text-align: center;
}

.document-summary strong {
    color: #111827;
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.document-summary span {
    color: #64748b;
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 6px;
    text-transform: uppercase;
}

/* Modern container style */
#fileExplorer {
    box-sizing: border-box;
    max-width: none;
    margin: 1.5rem 0 3rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    padding: 1.5rem;
    font-family: "Source Sans Pro", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #2D3748; /* dark slate */
    width: 100%;
}

/* Toolbar */
#viewToolbar {
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.document-toolbar-meta {
    color: #64748b;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#viewToolbar button {
    cursor: pointer;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid #d9e0ea;
    background: #ffffff;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#viewToolbar button i {
    font-size: 1.25rem;
}

#viewToolbar button:hover:not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

#viewToolbar button.active {
    background: #2B6CB0; /* blue-600 */
    color: white;
    border-color: #2B6CB0;
    box-shadow: 0 4px 12px rgba(43,108,176,0.4);
}

/* Icon view */
#iconView {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
    margin-top: 0;
}

.file-icon-item {
    color: inherit;
    width: calc(25% - 0.75rem);
    min-width: 210px;
    text-align: left;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.15rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 210px;
    text-decoration: none;
}

.file-icon-item:hover,
.file-icon-item:focus {
    transform: translateY(-3px);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.1);
    outline: none;
    background: #ffffff;
    border-color: #cbd5e1;
}
.file-icon-item:focus {
    box-shadow: 0 0 0 3px #3182CE; /* blue focus ring */
}

.file-icon-mark {
    align-items: center;
    background: #fff5f5;
    border: 1px solid #fee2e2;
    border-radius: 8px;
    display: flex;
    height: 52px;
    justify-content: center;
    margin: 0 auto 1rem;
    width: 52px;
}

.file-icon-mark i {
    font-size: 28px;
    margin: 0;
}

/* UPDATED: filename allows wrapping */
.file-icon-item .filename {
    font-weight: 800;
    font-size: 1rem;
    color: #111827;
    line-height: 1.28;
    white-space: normal !important;       /* allow wrapping */
    overflow: visible !important;         /* prevent clipping */
    overflow-wrap: break-word;            /* break long words */
    word-break: break-word;                /* fallback for word breaking */
    text-overflow: unset !important;      /* disable ellipsis */
    margin-bottom: 0.75rem;
    text-align: center;
    width: 100%;                          /* fill available width */
}

.document-card-meta {
    border-top: 1px solid #eef2f7;
    color: #64748b;
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: auto;
    padding-top: 0.75rem;
    width: 100%;
}

.document-card-meta span {
    white-space: nowrap;
}

.document-card-meta span:first-child {
    min-width: 0;
}

.document-card-meta span:last-child {
    margin-left: auto;
    text-align: right;
}

.document-card-meta i {
    color: #043270;
    margin-right: 5px;
}

/* Other file info */
.file-icon-item .date {
    font-size: 0.875rem;
    color: #4A5568; /* gray-700 */
    margin-top: 0;
    margin-bottom: 0.08rem;
}

.file-icon-item .nbhd {
    font-size: 0.875rem;
    color: #718096; /* gray-500 */
    margin-top: 0;
    font-style: italic;
}

/* Details view (table) */

#detailsView {
    width: 100%;
    margin-top: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
    display: none;
    font-size: 0.95rem;
    color: #2D3748;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#detailsView thead {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#detailsView th,
#detailsView td {
    padding: 12px 16px;
    vertical-align: middle;
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 56px;
}

#detailsView th:first-child,
#detailsView td:first-child {
    width: 56px;
}

#detailsView th:nth-child(3),
#detailsView td:nth-child(3) {
    width: 140px;
    white-space: nowrap;
}

#detailsView th:first-child,
#detailsView td:first-child {
    border-left: 1px solid #e5e7eb;
    border-radius: 8px 0 0 8px;
}

#detailsView th:last-child,
#detailsView td:last-child {
    border-right: 1px solid #e5e7eb;
    border-radius: 0 8px 8px 0;
}

#detailsView tbody tr {
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#detailsView tbody td {
    border-bottom: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
}

#detailsView tbody tr:hover {
    background: #E6F0FF;
    box-shadow: 0 4px 16px rgba(43,108,176,0.15);
}

#detailsView tbody tr:focus {
    outline: 3px solid rgba(49, 130, 206, 0.28);
    outline-offset: 2px;
}

#detailsView .file-icon {
    font-size: 28px;
    width: 48px;
    text-align: center;
    color: inherit;
}

#detailsView a {
    color: #2B6CB0;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

#detailsView a:hover {
    color: #2C5282;
    text-decoration: underline;
}

/* Align file size right */
#detailsView th.size-cell,
#detailsView td.size-cell {
    text-align: right;
    white-space: nowrap;
    width: 110px;
}

#detailsView td.size-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #4A5568;
}

/* Pagination styles */
#pagination {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    user-select: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#pagination button {
    background: #EDF2F7;
    border: 1.5px solid #CBD5E0;
    color: #4A5568;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    min-width: 36px;
    text-align: center;
}

#pagination button:hover:not(:disabled) {
    background: #E2E8F0;
    border-color: #A0AEC0;
    color: #2D3748;
}

#pagination button:disabled {
    cursor: default;
    opacity: 0.5;
    background: #F7FAFC;
    border-color: #CBD5E0;
}

#pagination button.active {
    background: #2B6CB0;
    border-color: #2B6CB0;
    color: white;
    cursor: default;
    box-shadow: 0 4px 12px rgba(43,108,176,0.4);
}

/* Action Buttons & Icon Appearance */
.icon-action-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 38px; background-color: #043270; border-radius: 8px;
    color: #ffffff; text-decoration: none; transition: background-color 0.2s, color 0.2s; flex-shrink: 0;
    font-size: 0.86rem;
    font-weight: 800;
    margin-top: 1rem;
    padding: 0 14px;
}

.icon-action-btn:hover {
    background-color: #1f2937;
    color: #FFFFFF;
}

.icon-action-btn:hover i, .icon-action-btn:hover i.fas {
    color: #FFFFFF !important;
}

.icon-action-btn i {
    font-size: 16px;
}
        
.detail-action-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; background-color: #043270; border-radius: 8px;
    color: #ffffff !important; text-decoration: none; margin: 0 4px; transition: background-color 0.2s, color 0.2s; flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0 12px;
}

.detail-action-btn:hover {
    background-color: #1f2937;
    color: #FFFFFF;
}

.detail-action-btn:hover i, .detail-action-btn:hover i.fas {
    color: #FFFFFF !important;
}

.detail-action-btn i {
    font-size: 14px;
}
        
.year-header {
    width: 100%;
    border-bottom: 2px solid #E2E8F0;
    margin: 1.5rem 0 0.5rem 0;
    padding-bottom: 0.5rem;
    flex-basis: 100%;
}

.year-header h4 {
    margin: 0;
    color: #2D3748;
    font-weight: 700;
    text-align: left;
    font-size: 1.25rem;
}

.document-empty {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 64px 24px;
    text-align: center;
}

.document-empty i {
    color: #cbd5e1;
    font-size: 3rem;
    margin-bottom: 16px;
}

.document-empty h4 {
    color: #475569;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.document-empty p {
    color: #64748b;
    font-size: 0.96rem;
    margin: 0;
}

/* Responsive adjustments */
@media (min-width: 981px) {
    #viewToolbar { text-align: center; }
}

@media (max-width: 900px) {
    #fileExplorer {
        padding: 1.5rem;
        margin-bottom: 40px;
    }

    .file-icon-item {
        width: calc(50% - 0.5rem);
        min-width: 0;
    }
}

@media screen and (max-width: 768px) {
    #main.container.document-viewer-page {
        max-width: 100% !important;
        padding-top: 18px;
        padding-left: 0.625rem;
        padding-right: 0.625rem;
        width: 100% !important;
    }

    #viewToolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0.75rem;
    }

    #viewToolbar button {
        justify-content: center;
        width: 100%;
    }

    #fileExplorer {
        border-radius: 8px;
        margin-top: 1rem;
        padding: 1rem;
        width: 100%;
    }

    .file-icon-item {
        min-height: 0;
        width: 100%;
    }

    #detailsView {
        font-size: 0.82rem;
        min-width: 680px;
    }

    #fileExplorer {
        overflow-x: auto;
    }

    .document-empty {
        padding: 42px 18px;
    }
}

@media (max-width: 736px) {
    .document-viewer-page {
        padding-top: 18px;
    }

    .document-viewer-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px;
    }

    .document-summary {
        border-left: 0;
        border-top: 1px solid #e5e7eb;
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
        padding: 16px 0 0;
        text-align: left;
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    #main.container.document-viewer-page {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .document-viewer-hero,
    #fileExplorer {
        margin-left: 0;
        margin-right: 0;
    }

    #main > header.document-viewer-hero {
        margin-left: 0;
        margin-right: 0;
    }
}
