/* Basic HTML and Body setup */
html {
    scroll-behavior: smooth; /* Enable smooth scrolling */
}
body {
    font-family: "Inter", sans-serif; /* Apply Inter font */
    margin: 0; /* Remove default body margin */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    /* --- ADD THIS LINE --- */
    overflow-y: scroll; /* Always show vertical scrollbar track to prevent layout shift */
    /* --- END ADD --- */
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Center content horizontally */
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    padding: 1rem; /* Add padding around the content */
    box-sizing: border-box; /* Include padding in width/height calculation */
    user-select: none; /* Disable text selection on the body */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
/* === FONT OVERRIDE FOR .font-bold === */
.font-bold {
    font-family: "Patua One", cursive;
}
/* Allow text selection for inputs and textareas */
input,
textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Blurred Background Image */
body::before {
    content: "";
    position: fixed; /* Fixed position to cover the viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* --- IMPORTANT: Using the background.jpg from the root folder as requested --- */
    background-image: url("background.jpg");
    background-size: cover; /* Cover the entire area */
    background-position: center; /* Center the image */
    filter: blur(10px); /* Apply blur effect */
    z-index: -1; /* Place it behind the content */
    background-color: #e5e7eb; /* Fallback background color */
}

/* Styling for the main content sections (Access Code and Gallery) */
#access-code-section,
#gallery-section {
    background-color: rgba(255, 255, 255, 0.75); /* === REVERTED TO 0.95 === */

    /* === REVERTED TO SIMPLE BLUR === */
    backdrop-filter: blur(
        8px
    ); /* Apply backdrop blur for frosted glass effect */
    -webkit-backdrop-filter: blur(8px); /* Safari prefix */

    border-radius: 2.5rem; /* Large rounded corners */
    padding: 2rem; /* Inner spacing */
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -4px rgba(0, 0, 0, 0.1); /* Soft shadow */
    width: 100%; /* Full width within its container */
    margin: auto; /* Center the section if container allows */
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.fade-in {
    animation: fadeIn 0.4s ease-out forwards; /* Apply the fade-in animation */
}

/* --- Item Styles (Folder/Photo/Up Directory) --- */
.grid-item {
    overflow: hidden; /* Prevent content spillover */
    border-radius: 1rem; /* Rounded corners for items */
    position: relative; /* For positioning child elements like checkbox */
    transition:
        box-shadow 0.2s ease-in-out,
        background-color 0.2s ease-in-out; /* Smooth transitions */
    display: flex;
    flex-direction: column; /* Stack visual and name vertically */
    justify-content: flex-start; /* Align items to the top */
    align-items: center; /* Center items horizontally */
    text-align: center; /* Center text */
    cursor: pointer; /* Indicate interactivity */
    padding: 0.5rem; /* Padding inside the item */
    min-height: 150px; /* Minimum height for consistency */
    background-color: rgba(255, 255, 255, 0.2); /* Slight background tint */
}
.grid-item:hover {
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1); /* Shadow on hover */
    background-color: rgba(
        255,
        255,
        255,
        0.4
    ); /* Lighten background on hover */
}
.item-visual {
    /* Container for the image or icon */
    width: 100%;
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
    margin-bottom: 0.25rem; /* Space below visual */
    position: relative; /* For potential overlays */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Hide parts of image/icon if needed */
    border-radius: 0.375rem; /* Slightly smaller rounded corners */
}
.grid-item svg.folder-icon,
.grid-item svg.up-icon,
.grid-item svg.video-icon {
    /* Folder and Up icon styling */
    width: 3.5rem;
    height: 3.5rem;
    color: #6366f1; /* Indigo color for folder */
}
.grid-item svg.up-icon {
    /* Specific color for Up icon */
    color: #6b7280; /* Gray color */
}
.grid-item img {
    /* Image styling */
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the visual area */
    border-radius: 0.75rem; /* Match visual container's rounding */
}
.grid-item svg.video-icon {
    /* Specific color for Video icon */
    color: #3b82f6; /* Blue-500 color */
}
.item-name {
    /* File/folder name styling */
    font-family: "Inria Sans", sans-serif; /* === ADDED FONT === */
    display: block;
    font-size: 0.9rem; /* Small font size */
    font-weight: 500; /* Medium weight */
    color: #374151; /* Dark gray text */
    width: 100%;
    text-align: middle; /* Align text to the left */
    margin-top: 0.25rem; /* Space above name */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis for long names */
    line-height: 1.2; /* Adjust line height */
}
/* Style for the 'Up' directory item name */
.up-directory-item .item-name {
    font-weight: 700; /* Bolder */
    color: #6b7280; /* Gray color */
}

/* Outline for selected items */
.thumbnail-selected {
    outline: 3px solid #3b82f6; /* Blue outline */
    outline-offset: 2px; /* Space between item and outline */
    border-radius: 0.5rem; /* Match item rounding */
}

/* --- Breadcrumb Styles --- */
#breadcrumb-nav {
    font-family: "Timmana", sans-serif; /* === ADDED FONT === */
    font-size: 0.875rem; /* Slightly smaller font */
    color: #4b5563; /* Medium gray text */
    margin-bottom: 1rem; /* Space below breadcrumbs */
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    align-items: center;
    gap: 0.25rem; /* Space between breadcrumb parts */
}
#breadcrumb-nav a {
    /* Link styling */
    color: #4f46e5; /* Indigo color */
    text-decoration: none;
    cursor: pointer;
}
#breadcrumb-nav a:hover {
    text-decoration: underline; /* Underline on hover */
}
#breadcrumb-nav span.separator {
    /* Separator styling */
    margin-left: 0.25rem;
    margin-right: 0.25rem;
    color: #9ca3af; /* Lighter gray */
}

/* --- Fullscreen Viewer Styles --- */
#fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Dark semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100; /* Ensure it's above other content */
    opacity: 0; /* Start hidden */
    pointer-events: none; /* Don't interact when hidden */
    transition: opacity 0.3s ease-in-out; /* Smooth fade transition */
    flex-direction: column; /* Stack image container and controls */
    overscroll-behavior: contain; /* Prevent scrolling page behind viewer */
}
#fullscreen-viewer.active {
    opacity: 1;
    pointer-events: auto;
} /* Visible state */
#fullscreen-image-container {
    position: relative; /* For loader positioning */
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
#fullscreen-image {
    display: block;
    max-width: 95%;
    max-height: 90%; /* Limit image size */
    object-fit: contain; /* Scale image while preserving aspect ratio */
    border-radius: 4px; /* Slight rounding */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none; /* Prevent image selection */
    transition: opacity 0.3s ease-in-out; /* Smooth fade-in for loaded image */
    opacity: 0; /* Start hidden until loaded */
}
#fullscreen-image.loaded {
    opacity: 1;
} /* Visible when loaded */

/* --- YOUTUBE PLAYER STYLES ADDED --- */
#fullscreen-video-container {
    width: 90%;
    max-width: 1600px; /* Optional: sanity check for huge screens */
    aspect-ratio: 16 / 9; /* Force 16:9 aspect ratio */
    background-color: #000; /* Black background */
    display: flex;
    justify-content: center;
    align-items: center;
}
#fullscreen-video-container.hidden {
    display: none;
}
#fullscreen-video-container iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.fullscreen-nav {
    /* Prev/Next buttons */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(50, 50, 50, 0.6);
    color: white;
    border: none;
    border-radius: 50%; /* Circular buttons */
    width: 44px;
    height: 44px;
    font-size: 24px;
    cursor: pointer;
    z-index: 110; /* Above image */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s; /* Smooth hover effect */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.fullscreen-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
#fullscreen-prev {
    left: 15px;
}
#fullscreen-next {
    right: 15px;
}
#fullscreen-controls {
    /* Container for top-right buttons */
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    z-index: 110; /* Above image */
}
.fullscreen-button {
    /* Download/Close buttons */
    background-color: rgba(50, 50, 50, 0.6);
    color: white;
    border: none;
    /* --- Consistent radius for fullscreen buttons --- */
    border-radius: 0.5rem; /* Use consistent rounding (like grid items) */
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px; /* Align icon and text */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.fullscreen-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
.fullscreen-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* --- Thumbnail Checkbox Styles --- */
.thumbnail-checkbox-area {
    /* Clickable area for checkbox */
    position: absolute;
    top: 0.5rem;
    right: 0.5rem; /* Position top-right */
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10; /* Above image */
    background-color: rgba(
        255,
        255,
        255,
        0.8
    ); /* Semi-transparent background */
    border-radius: 4px; /* Small rounding */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease-in-out; /* Fade in/out */
}
/* Show checkbox on hover or when item is selected */
.grid-item:hover .thumbnail-checkbox-area,
.thumbnail-selected .thumbnail-checkbox-area {
    opacity: 1;
}
/* Hide checkbox for 'Up' directory item */
.up-directory-item .thumbnail-checkbox-area {
    display: none;
}
.thumbnail-checkbox {
    /* Custom checkbox appearance */
    appearance: none; /* Remove default browser styling */
    width: 18px;
    height: 18px;
    border: 2px solid #6b7280; /* Gray border */
    border-radius: 3px;
    background-color: white;
    cursor: pointer;
    position: relative; /* For checkmark positioning */
    pointer-events: none; /* Click handled by parent area */
}
.thumbnail-checkbox:checked {
    /* Checked state */
    background-color: #3b82f6; /* Blue background */
    border-color: #3b82f6; /* Blue border */
}
.thumbnail-checkbox:checked::after {
    /* Checkmark */
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* --- Action Button Styles --- */
/* Primary button (e.g., View Photos, Download All) */
.action-button {
    font-family: "Dosis", sans-serif; /* === ADDED FONT === */
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Layout */
    padding: 0.75rem 1.5rem; /* Padding */
    font-size: 1rem; /* Text size */
    font-weight: 500; /* Medium weight */
    border: 1px solid transparent; /* Transparent border */
    border-radius: 0.75rem; /* Rounded corners (consistent) */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* Subtle shadow */
    transition:
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out,
        color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out; /* Smooth transitions */
    cursor: pointer; /* Indicate clickability */
    color: white; /* White text */
    background-color: #4f46e5; /* Indigo background */
}
.action-button:hover:not(:disabled) {
    background-color: #4338ca;
} /* Darker indigo on hover */
.action-button:focus {
    outline: none;
    box-shadow:
        0 0 0 2px white,
        0 0 0 4px #6366f1;
} /* Focus ring */
.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
} /* Disabled state */

/* Secondary button (e.g., Download Selected) */
.action-button-secondary {
    font-family: "Dosis", sans-serif; /* === ADDED FONT === */
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Layout */
    padding: 0.75rem 1.5rem; /* Padding */
    font-size: 1rem; /* Text size */
    font-weight: 500; /* Medium weight */
    border: 1px solid #d1d5db; /* Gray border */
    border-radius: 0.75rem; /* Rounded corners (consistent) */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* Subtle shadow */
    transition:
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out,
        color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out; /* Smooth transitions */
    cursor: pointer; /* Indicate clickability */
    color: #374151; /* Dark gray text */
    background-color: white; /* White background */
}
.action-button-secondary:hover:not(:disabled) {
    background-color: #f9fafb;
} /* Lighter gray on hover */
.action-button-secondary:focus {
    outline: none;
    box-shadow:
        0 0 0 2px white,
        0 0 0 4px #6366f1;
} /* Focus ring */
.action-button-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
} /* Disabled state */

/* Smaller button (e.g., Back) */
.go-back-button {
    font-family: "Dosis", sans-serif; /* === ADDED FONT === */
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Layout */
    padding: 0.5rem 1rem; /* Smaller padding */
    font-size: 0.875rem; /* Smaller text */
    font-weight: 500; /* Medium weight */
    border: 1px solid #d1d5db; /* Gray border */
    border-radius: 0.75rem; /* Rounded corners (consistent) */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* Subtle shadow */
    transition:
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out,
        color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out; /* Smooth transitions */
    cursor: pointer; /* Indicate clickability */
    color: #374151; /* Dark gray text */
    background-color: white; /* White background */
}
.go-back-button:hover:not(:disabled) {
    background-color: #f9fafb;
} /* Lighter gray on hover */
.go-back-button:focus {
    outline: none;
    box-shadow:
        0 0 0 2px white,
        0 0 0 4px #6366f1;
} /* Focus ring */
.go-back-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
} /* Disabled state */

/* Style for SVG icon inside the back button */
.go-back-button svg {
    width: 1em; /* Match font size */
    height: 1em;
}

#thumbnail-grid {
    /* Add transition for the opacity property */
    transition: opacity 0.25s ease-in-out; /* Adjust duration (0.25s) as needed */
    opacity: 1; /* Ensure it starts visible */
    min-height: 150px; /* Add a min-height to prevent collapse during fade */
}
#thumbnail-grid.fading-out {
    opacity: 0; /* Class to trigger fade out */
    /* Optional: prevent interaction during fade */
    /* pointer-events: none; */
}

#error-message {
    /* Reset all margins first */
    margin: 0;
    /* Apply specific bottom margin (1.5rem = 24px) */
    margin-top: 1.5rem;

    /* Optional: Keep the red color if you remove the Tailwind class */
    /* color: #ef4444; */ /* Tailwind's text-red-500 */
}

.move-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* Ensure it's above all other content */
    background-color: #fefce8; /* A soft yellow background (Tailwind's yellow-50) */
    color: #a16207; /* A dark yellow/brown text color (Tailwind's yellow-800) */
    padding: 0.75rem 1rem; /* 12px top/bottom, 16px left/right padding */
    border-bottom: 2px solid #facc15; /* A stronger yellow border (Tailwind's yellow-400) */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
