#video-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

#video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#scrubber {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: var(--scrubber-bg);
    cursor: pointer;
}

#scrubber-progress {
    height: 100%;
    background-color: #4CAF50;
}

.video-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 4px;
}

.video-controls button {
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    min-width: 40px;
}

.video-controls button:hover {
    background: rgba(0, 0, 0, 0.9);
}

#video-time-display {
    color: white;
    font-size: 0.9em;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    min-width: 70px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Hide all overflow to prevent body scrolling */
    height: 100vh; /* Ensure body takes full viewport height */
    --bg-color: #ffffff;
    --text-color: #333333;
    --secondary-text-color: #666666;
    --border-color: #dddddd;
    --item-hover-bg: #f0f9ff;
    --admin-bg: #f5f5f5;
    --thumbnail-placeholder-bg: #eeeeee;
    --scrubber-bg: #cccccc;
    --item-playing-bg: #f0f9ff;
    --item-playing-border: #4CAF50;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-container {
    min-height: 100vh;
    height: 100vh; /* Ensure it takes full height */
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden; /* Hide vertical overflow */
}

/* Admin Header */
.admin-header {
    width: 100%;
    display: flex;
    background-color: var(--admin-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 10px; /* Reduced horizontal padding */
    align-items: center;
    height: 48px;
    overflow: visible; /* Keep overflow visible for dropdown menus */
    position: sticky;
    top: 0;
    z-index: 1002;
    flex-shrink: 0; /* Prevent shrinking */
    box-sizing: border-box; /* Include padding in width calculations */
}

.admin-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px; /* Smaller gap */
    white-space: nowrap;
    overflow: visible; /* Allow dropdown menus to be visible */
    width: calc(100% - 20px); /* Controlled width with slight buffer */
    padding-right: 5px; /* Small right padding */
}

.admin-controls p {
    margin: 0;
    white-space: nowrap;
}

.hidden {
    display: none;
}

/* Hamburger Menu */
.hamburger-menu {
    position: relative;
    display: inline-block;
    z-index: 1001;
}

.hamburger-button {
    padding: 4px 8px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
    line-height: 1;
    flex-shrink: 0; /* Prevent shrinking */
}

.hamburger-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.menu-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background-color: var(--bg-color);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1003; /* Higher than admin-header */
    border-radius: 4px;
    border: 1px solid var(--border-color);
    padding: 10px 0;
    margin-top: 5px;
    max-height: calc(100vh - 100px); /* Prevent extending past viewport */
    overflow-y: auto; /* Allow scrolling if needed */
}

.menu-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.menu-content a:hover {
    background-color: var(--item-hover-bg);
}

.menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

.menu-content p {
    padding: 8px 16px;
    margin: 0;
    color: var(--secondary-text-color);
    border-top: 1px solid var(--border-color);
}

.menu-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
}

.menu-toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-left: 10px;
}

.menu-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.menu-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.menu-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .menu-toggle-slider {
    background-color: #4CAF50;
}

input:checked + .menu-toggle-slider:before {
    transform: translateX(16px);
}


/* Content */
.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: hidden; /* Changed to hidden to prevent scrolling at container level */
    z-index: 1;
}

.video-section {
    width: 100%;
    margin-bottom: 20px;
    flex-shrink: 0; /* Prevent shrinking */
}

.file-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flexbox to respect the overflow */
}

.no-videos {
    padding: 20px;
    text-align: center;
    color: var(--secondary-text-color);
    font-style: italic;
}

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

.file-list li {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 5fr auto;
    gap: 10px;
    align-items: center;
}

.video-entry {
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: flex-start;
    width: 100%;
}

.thumbnail-container {
    position: relative;
    width: 120px;  /* Reduced from 240px to 120px */
    height: 67px;
    display: flex;
    cursor: pointer;
}

.video-thumbnail {
    width: 120px;
    height: 67px;
    object-fit: cover;
    border-radius: 4px;
}

.video-thumbnail.animated {
    border-left: 2px solid #4CAF50;
    position: absolute;
    left: 0;  /* Changed from 124px to 0 */
    opacity: 0;
    transition: opacity 0.3s;
}

.thumbnail-container:hover .video-thumbnail.animated {
    opacity: 1;
}

.video-thumbnail-placeholder {
    width: 120px;
    height: 67px;
    background-color: var(--thumbnail-placeholder-bg);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.motion-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffcc00;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 5;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* "Pending analysis" badge — same shape as the motion badge, but muted (not the
   motion yellow) and gently pulsing, so unprocessed clips read as in-progress. */
.motion-indicator.pending-indicator {
    color: #d6d6d6;
    background-color: rgba(0, 0, 0, 0.55);
    animation: pending-pulse 1.8s ease-in-out infinite;
}
@keyframes pending-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* Small "pending" text tag next to a clip name that hasn't been analyzed yet. */
.pending-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    font-size: 0.68em;
    font-family: sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--secondary-text-color, #888);
    background: rgba(128, 128, 128, 0.15);
    border: 1px solid var(--border-color, #ccc);
    border-radius: 10px;
    vertical-align: middle;
}

.file-list a {
    color: var(--text-color);
    text-decoration: none;
    font-family: monospace;
    font-size: 1.1em;
    padding-left: 8px;
    text-align: left;
    display: block;
}

.file-list .actions {
    font-size: 0.9em;
    text-align: right;
}

.heart-icon, .refresh-icon {
    cursor: pointer;
    font-size: 1.2em;
    color: #ccc;
    transition: color 0.2s;
    margin-left: 10px;
}

/* Favourite heart: the state is carried by the GLYPH — hollow ♡ when off,
   solid ♥ when on — so it reads without relying on colour vision. Colour is a
   redundant second cue. The markup hard-codes a literal ♥ in three places
   (video.html, index.html, script.js row template); zeroing the font size hides
   it and lets ::before draw the right glyph everywhere, so no template or JS
   has to change. ::before sizes must be absolute (rem) — an em size would
   resolve against the zeroed parent. */
.heart-icon {
    font-size: 0;
    color: var(--fav-off, #8a8a8a);
}
.heart-icon::before {
    content: "\2661";          /* ♡ hollow = not a favourite */
    font-size: 1.25rem;
    line-height: 1;
}
.heart-icon.favorite {
    color: var(--fav, #d81b60);
}
.heart-icon.favorite::before {
    content: "\2665";          /* ♥ solid = favourite */
}
.heart-icon:hover {
    color: var(--fav, #d81b60);
}

.refresh-icon:hover {
    color: #4CAF50;
}

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

/* Video Details */
.video-details {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--admin-bg);
}

.details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.details-row:last-child {
    margin-bottom: 0;
}

.video-title {
    font-size: 1.2em;
    color: var(--text-color);
    font-family: monospace;
    margin: 0;
    flex: 1;
}

.details-actions {
    display: flex;
    gap: 15px;
}

.details-actions .heart-icon,
.details-actions .refresh-icon,
.details-actions .motion-icon,
.details-actions .repair-icon {
    font-size: 1.3em;
    margin-left: 0;
    cursor: pointer;
    transition: color 0.2s;
}

.details-actions .heart-icon {
    font-size: 0;              /* glyph drawn by ::before (see .heart-icon) */
}
.details-actions .heart-icon::before {
    font-size: 1.35rem;
}
.details-actions .heart-icon.favorite {
    color: var(--fav, #d81b60);
}

.details-actions .motion-icon {
    color: #777;
}

.details-actions .motion-icon:hover {
    color: #4CAF50;
}

.details-actions .repair-icon {
    color: #777;
}

.details-actions .repair-icon:hover {
    color: #ff9800;
}

/* Video Repair */
.repair-info {
    margin-top: 15px;
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.repair-info.hidden {
    display: none;
}

.repair-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.repair-header h4 {
    margin: 0;
}

.repair-status {
    font-weight: bold;
    font-size: 0.9em;
}

.repair-result {
    margin-top: 8px;
    padding: 8px;
    background: var(--secondary-bg-color);
    border-radius: 4px;
    font-size: 0.9em;
    word-break: break-word;
}

.repair-result.hidden {
    display: none;
}

/* Motion detection */
.motion-info {
    margin-top: 15px;
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.motion-info.hidden {
    display: none;
}

/* People list styles */
.location-info {
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.location-info.hidden {
    display: none;
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.location-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-live-toggle {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dark-theme .location-live-toggle {
    background-color: rgba(255, 255, 255, 0.1);
}

.location-live-toggle:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.dark-theme .location-live-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.location-live-toggle.active {
    background-color: #4CAF50;
    color: white;
}

.location-live-toggle .live-icon {
    font-size: 14px;
}

.location-time-controls {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-picker-container {
    width: 100%;
}

.location-date-picker {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.time-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

.time-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

.time-display {
    font-size: 0.9em;
    color: var(--secondary-text-color);
    min-width: 70px;
    text-align: right;
}

.people-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.person-entry {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    background-color: #f8f8f8;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.person-entry:hover {
    background-color: #f0f0f0;
}

.dark-theme .person-entry {
    background-color: #2a2a2a;
}

.dark-theme .person-entry:hover {
    background-color: #333333;
}

.person-entry::after {
    content: "⌄";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    transition: transform 0.2s ease;
}

.person-entry.expanded::after {
    transform: translateY(-50%) rotate(180deg);
}

.person-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    background-color: #ccc;
}

.person-info {
    flex: 1;
}

.person-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.person-address {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.dark-theme .person-address {
    color: #aaa;
}

.person-metadata {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    opacity: 0;
    margin-bottom: 0;
}

.person-entry.expanded .person-metadata {
    max-height: 150px;
    opacity: 1;
    margin-bottom: 5px;
}

.dark-theme .person-metadata {
    color: #aaa;
}

.person-address {
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 500;
}

.person-coordinates {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: monospace;
    font-size: 0.85em;
    margin-bottom: 2px;
}

.person-accuracy {
    margin-left: auto;
    font-size: 0.85em;
    color: #777;
    font-style: italic;
}

.dark-theme .person-accuracy {
    color: #999;
}

.person-timestamp {
    font-size: 0.8em;
    color: #888;
    margin-top: 2px;
}

.dark-theme .person-timestamp {
    color: #777;
}

/* Source indicators */
.info-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.source-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 6px;
}

.source-post {
    background-color: #4CAF50;
    box-shadow: 0 0 2px #4CAF50;
}

.source-import {
    background-color: #FFC107;
    box-shadow: 0 0 2px #FFC107;
}

.motion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.motion-header h4 {
    margin: 0;
    color: var(--text-color);
}

.motion-status {
    font-size: 0.9em;
    color: var(--secondary-text-color);
}

.progress-container {
    height: 20px;
    background-color: var(--border-color);
    border-radius: 4px;
    margin: 10px 0;
    position: relative;
    overflow: hidden;
}

.progress-container.hidden {
    display: none;
}

.progress-bar {
    height: 100%;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.motion-result {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.motion-result.hidden {
    display: none;
}

.motion-no-result {
    padding: 10px;
    text-align: center;
    color: var(--secondary-text-color);
}

.motion-no-result.hidden {
    display: none;
}

.motion-thumbnail-container {
    width: 120px;
    height: 67px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.motion-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.motion-data {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.motion-timestamp {
    font-weight: bold;
    font-family: monospace;
}

.seek-button {
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    align-self: flex-start;
}

.seek-button:hover {
    background-color: #45a049;
}

/* Motion filter */
.motion-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.motion-toggle input {
    display: none;
}

.motion-filter-icon {
    font-size: 1.5rem;
    color: #ccc;
    transition: color 0.2s;
}

.motion-toggle input:checked + .motion-filter-icon {
    color: #4CAF50;
}

.filter-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.day-thumbs-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 8px;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.day-thumbs-btn:hover {
    background-color: var(--secondary-bg-color);
}

.day-thumbs-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.video-filename,
.video-filesize,
.video-timestamp {
    color: var(--secondary-text-color);
    font-size: 0.9em;
    font-family: monospace;
}

.file-list li.playing {
    background-color: var(--item-playing-bg);
    border-left: 3px solid var(--item-playing-border);
}


/* Theme Toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    cursor: pointer;
    flex-shrink: 0; /* Prevent shrinking */
    margin-right: 0; /* No right margin */
}

.theme-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px; /* Reduced width */
    height: 20px; /* Reduced height */
    margin-left: 5px; /* Less margin */
}

.theme-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px; /* Smaller indicator */
    width: 14px; /* Smaller indicator */
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .theme-toggle-slider {
    background-color: #4CAF50;
}

input:checked + .theme-toggle-slider:before {
    transform: translateX(20px); /* Adjusted for smaller width */
}

/* Dark Theme */
body.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --secondary-text-color: #a0a0a0;
    --border-color: #333333;
    --item-hover-bg: #2a3f52;
    --admin-bg: #2a2a2a;
    --thumbnail-placeholder-bg: #333333;
    --scrubber-bg: #444444;
    --item-playing-bg: #2a3f52;
    --item-playing-border: #4CAF50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-header {
        height: auto;
        padding: 8px 10px;
    }
    
    .admin-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding-right: 5px; /* Less padding on mobile */
    }
    
    .theme-toggle {
        margin-left: 0;
        font-size: 0.9em; /* Smaller text on mobile */
    }
    
    .video-title {
        height: auto;
    }
    
    /* Ensure date-calendar doesn't get cut off in mobile view */
    .date-calendar {
        left: 0;
        width: 260px;
    }
    
    /* Adjust position for date navigation components */
    .date-navigation {
        position: relative;
    }
}

/* Filters */
.filter-controls {
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking */
}

.filter-group {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2001;
}

/* Date Navigation */
.date-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-navigation button {
    background-color: var(--admin-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px 12px;
    font-size: 0.9rem;
    width: 40px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.date-display {
    font-family: monospace;
    font-size: 0.9rem;
    white-space: nowrap;
    min-width: 140px;
    text-align: center;
}

/* Favorites Filter */
.favorites-filter {
    margin-left: auto;
}

.heart-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.heart-toggle input {
    display: none;
}

/* "Favourites only" filter — same hollow/solid convention as the row hearts, so
   whether the filter is engaged doesn't come down to hue either. */
.heart-filter-icon {
    font-size: 0;
    color: var(--fav-off, #8a8a8a);
    transition: color 0.2s;
}
.heart-filter-icon::before {
    content: "\2661";          /* ♡ hollow = showing everything */
    font-size: 1.5rem;
    line-height: 1;
}

.heart-toggle input:checked + .heart-filter-icon {
    color: var(--fav, #d81b60);
}
.heart-toggle input:checked + .heart-filter-icon::before {
    content: "\2665";          /* ♥ solid = favourites only */
}

/* Date Calendar */
#date-filter-btn {
    padding: 6px 12px;
    background-color: var(--admin-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 120px;
    text-align: center;
}

.date-calendar {
    display: none;
    position: absolute;
    top: 34px;
    left: 0;
    z-index: 2000;
    width: 280px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.calendar-header button {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 8px;
    width: auto;
    height: auto;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 5px;
}

.weekday {
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 5px 0;
    color: var(--secondary-text-color);
}

.calendar-dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-date {
    text-align: center;
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.calendar-date:hover {
    background-color: var(--item-hover-bg);
}

.calendar-date.has-videos {
    font-weight: bold;
    position: relative;
}

.calendar-date.has-videos:after {
    content: "•";
    position: absolute;
    color: #4CAF50;
    font-size: 14px;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
}

.calendar-date.selected {
    background-color: var(--item-playing-border);
    color: white;
}

.calendar-date.inactive {
    color: var(--border-color);
    cursor: default;
}

.calendar-date.inactive:hover {
    background-color: transparent;
}

.calendar-footer {
    margin-top: 10px;
    text-align: right;
}

.calendar-footer button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

/* File list container */
.file-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 0; /* Important for flexbox to respect child overflow */
}

/* Landscape mode */
@media (min-width: 768px) and (orientation: landscape) {
    .content-container {
        flex-direction: row;
        gap: 20px;
    }
    
    .video-section {
        flex: 3;
        margin-bottom: 0;
    }
    
    .file-list-container {
        flex: 2;
    }
}

/* Theme Toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    margin-top: 15px;
    cursor: pointer;
}

.theme-toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    margin-left: 8px;
}

.theme-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px; /* Smaller indicator */
    width: 14px; /* Smaller indicator */
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .theme-toggle-slider {
    background-color: #4CAF50;
}

input:checked + .theme-toggle-slider:before {
    transform: translateX(20px); /* Adjusted for smaller width */
}

/* Dark Theme */
body.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --secondary-text-color: #a0a0a0;
    --border-color: #333333;
    --item-hover-bg: #2a3f52;
    --admin-bg: #2a2a2a;
    --thumbnail-placeholder-bg: #333333;
    --scrubber-bg: #444444;
    --item-playing-bg: #2a3f52;
    --item-playing-border: #4CAF50;
}
/* ── Finding motion & favourites across a long history ───────────────────── */
/* Calendar cells advertise what a day holds, so you can spot activity without
   opening each day in turn. Replaces the generic green dot when we know more. */
.calendar-date.has-motion:after,
.calendar-date.has-favorites:after {
    content: none;
}

.cal-marks {
    display: block;
    font-size: 9px;
    line-height: 1;
    margin-top: 2px;
    white-space: nowrap;
}

.cal-mark { margin: 0 1px; }
.cal-fav { color: #e74c3c; }
.cal-motion { color: #f39c12; }

/* Jump list: every day holding motion or favourites, newest first. */
.history-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: thin;
}

.strip-label {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    padding-right: 4px;
    white-space: nowrap;
}

.strip-empty {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    font-style: italic;
}

.day-chip {
    flex: 0 0 auto;
    background: var(--admin-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.day-chip:hover { background: var(--item-hover-bg); }
.day-chip b { font-weight: 600; margin-left: 4px; }
.chip-motion { color: #f39c12; }
.chip-fav { color: #e74c3c; }

/* Scope switch: one day vs the whole library. */
.scope-toggle {
    background: var(--admin-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.scope-toggle.scope-all {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
    font-weight: 600;
}

/* The date picker does nothing while searching all history — say so visually. */
.date-navigation.scope-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* Day separators in all-history results: the list can span years. */
.file-list li.day-sep {
    list-style: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    background: var(--admin-bg);
    border-top: 1px solid var(--border-color);
    padding: 5px 10px;
    margin-top: 4px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sep-counts { float: right; font-weight: 500; }

.load-more {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 9px;
    background: var(--admin-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.load-more:hover { background: var(--item-hover-bg); }

.list-end {
    text-align: center;
    padding: 10px;
    font-size: 0.78rem;
    color: var(--secondary-text-color);
}

/* ── Highlights: favourites & motion by year ─────────────────────────────── */
.highlights-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 14px 40px;
    /* body and .content-container both pin overflow to hidden, so a full year
       of months has to scroll inside this page or it simply gets clipped. */
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
}

.hl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.hl-kinds { display: flex; gap: 6px; }

.hl-kind {
    background: var(--admin-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
}

.hl-kind:hover { background: var(--item-hover-bg); }

.hl-kind.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
    font-weight: 600;
}

.hl-total { font-size: 0.8rem; color: var(--secondary-text-color); }

/* Year tabs — the whole library at a glance. */
.hl-years {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.hl-year {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 1rem;
    cursor: pointer;
}

.hl-year:hover { background: var(--item-hover-bg); }

.hl-year.active {
    border-color: #4CAF50;
    background: var(--item-playing-bg);
    font-weight: 600;
}

.hl-year b {
    display: inline-block;
    margin-left: 7px;
    font-size: 0.72rem;
    color: var(--secondary-text-color);
    font-weight: 600;
}

.hl-year.active b { color: #4CAF50; }

/* Annual calendar: twelve months of day cells, shaded by how much each holds. */
.cal-year {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.cal-month {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 10px 11px;
    background: var(--bg-color);
}

.cal-month-empty { opacity: 0.5; }

.cal-m-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.cal-m-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    background: var(--admin-bg);
    border-radius: 9px;
    padding: 1px 7px;
}

.cal-wd,
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-wd i {
    font-style: normal;
    text-align: center;
    font-size: 0.6rem;
    color: var(--secondary-text-color);
    padding-bottom: 2px;
}

.cal-pad { display: block; }

.cal-d {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-color);
    background: var(--admin-bg);
    padding: 0;
    line-height: 1;
}

/* A day with no clips at all reads as absent, not as "zero favourites". */
.cal-d.cal-none {
    background: transparent;
    color: var(--secondary-text-color);
    opacity: 0.35;
    cursor: default;
}

.cal-d:hover { border-color: var(--text-color); }
.cal-d.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 0 1px #4CAF50;
    font-weight: 700;
}

/* Favourites shade red; motion shades amber. */
.cal-d.lvl0 { }
.cal-d.lvl1 { background: #f9c8c0; color: #4a1410; }
.cal-d.lvl2 { background: #f09a8c; color: #4a1410; }
.cal-d.lvl3 { background: #e2685a; color: #fff; }
.cal-d.lvl4 { background: #c9352b; color: #fff; }
.cal-d.lvl5 { background: #96150f; color: #fff; }

body.hl-motion-mode .cal-d.lvl1 { background: #fde4b0; color: #4a3410; }
body.hl-motion-mode .cal-d.lvl2 { background: #f8c65f; color: #4a3410; }
body.hl-motion-mode .cal-d.lvl3 { background: #e8a317; color: #3a2708; }
body.hl-motion-mode .cal-d.lvl4 { background: #c07c07; color: #fff; }
body.hl-motion-mode .cal-d.lvl5 { background: #8a5600; color: #fff; }

.cal-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    margin: 12px 2px 0;
    font-size: 0.68rem;
    color: var(--secondary-text-color);
}

.cal-legend i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--admin-bg);
    display: inline-block;
}

.cal-legend i.lvl1 { background: #f9c8c0; }
.cal-legend i.lvl2 { background: #f09a8c; }
.cal-legend i.lvl3 { background: #e2685a; }
.cal-legend i.lvl4 { background: #c9352b; }
body.hl-motion-mode .cal-legend i.lvl1 { background: #fde4b0; }
body.hl-motion-mode .cal-legend i.lvl2 { background: #f8c65f; }
body.hl-motion-mode .cal-legend i.lvl3 { background: #e8a317; }
body.hl-motion-mode .cal-legend i.lvl4 { background: #c07c07; }

/* The clips for a clicked day. */
.cal-day-panel:not(:empty) {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 2px solid var(--border-color);
}

.cal-day-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.cal-day-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--secondary-text-color);
    background: var(--admin-bg);
    border-radius: 10px;
    padding: 1px 8px;
}

.cal-day-close {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: var(--text-color);
}

.cal-day-close:hover { background: var(--item-hover-bg); }

.hl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.hl-tile {
    position: relative;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    overflow: hidden;
    background: var(--thumbnail-placeholder-bg);
    cursor: pointer;
    aspect-ratio: 16 / 9;
}

.hl-tile:hover { border-color: #4CAF50; }

.hl-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hl-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.7rem;
    color: var(--secondary-text-color);
}

.hl-tile-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 6px;
    font-size: 0.68rem;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    text-align: left;
}

.hl-badge {
    position: absolute;
    top: 4px;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.hl-badge-fav { right: 4px; color: #ff6b6b; }
.hl-badge-motion { left: 4px; color: #ffc048; }





.hl-loading,
.hl-empty {
    padding: 30px 10px;
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

/* Inline player overlay. */
.hl-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.hl-viewer[hidden] { display: none; }

.hl-viewer-inner {
    position: relative;
    width: min(1000px, 100%);
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.hl-viewer video {
    width: 100%;
    max-height: 78vh;
    display: block;
    background: #000;
}

.hl-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #111;
    color: #eee;
    font-size: 0.85rem;
}

.hl-viewer-fav {
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
    user-select: none;
}

.hl-viewer-fav.on { color: #ff6b6b; }

.hl-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
}

.hl-close:hover { background: rgba(0, 0, 0, 0.85); }

@media (max-width: 600px) {
    .hl-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Opting the Highlights controls out of the global Material button skin ──
   material-overrides.css applies `button { ... !important }` to every button on
   the site (fixed 36px height, 0 16px padding, uppercase, primary background).
   The calendar's day cells and thumbnail tiles are buttons for keyboard access,
   not Material buttons — without this they blow past their grid columns and all
   shade the same primary blue. Matching !important is the only way to win. */
.highlights-page button.cal-d,
.highlights-page button.hl-tile,
.highlights-page button.hl-year,
.highlights-page button.hl-kind,
.highlights-page button.cal-day-close,
.hl-viewer button.hl-close {
    height: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    font-weight: 500 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.highlights-page button.cal-d {
    font-size: 0.62rem !important;
    border-radius: 3px !important;
    border-color: transparent !important;
    background-color: var(--admin-bg) !important;
}

.highlights-page button.cal-d.cal-none {
    background-color: transparent !important;
}

/* Favourites shade red, motion amber — restated with !important so the
   Material primary colour does not flatten every day to the same blue. */
.highlights-page .cal-d.lvl1 { background-color: #f9c8c0 !important; color: #4a1410 !important; }
.highlights-page .cal-d.lvl2 { background-color: #f09a8c !important; color: #4a1410 !important; }
.highlights-page .cal-d.lvl3 { background-color: #e2685a !important; color: #fff !important; }
.highlights-page .cal-d.lvl4 { background-color: #c9352b !important; color: #fff !important; }
.highlights-page .cal-d.lvl5 { background-color: #96150f !important; color: #fff !important; }

body.hl-motion-mode .highlights-page .cal-d.lvl1 { background-color: #fde4b0 !important; color: #4a3410 !important; }
body.hl-motion-mode .highlights-page .cal-d.lvl2 { background-color: #f8c65f !important; color: #4a3410 !important; }
body.hl-motion-mode .highlights-page .cal-d.lvl3 { background-color: #e8a317 !important; color: #3a2708 !important; }
body.hl-motion-mode .highlights-page .cal-d.lvl4 { background-color: #c07c07 !important; color: #fff !important; }
body.hl-motion-mode .highlights-page .cal-d.lvl5 { background-color: #8a5600 !important; color: #fff !important; }

.highlights-page button.cal-d.selected {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 1px #4CAF50 !important;
    font-weight: 700 !important;
}

.highlights-page button.hl-year {
    font-size: 1rem !important;
    padding: 7px 14px !important;
    border-radius: 8px !important;
}

.highlights-page button.hl-year.active {
    border-color: #4CAF50 !important;
    background-color: var(--item-playing-bg) !important;
    font-weight: 700 !important;
}

.highlights-page button.hl-kind {
    font-size: 0.85rem !important;
    padding: 6px 14px !important;
    border-radius: 16px !important;
    background-color: var(--admin-bg) !important;
}

.highlights-page button.hl-kind.active {
    background-color: #4CAF50 !important;
    border-color: #4CAF50 !important;
    color: #fff !important;
    font-weight: 700 !important;
}

.highlights-page button.hl-tile { border-radius: 7px !important; }
.highlights-page button.cal-day-close { border-radius: 50% !important; width: 24px; }
.hl-viewer button.hl-close {
    border-radius: 50% !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* Columns must be free to shrink below their content, or seven 48px Material
   buttons overflow a 205px month box. */
.cal-wd,
.cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }

/* ── Favourites lead the shading; motion is secondary ────────────────────────
   Every day that recorded anything also detected motion (424 of 424), so
   "has motion" cannot be a useful shade — it would light the whole year.
   Favourites land on 14% of days, so they get the colour, and unusually busy
   days get a small dot instead of competing for it. */
.highlights-page button.cal-d { position: relative; }

.highlights-page .cal-d.busy::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #e8a317;
    opacity: 0.85;
}

/* A favourite day's own shading must stay readable under the dot. */
.highlights-page .cal-d.lvl3.busy::after,
.highlights-page .cal-d.lvl4.busy::after,
.highlights-page .cal-d.lvl5.busy::after { background: #ffd479; }

/* In motion mode the bottom half of the range is deliberately faint: the
   median day sees 10 events, so shading those strongly says nothing. */
body.hl-motion-mode .highlights-page .cal-d.lvl1 {
    background-color: var(--admin-bg) !important;
    color: var(--secondary-text-color) !important;
}

.cal-legend .legend-note {
    margin-right: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-style: italic;
    opacity: 0.85;
}

.cal-legend i.legend-busy {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #e8a317;
}

/* ── Legend:every swatch says what it means ─────────────────────────────────── */
.cal-legend {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
}

.cal-legend .lg-title { font-weight: 600; color: var(--text-color); }

.cal-legend .lg-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.cal-legend .lg-sep {
    margin-left: 6px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    font-style: italic;
    opacity: 0.85;
}

/* Focused day panel: the favourites are the point, so give them room. */
.hl-grid-focus {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.cal-day-date { font-weight: 700; }

.highlights-page button.cal-day-toggle {
    height: auto !important;
    min-width: 0 !important;
    padding: 4px 11px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    box-shadow: none !important;
    background-color: var(--admin-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.highlights-page button.cal-day-toggle:hover {
    background-color: var(--item-hover-bg) !important;
}
