/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.6;
    font-size: 16px;
}

.container {
    width: 95%;
    max-width: 1400px;
    margin: auto;
    padding: 15px;
}

/* Header */
header {
    background-color: #e9ecef;
    color: #212529;
    padding: 1rem;
    /* text-align: center; No longer needed as header-content controls alignment */
    margin-bottom: 20px;
    border-radius: 6px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center; /* Centers the logo + title block */
    gap: 15px; /* Space between logo and title */
    /* text-align: left; Child elements will align left naturally */
}

#header-logo {
    height: 40px; /* Adjust based on your PNG logo's proportions */
    width: auto;  /* Maintain aspect ratio */
}

header h1 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 500;
    text-align: left; /* Ensure h1 text itself is left-aligned if it wraps */
}

/* Breadcrumbs */
#breadcrumbs {
    background: #f1f3f5;
    padding: 10px 15px;
    text-align: left;
    border-radius: 4px;
    margin-top: 15px; /* Space below header content */
    margin-bottom: 20px;
    font-size: 0.9em;
    border: 1px solid #dee2e6;
}

#breadcrumbs a,
#breadcrumbs span {
    color: #007bff;
    text-decoration: none;
    padding: 0 5px;
}
#breadcrumbs span {
    color: #495057;
}

#breadcrumbs a:hover {
    text-decoration: underline;
}

/* Main Content Area */
main {
    display: flex;
    gap: 20px;
}

/* File List Container */
#file-list-container {
    flex: 1;
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    min-width: 280px;
    max-height: 80vh;
    overflow-y: auto;
}

#file-list-container h2 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    font-size: 1.2em;
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#file-list li {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease-in-out;
    font-size: 1em;
    border-radius: 3px;
    margin-bottom: 3px;
}

#file-list li:last-child {
    border-bottom: none;
}

#file-list li:hover {
    background-color: #e9ecef;
}

#file-list li::before {
    margin-right: 10px;
    font-size: 1.2em;
    width: 20px;
    display: inline-block;
    text-align: center;
}

#file-list li.folder::before {
    content: '📁';
}

#file-list li.file::before {
    content: '📄';
}


#file-list a { /* For download links */
    color: #007bff;
    text-decoration: none;
    margin-left: auto;
    padding-left: 10px;
    font-size: 0.9em;
}
#file-list a:hover {
    text-decoration: underline;
}
#file-list a::before {
    content: '💾';
    margin-right: 4px;
    font-size: 1.1em;
}


/* PDF Viewer Container */
#pdf-viewer-container {
    flex: 2.5;
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Give it some base height */
}

#pdf-viewer-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

#fullscreen-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    /* display: none; -- JS will handle this */
}

#fullscreen-btn:hover {
    background-color: #0056b3;
}

#pdf-placeholder {
    text-align: center;
    color: #6c757d;
    font-size: 1.1em;
    margin: auto; /* Centers it vertically and horizontally in flex container */
    display: block; /* Default state */
}

#pdf-viewer { /* This is for desktop iframe */
    width: 100%;
    flex-grow: 1; /* Allows iframe to take up remaining vertical space */
    border: 1px solid #ced4da;
    border-radius: 4px;
    display: none; /* Default state, JS shows it */
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px 15px;
    background: #e9ecef;
    color: #495057;
    border-top: 1px solid #dee2e6;
    font-size: 0.9em;
    line-height: 1.4;
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 10px;
    }

    .header-content {
        gap: 10px;
    }
    #header-logo {
        height: 30px;
    }
    header h1 {
        font-size: 1.3em;
    }

    main {
        flex-direction: column;
    }

    #file-list-container {
        flex: none;
        width: 100%;
        margin-bottom: 15px;
        max-height: 60vh;
    }
    
    #file-list li {
        padding: 9px 10px;
        font-size: 0.95em;
    }
    #file-list li::before {
        font-size: 1.1em;
        margin-right: 8px;
    }

    #pdf-viewer-controls { /* Hide fullscreen button on mobile */
        display: none;
    }

    #pdf-viewer-container {
        flex: none;
        width: 100%;
        min-height: 50px; /* For placeholder message on mobile */
    }

    #pdf-viewer { /* The iframe for PDF */
        display: none !important; /* Ensure iframe is always hidden on mobile */
    }
    
    #pdf-placeholder {
        font-size: 1em;
        padding: 10px;
        display: block !important; /* Ensure it's visible if JS tries to hide it for iframe */
    }

    #file-list a {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    #header-logo {
        height: 25px;
    }
    header h1 {
        font-size: 1.1em; /* Further reduce title size */
    }
    #breadcrumbs {
        font-size: 0.75em;
        padding: 8px 10px;
    }
    #file-list-container h2 {
        font-size: 1.1em;
    }
}