/* =========================================
   1. PDF Selection Grid (Menu Page)
   ========================================= */

/* Main Container Grid */
.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Individual PDF Card */
.pdf-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    min-height: 120px;
}

/* Card Hover Effect */
.pdf-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 152, 121, 0.15);
    border-color: #009879;
}

.pdf-card i {
    font-size: 36px;
    color: #ff4747; /* Red icon for PDF */
}

.pdf-card span {
    font-size: 15px;
    font-weight: 600;
    color: #444;
    line-height: 1.4;
}

/* =========================================
   2. Full Screen PDF Modal (Viewer)
   ========================================= */

/* Main Modal Wrapper */
.pdf-modal {
    display: none; /* Controlled by JS */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a1a; /* Dark background */
    
    /* Layout Logic: Top Bar + Content */
    display: flex; 
    flex-direction: column; 
    animation: fadeIn 0.3s ease;
}

/* --- Top Toolbar (Header) --- */
/* This keeps buttons at the top, separate from PDF */
.pdf-toolbar {
    height: 60px; /* Fixed Height */
    background-color: #222; /* Darker bar */
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    color: white;
    flex-shrink: 0; /* Prevents toolbar from shrinking */
    z-index: 10001;
}

/* Toolbar Sections (Left, Center, Right) */
.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px; /* Gap between buttons */
}

/* Buttons Design */
.control-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #e0e0e0;
    width: 40px; /* Slightly larger touch area */
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 16px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00d2a8; /* Greenish hover color */
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Title Text */
.pdf-modal-title {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    margin-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

/* --- Content Area (PDF Holder) --- */
.frame-container {
    position: relative;
    width: 100%;
    /* Important: Calculates remaining height */
    height: calc(100vh - 60px); 
    background: #525659; /* Standard PDF Viewer Grey */
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Iframe */
.pdf-viewer-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    opacity: 0; /* Hidden until loaded */
    transition: opacity 0.4s ease, transform 0.2s ease;
    transform-origin: center top; /* Zooms from top center */
}

/* =========================================
   3. Loading Spinner
   ========================================= */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    color: white;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #009879; /* Main Brand Color */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loader-overlay span {
    font-family: sans-serif;
    font-size: 14px;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   4. Mobile Responsiveness
   ========================================= */
@media (max-width: 600px) {
    /* Grid becomes 2 columns on mobile */
    .pdf-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
        padding: 10px;
    }
    
    .pdf-card {
        padding: 15px;
        min-height: 100px;
    }

    .pdf-card i {
        font-size: 28px;
    }

    /* Adjust Toolbar for small screens */
    .pdf-toolbar {
        position: fixed !important;
        bottom: 30px !important;
        top: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        height: auto !important;
        width: auto !important;
        padding: 10px 20px !important;
        border-radius: 50px !important;
        background: rgba(0, 0, 0, 0.8) !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
        z-index: 10001 !important;
        flex-direction: row !important;
        gap: 15px !important;
        border: none !important;
    }

    .pdf-modal-title {
        display: none; /* Hide title on very small screens to save space */
    }

    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
        background: transparent !important;
        color: white !important;
        border: 1px solid rgba(255,255,255,0.3) !important;
        padding: 8px !important;
        border-radius: 5px !important;
    }
    
    .frame-container {
        height: 100vh !important;
    }
}