/* --- Global Styles --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Modern, clean font stack */
    padding: 0;
    margin: 0;
    background-color: #f7f7fa; /* Very light background */
    color: #333;
    line-height: 1.6;
}

h1, h2 {
    color: #4a4e69; /* Deep, professional blue/grey */
    border-bottom: 2px solid #5a189a; /* Vibrant color border for emphasis */
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
}

/* Container to center content */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* --- Directory List Styling (Album Cards) --- */
.directory-list ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 30px; /* Increased spacing */
    margin-bottom: 50px;
    flex-wrap: wrap;
    justify-content: center; /* Center the cards */
}

.directory-list li {
    background: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); /* Soft, modern shadow */
    border-radius: 12px;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    overflow: hidden;
    width: 250px; /* Fixed card width */
    text-align: center;
}

.directory-list li:hover {
    transform: translateY(-8px); /* Lift card on hover */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.directory-list li a {
    display: block;
    padding: 20px 0;
    text-decoration: none;
    color: #222;
    font-size: 1.2em;
    font-weight: bold;
}

/* Adding a splash of color */
.directory-list li a::before {
    content: '📁'; /* Folder emoji */
    display: block;
    font-size: 3em;
    margin-bottom: 10px;
    color: #c77dff; /* Bright, attractive color */
}

/* --- Photo Gallery Styling (Grid Layout) --- */
.photo-gallery {
    display: grid;
    /* Create a responsive grid: min 200px wide columns, max 1fr */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 20px;
    margin-top: 30px;
    padding: 10px;
    background-color: #ffffff; /* White background for the gallery area */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.photo-item {
    background-color: #f7f7fa;
    border: none; /* Removed thick border */
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.photo-item:hover {
    transform: scale(1.03); /* Slightly enlarge on hover */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.photo-item a {
    text-decoration: none;
    color: inherit;
}

.photo-item img {
    width: 100%;
    height: 180px; /* Fixed height for uniform thumbnails */
    object-fit: cover; /* Ensures image fills the space without distortion */
    border-radius: 5px;
    display: block;
    margin-bottom: 10px;
}

.photo-item p {
    font-size: 0.9em;
    font-weight: 500;
    margin: 5px 0;
    white-space: nowrap; /* Prevents long names from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Adds "..." for long file names */
}

/* --- Pagination Styling --- */
.pagination {
    margin-top: 30px;
    padding: 20px 0;
    text-align: center;
}

.pagination a {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    border: 1px solid #c77dff;
    text-decoration: none;
    color: #5a189a;
    border-radius: 50px; /* Pill shape */
    transition: background-color 0.2s, color 0.2s;
    font-weight: bold;
}

.pagination a:hover {
    background-color: #e0b0ff;
    color: #4a4e69;
}

.pagination a.active {
    background-color: #5a189a; /* Primary color highlight */
    color: white;
    border-color: #5a189a;
}

/* --- Download Button Style --- */
.photo-item a[download] {
    display: block;
    background-color: #8338ec; /* Attractive action color */
    color: white;
    padding: 8px;
    border-radius: 50px;
    margin-top: 10px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s;
}

.photo-item a[download]:hover {
    background-color: #5a189a;
}

/* --- Modal/Lightbox Styles --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    padding-top: 20px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}

/* Modal Content/Image container */
.modal-content {
    margin: auto;
    display: flex; /* Use flexbox to center the media inside */
    justify-content: center;
    align-items: center;
    width: 90%; 
    height: 95%; /* Take up nearly full screen height */
    max-width: 1200px; /* Optional: Sets a max size for huge monitors */
    text-align: center;
}

.modal-media {
    /* CRITICAL FIX: Ensure media never exceeds container boundaries */
    width: auto;
    height: auto;
    max-width: 100%; /* Image/Video cannot be wider than the container */
    max-height: 100%; /* Image/Video cannot be taller than the container */
    object-fit: contain; /* Ensures the media fits entirely within the view without cropping */
    display: none; /* Controlled by JavaScript */
}

/* The actual image inside the modal */
.modal-image {
    width: auto;
    height: 100%; 
    max-width: 100%;
    object-fit: contain; /* Ensures the image fits without cropping */
}

/* The Close Button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* --- Header & Footer Styles --- */

/* Reset for the main container wrapper */
.content-wrapper {
    min-height: calc(100vh - 150px); /* Ensures content pushes the footer down */
    padding-top: 20px;
    padding-bottom: 50px;
}

/* Header Styling */
.main-header {
    background-color: #5a189a; /* Deep purple background */
    color: white;
    padding: 15px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
}

.main-header nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.main-header nav a:hover {
    background-color: #8338ec;
}

/* Footer Styling */
.main-footer {
    background-color: #333; /* Dark background */
    color: #bbb;
    padding: 15px 0;
    text-align: center;
    font-size: 0.9em;
}

/* Ensure the main container in CSS is updated to: */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Download Button Style (Icon) --- */
.photo-item a[download] {
    display: inline-flex; /* Use flex for alignment */
    justify-content: center;
    align-items: center;
    width: 40px; /* Make it a small, round button */
    height: 40px;
    background-color: #8338ec;
    color: white;
    padding: 0; /* Remove padding */
    border-radius: 50%; /* Perfect circle */
    margin-top: 10px;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
    font-size: 1.2em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.photo-item a[download]:hover {
    background-color: #5a189a;
    transform: scale(1.1); /* Slight bounce on hover */
}

/* Remove text styling for the download link */
.photo-item a[download] p {
    display: none; 
}

/* --- Media Container for Thumbnails --- */
.media-container {
    width: 100%;
    height: 180px; /* Matches the fixed height of the image thumbnail */
    position: relative; /* Crucial for positioning the icons */
    overflow: hidden;
    border-radius: 5px;
    background-color: #222; /* Dark background for video placeholder */
    display: flex; /* Centers the content */
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

/* Image inside the container */
.media-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Media Type Icon (Top Left Corner) --- */
.media-icon {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 1.2em;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 4px;
    z-index: 5;
}

/* --- Video Placeholder/Icon Styling --- */
.video-placeholder {
    color: #fff;
    font-size: 1.2em;
    background-color: #2c3e50; /* A dark color for the video placeholder */
}

/* Play Button Overlay */
.play-overlay {
    position: absolute;
    font-size: 3em;
    color: rgba(255, 255, 255, 0.9);
    transition: transform 0.2s;
    cursor: pointer;
    z-index: 6;
}

.photo-item:hover .play-overlay {
    transform: scale(1.1); /* Slightly enlarge on hover */
    color: #8338ec; /* Change color on hover for visual feedback */
}

/* Hide the filename paragraph for the video thumbnail */
.video-placeholder p {
    display: none;
}

/* --- Modal Navigation Arrows (Base Style) --- */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.4);
    /* Make arrows responsive by default */
    padding: 10px; 
}

/* Position the "Next" button to the right */
.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little see-through */
.prev:hover, .next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------------------- */
/* CRITICAL FIX: Media Query for Mobile Devices */
/* ---------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
    .prev, .next {
        /* Make the arrows much bigger for easier tapping */
        font-size: 30px; 
        padding: 20px 15px; /* Increase padding for a larger touch target */
        margin-top: -30px;
        /* Increase background visibility on mobile */
        background-color: rgba(0, 0, 0, 0.6);
    }
}