/* ===== CSS Variables ===== */
:root {
    --bg-main: #f9f9fb;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-light: #e2e8f0;
    --primary-color: #07332D;
    --primary-hover: #0a5148;
    --danger-color: #ef4444;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --toolbar-bg: #07332D;
    --toolbar-text: #f8fafc;
    --overlay-bg: #0f172a;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header & Footer ===== */
.main-header {
    background-color: #fff;
    padding: 40px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 40px;
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.main-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.main-footer {
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Mandatory Disclosure Tables ===== */
.disclosure-sections {
    display: grid;
    gap: 32px;
    margin-bottom: 32px;
    min-width: 0;
    width: 100%;
}

.disclosure-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.disclosure-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    padding-bottom: 4px;
}

/* Custom scrollbar for horizontal table scroll */
.table-wrapper::-webkit-scrollbar {
    height: 7px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.disclosure-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 650px;
}

.disclosure-table th,
.disclosure-table td {
    border: 1px solid #cbd5e1;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    line-height: 1.35;
    text-transform: uppercase;
}

.disclosure-table th {
    background: #e0f2fe;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.disclosure-table th:first-child,
.disclosure-table td:first-child {
    width: 72px;
}

.disclosure-table th:last-child,
.disclosure-table td:last-child {
    width: 190px;
}

.general-information-table th:nth-child(2) {
    width: 38%;
}

.disclosure-table a {
    color: var(--primary-color);
    word-break: break-all;
    overflow-wrap: anywhere;
}

.disclosure-table .document-view-link {
    appearance: none;
    background: transparent !important;
    border: 0 !important;
    border-radius: 4px;
    box-shadow: none !important;
    color: var(--primary-color) !important;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 4px 8px;
    text-decoration: underline;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.disclosure-table .document-view-link:hover,
.disclosure-table .document-view-link:focus-visible {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
    text-decoration: none;
}

.disclosure-table .document-view-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.document-missing {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.disclosure-note {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

/* ===== Responsive Table & Mobile Layout ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .main-header {
        padding: 28px 0;
        margin-bottom: 24px;
    }

    .main-header h1 {
        font-size: 1.85rem;
        line-height: 1.25;
    }

    .main-header p {
        font-size: 0.95rem;
    }

    .disclosure-sections {
        gap: 24px;
        margin-bottom: 24px;
    }

    .disclosure-section {
        padding: 18px 14px;
    }

    .disclosure-section h2 {
        font-size: 1.05rem;
        margin-bottom: 14px;
    }

    /* Retain exact table structure and allow smooth touch scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 6px;
    }

    .disclosure-table {
        min-width: 620px;
        font-size: 0.85rem;
    }

    .disclosure-table th,
    .disclosure-table td {
        padding: 9px 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .main-header h1 {
        font-size: 1.55rem;
    }

    .disclosure-section {
        padding: 14px 10px;
    }

    .disclosure-table {
        min-width: 580px;
        font-size: 0.82rem;
    }

    .disclosure-table th,
    .disclosure-table td {
        padding: 8px 9px;
    }
}

/* ===== Document Grid ===== */
.document-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Tablet (2 columns) */
@media (max-width: 992px) {
    .document-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile (1 column) */
@media (max-width: 600px) {
    .document-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Document Card ===== */
.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.doc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #eff6ff;
    color: var(--primary-color);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.doc-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.doc-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex-grow: 1;
}

.doc-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
}

.view-btn:hover {
    background-color: var(--primary-hover);
}

/* ===== PDF Viewer Overlay ===== */
.pdf-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--overlay-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

.pdf-viewer-overlay.hidden {
    display: none;
    opacity: 0;
}

/* ===== Toolbar ===== */
.pdf-toolbar {
    height: 60px;
    background-color: var(--toolbar-bg);
    color: var(--toolbar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 10;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
    padding: 0 20px;
    overflow: hidden;
}

.toolbar-center h2 {
    font-size: 1.1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255,255,255,0.2);
    margin: 0 8px;
}

.toolbar-btn {
    background: transparent;
    border: none;
    color: var(--toolbar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

/* Keep WordPress theme button and SVG rules from affecting PDF controls. */
.pdf-viewer-overlay .toolbar-btn {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--toolbar-text) !important;
}

.pdf-viewer-overlay .toolbar-btn svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px;
    fill: none !important;
    stroke: currentColor !important;
}

.pdf-viewer-overlay .primary-btn svg {
    width: 20px !important;
    height: 20px !important;
    flex-basis: 20px;
}

.pdf-viewer-overlay .toolbar-btn svg * {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
}

.toolbar-btn:hover:not(:disabled) {
    background-color: rgba(255,255,255,0.1);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn {
    width: 36px;
    height: 36px;
}

.primary-btn {
    padding: 8px 12px;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
}

.page-controls, .zoom-controls {
    display: flex;
    align-items: center;
}

.page-info, .zoom-level {
    font-size: 0.9rem;
    min-width: 60px;
    text-align: center;
}

/* ===== Canvas Container ===== */
.pdf-container-wrapper {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: auto;
    padding: 24px 0;
    /* Deter dragging and text selection visually (JS handles events) */
    user-select: none;
    -webkit-user-select: none;
}

.pdf-render-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.pdf-render-container canvas {
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    background-color: white; /* Fallback for transparency */
    max-width: 100%;
}

/* ===== Loading & Error States ===== */
.pdf-message-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
    text-align: center;
}

.pdf-message-box.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.error-box {
    color: #fca5a5;
}

/* ===== Mobile Responsiveness for Viewer ===== */
@media (max-width: 768px) {
    .pdf-toolbar {
        padding: 0 10px;
    }
    
    .primary-btn span {
        display: none;
    }
    
    .toolbar-center {
        display: none; /* Hide title on small screens */
    }
    
    .toolbar-divider {
        margin: 0 4px;
    }
    
    .icon-btn {
        width: 32px;
        height: 32px;
    }
    
    .page-info, .zoom-level {
        font-size: 0.8rem;
        min-width: auto;
        padding: 0 4px;
    }
}
