/* --- START style.css --- */

/* 1. Define Color Variables & Base Styles */
:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --line-height: 1.6;
    /* Light Theme (Default) */
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --muted-text-color: #6c757d;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --button-primary-bg: #007bff;
    --button-primary-text: #ffffff;
    --button-primary-hover-bg: #0056b3;
    --button-secondary-bg: #e9ecef;
    --button-secondary-text: #495057;
    --button-secondary-hover-bg: #d3d9df;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --error-border: #f5c6cb;
    --success-text: #155724;
    --warning-text: #856404; /* For the orange summary */
    --highlight-bg: #fff3cd; /* Lighter yellow */
    --highlight-text: #856404; /* Darker text on light yellow */
    --table-header-bg: #f2f2f2;
    --spinner-color: #007bff;
    --shadow-color: rgba(0, 0, 0, 0.05);
    /* Severity Colors (Consistent across themes) */
    --severity-none: #28a745; /* Green */
    --severity-mild: #fd7e14; /* Orange */
    --severity-moderate: #dc3545; /* Red */
    --severity-severe: #b3000b; /* Darker Red */
    /* Add RGB version of link color for focus shadow */
    --link-color-rgb: 0, 123, 255;
    /* Add RGB version of spinner color */
    --spinner-color-rgb: 0, 123, 255;
}

/* Dark Theme Overrides */
/* Apply overrides when html has .dark-theme class */
html.dark-theme {
    --bg-color: #1a1d21; /* Slightly off-black */
    --text-color: #e4e6eb; /* Light gray */
    --muted-text-color: #adb5bd; /* Lighter muted */
    --card-bg: #24272b; /* Dark gray */
    --border-color: #495057; /* Mid gray */
    --input-bg: #2c3034;
    --input-border: #5a6168;
    --button-primary-bg: #0d6efd; /* Keep blue accessible */
    --button-primary-text: #ffffff;
    --button-primary-hover-bg: #3c87fd;
    --button-secondary-bg: #343a40;
    --button-secondary-text: #e4e6eb;
    --button-secondary-hover-bg: #495057;
    --link-color: #3c87fd; /* Lighter blue */
    --link-hover-color: #6caafd;
    --error-bg: #4a1e27; /* Darker red bg */
    --error-text: #f5c6cb; /* Light text on dark red */
    --error-border: #721c24;
    --success-text: #74c69d; /* Light green */
    --warning-text: #ffc107; /* Yellow/Orange */
    --highlight-bg: #665600; /* Dark yellow/brown */
    --highlight-text: #fff3cd; /* Light text */
    --table-header-bg: #343a40;
    --spinner-color: #3c87fd;
    --shadow-color: rgba(0, 0, 0, 0.2);
    /* Dark theme RGB versions */
    --link-color-rgb: 60, 135, 253;
    --spinner-color-rgb: 60, 135, 253;
}

/* 2. Base & Layout Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    /* ... */
    font-family: var(--font-family);
    line-height: var(--line-height);
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 960px; /* Limit content width */
    margin: 20px auto;
    padding: 0 15px; /* ... */
    flex-grow: 1;
}

.site-header {
    background-color: var(--card-bg);
    padding: 10px 0; /* Adjusted padding */
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px var(--shadow-color);
    display: flex;
    justify-content: space-between; /* Keeps title left, button right */
    align-items: center;
    width: 100%;
}

/* ** Style for the logo/title wrapper ** */
.logo-title-group {
    display: flex; /* Align logo and title horizontally */
    align-items: center; /* Vertically center logo and title */
    margin-left: 15px; /* Align with container padding like original h1 */
}

/* ** Style for the logo image ** */
#site-logo {
    margin-right: 10px; /* Space between logo and title */
    /* width/height set in HTML */
    flex-shrink: 0; /* Prevent logo from shrinking if title is long */
}

/* ** Remove margins from h1 as they are handled by the group ** */
.site-header h1 {
    margin: 0; /* Remove default margins */
    font-size: 1.5em;
    color: var(--text-color);
}

#themeToggle {
    margin-right: 15px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 50%; /* Circle */
    font-size: 1.1em;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
}

    #themeToggle:hover {
        background-color: var(--button-secondary-bg);
        border-color: var(--input-border);
    }

    #themeToggle:focus-visible {
        outline: 2px solid var(--link-color);
        outline-offset: 2px;
    }

h1, h2, h3 {
    color: var(--text-color);
    margin-top: 1.5em;
    margin-bottom: 0.7em;
}

h2 {
    font-size: 1.4em;
}

h3 {
    font-size: 1.2em;
}

p {
    margin-bottom: 1em;
}

code {
    font-family: monospace;
    background-color: var(--button-secondary-bg);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

/* 3. Card & Component Styles */
.card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    margin-bottom: 20px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.input-area label {
    margin-right: 10px;
    font-weight: 600; /* Slightly bolder */
    display: block;
    margin-bottom: 5px;
}

.input-area input[type="text"] {
    padding: 10px 12px;
    width: 100%; /* Full width within card */
    max-width: 450px; /* Limit input width */
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 1em;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 10px; /* Space before button on small screens */
}

    .input-area input[type="text"]:focus {
        border-color: var(--link-color);
        box-shadow: 0 0 0 3px rgba(var(--link-color-rgb, 0, 123, 255), 0.25); /* Use RGB for opacity */
        outline: none;
    }


.input-area button {
    padding: 10px 18px;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

    .input-area button:hover {
        background-color: var(--button-primary-hover-bg);
    }

.status {
    margin: 15px 0;
    padding: 12px 15px;
    border-radius: 4px;
    border: 1px solid transparent; /* Base border */
}

.error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

#loading {
    color: var(--muted-text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Basic Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(var(--spinner-color-rgb, 0, 123, 255), 0.3); /* Use RGB for opacity */
    border-radius: 50%;
    border-top-color: var(--spinner-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Results Area */
#results h2:first-of-type {
    margin-top: 0; /* No top margin for first heading in card */
}

/* Severity Display */
#severity-score {
    padding: 3px 0;
    font-weight: 600; /* Bolder */
}

.severity-none {
    color: var(--severity-none);
}

.severity-mild {
    color: var(--severity-mild);
}

.severity-moderate {
    color: var(--severity-moderate);
}

.severity-severe {
    color: var(--severity-severe);
}

/* Expandable Sections */
.expandable-section {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
}

    .expandable-section:first-of-type {
        border-top: none;
        padding-top: 0;
        margin-top: 0; /* Ensure first section has no top margin */
    }

    /* ** MODIFIED: Remove top margin from h3 within expandable sections ** */
    .expandable-section h3 {
        margin-top: 0; /* Remove extra space above these specific headings */
    }


.toggle-button, .link-button {
    background-color: var(--button-secondary-bg);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--button-secondary-text);
    transition: background-color 0.2s, border-color 0.2s;
    display: inline-flex; /* Align icon */
    align-items: center;
    gap: 5px;
}

    .toggle-button:hover, .link-button:hover {
        background-color: var(--button-secondary-hover-bg);
    }

    .toggle-button .toggle-icon {
        font-weight: bold;
        font-family: monospace; /* Make +/- look consistent */
    }

/* Make timestamp/transcript toggles look more like links */
.link-button {
    background: none;
    border: none;
    color: var(--link-color);
    padding: 0;
    font-size: 1em; /* Match heading */
    text-decoration: underline;
}

    .link-button:hover {
        color: var(--link-hover-color);
        text-decoration: none;
    }

.collapsible-content {
    padding: 15px 5px; /* More padding */
    /* Remove border styles, rely on parent section border */
    background-color: transparent; /* Inherit from card */
    margin-top: 10px;
}

/* Severity Table */
#severityTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    font-size: 0.9em;
}

    #severityTable th,
    #severityTable td {
        border: 1px solid var(--border-color);
        padding: 8px 10px;
        text-align: left;
    }

    #severityTable th {
        background-color: var(--table-header-bg);
        font-weight: 600;
    }
    /* Apply severity colors directly to table cells */
    #severityTable .severity-mild-text {
        color: var(--severity-mild);
    }

    #severityTable .severity-moderate-text {
        color: var(--severity-moderate);
    }

    #severityTable .severity-severe-text {
        color: var(--severity-severe);
    }


/* Timestamps & Transcript */
#timestamps ul, #fullTranscript p {
    margin-top: 10px;
    padding-left: 0; /* Remove default list indent */
    list-style: none; /* Remove bullets */
}

#timestamps li, #fullTranscript p {
    margin-bottom: 12px;
    padding: 8px;
    border-left: 3px solid var(--border-color); /* Indication line */
    background-color: rgba(0,0,0,0.02); /* Very subtle bg */
}

html.dark-theme #timestamps li,
html.dark-theme #fullTranscript p {
    background-color: rgba(255,255,255,0.03);
    border-left-color: var(--input-border);
}

#timestamps strong, #fullTranscript strong { /* Highlight style */
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 600; /* Bolder */
}

/* Player */
#player-section h2 {
    margin-top: 25px;
}

#player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    background-color: #000;
    margin-top: 15px;
    border-radius: 8px; /* Match card radius */
    border: 1px solid var(--border-color);
}

#player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#skip-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(220, 53, 69, 0.85); /* Use severity-moderate color with alpha */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: bold;
    display: none;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .input-area {
        display: flex;
        flex-direction: column;
    }

        .input-area input[type="text"] {
            max-width: none; /* Allow full width */
            margin-bottom: 15px;
        }

        .input-area button {
            align-self: flex-start; /* Align button left */
        }

    .site-header h1 {
        font-size: 1.3em;
    }

    /* #site-logo {
        width: 30px;
        height: 30px;
        margin-right: 8px;
    } */
}

/* --- END style.css --- */
