/*
    FILM.CSS - Specific styles for the film player page.
    Builds on common.css for the Société il Noir aesthetic.
*/

/* -------------------------------------- */
/* 1. LAYOUT AND CONTAINER STYLING        */
/* -------------------------------------- */

h2 + #currentFilmTitle {
    margin-top: 0px;
}

.film-page-content {
    color: var(--color-primary); 
    display: flex;
    flex-direction: column; /* Mobile-first: Stack player over list */
    gap: 40px;
    max-width: 1200px; /* Constrain main content width on large screens */
    margin: 0;
}

.film-details {
    display: grid;
    grid-template-columns: 2fr 2fr;
    border: 1px solid var(--color-secondary);
    gap: 10px;
    text-align: center;
}

.film-details button {
    background: none;
    background-color: rgba(0, 0, 0, 0);
    border: 1px solid var(--border-color);
    color: var(--color-primary);
    padding: 10px 10px;
    cursor: pointer;
    font-family: var(--font-family-body);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.film-details button:hover {
    transition: all 0.3s ease;
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

.film-details a:hover {
    transition: all 0.3s ease;
    background-color: transparent;
    color: var(--color-secondary);
}

.film-details #currentFilmRuntime {
    order: 1
}
.film-details #archiveLink {
    order: 3
}
.film-details #mdbLink {
    order: 4
}
.film-details #currentFilmYear {
    order: 2
}

.film-details .subtext {
    font-size: 0.7rem;
}

.current-film-info {
    text-align: justify;
}

@media (min-width: 768px) {
    /* Desktop/Projector View: Side-by-side layout */
    .film-page-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        margin: 40px auto;
    }
    .video-player-section {
        flex: 3; /* Player takes 3/5 of the space */
    }

    /* -------------------------------------- */
    /* 2. FILM LIST SECTION STYLING           */
    /* -------------------------------------- */

    /* Ensure all links and headings within the list section use the primary color */
    .film-list-section h3, 
    .film-list-section a {
        color: var(--color-primary);
    }

    .film-list-section {
        flex: 1; /* List takes 1/5 of the space */
        min-width: 300px; /* Ensure list is readable */
        max-height: 80vh; /* Constrain list height */
        overflow-y: auto; /* Enable scrolling for the list */
        border-left: 1px solid var(--border-color); /* Subtle divider */
        color: var(--color-primary);
        padding-left: 20px;
    }

    .film-details {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-evenly;
        border: 1px solid var(--color-secondary);
        gap: 10px;
    }

    .film-details a {
        padding-left: 10px;
        padding-right: 10px;
    }

    .film-details #currentFilmRuntime {
        order: 1
    }
    .film-details #archiveLink {
        order: 3
    }
    .film-details #mdbLink {
        order: 2
    }
    .film-details #currentFilmYear {
        order: 4
    }

    .film-details .subtext {
        display: none;
    }

    .current-film-info {
        text-align: justify;
    }
}

/* -------------------------------------- */
/* 2. FLUID ASPECT RATIO LOGIC (CSS HACK) */
/* -------------------------------------- */

.video-container {
    /* Establishes the block for the padding-top hack */
    position: relative;
    width: 100%;
    height: 0; /* Necessary for the padding-top hack */
    margin-bottom: 20px;
    border: 1px solid var(--border-color); /* Match site's border style */
}

/* Inner video element for absolute positioning */
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Inverted filter for monochromatic look, since the site applies grayscale to images. */
    filter: invert(0%) grayscale(0%); 
}

/* Aspect Ratio Classes - Calculated Padding-Top values */
.ratio-16-9 { padding-top: 56.25%; }  /* 9 / 16 = 0.5625 */
.ratio-4-3  { padding-top: 75.00%; }  /* 3 / 4 = 0.7500 */
.ratio-21-9 { padding-top: 42.86%; }  /* 9 / 21 = 0.4286 */
.ratio-16-10 { padding-top: 62.50%; } /* 10 / 16 = 0.6250 */
.ratio-1-1  { padding-top: 100.00%; } /* 1 / 1 = 1.0000 */

/* -------------------------------------- */
/* 3. VIDEO PLAYER SECTION STYLING        */
/* -------------------------------------- */

/* Explicitly set color for details like current film title/description */
.video-details h2,
.video-details p {
    color: var(--color-primary);
}

.video-details p {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--color-primary); 
}

/* Apply the theme color to the mailing list section as well */
.outro p {
    color: var(--color-primary);
}

/* -------------------------------------- */
/* 4. FILM LIST STYLING                   */
/* -------------------------------------- */

.film-playlist {
    list-style: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.film-playlist li {
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    text-transform: uppercase;
    font-size: 0.9em;
    color: var(--color-primary); /* Default text color */
}

.film-playlist li:last-child {
    border-bottom: none;
}

.film-playlist li:hover, .film-playlist li.active {
    background-color: rgba(255, 255, 255, 0.05); /* Subtle hover background */
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
}

.film-playlist li.active {
    font-weight: bold;
    color: deepskyblue; /* Highlight the actively playing film */
}

.film-playlist li.hidden-film {
    display: none; /* Used by JS for search filtering */
}

.film-metadata {
    display: block;
    font-size: 0.75em;
    opacity: 0.7;
    margin-top: 2px;
}

/* -------------------------------------- */
/* 5. MINIMALIST SEARCH STYLING           */
/* -------------------------------------- */

.search-container {
    margin-bottom: 20px;
}

#filmSearchInput {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--color-secondary); /* Black background */
    color: var(--color-primary); /* White text */
    font-family: var(--font-family-body);
    font-size: 1em;
    text-transform: uppercase;
    box-shadow: none;
    transition: border-color 0.2s;
    /* Remove default browser focus outline, use box-shadow for focus */
    outline: none; 
}

#filmSearchInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

#filmSearchInput:focus {
    border-color: deepskyblue; /* Subtle highlight on focus */
    box-shadow: 0 0 5px rgba(0, 191, 255, 0.5);
}

/* -------------------------------------- */
/* 5. CUSTOM CONTROLS BASE STYLING (JS will generate these) */
/* -------------------------------------- */

/* Container for all custom controls, placed over the video */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7); /* Semi-transparent black bar */
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0; /* Hidden by default, shown on mousemove/hover via JS */
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* General button styling */
.control-button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    font-size: 1.2em;
    line-height: 1;
    transition: color 0.2s;
    outline: none;
}

.control-button:hover, .control-button:focus {
    color: deepskyblue;
}

/* Time display (Monochromatic white text) */
.time-display {
    color: #fff;
    font-size: 0.8em;
    font-family: var(--font-family-body);
    margin: 0 5px;
}

/* Progress Bar (Monochromatic and minimal) */
.progress-bar {
    flex-grow: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.3); /* Light gray track */
    cursor: pointer;
    position: relative;
    border-radius: 4px;
}

.progress-filled {
    height: 100%;
    width: 0%;
    background: deepskyblue; /* Highlight color for progress */
    border-radius: 4px;
}

/* Poster/Initial Play Button Styling */
.play-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-secondary); /* Solid black background */
    z-index: 20;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s;
}

.play-button-large {
    font-size: 5em;
    color: var(--color-primary);
    transition: color 0.2s;
    opacity: 0.8;
}

.play-placeholder:hover .play-button-large {
    color: deepskyblue;
}