/* =====================================================================
   motionEye – dashboard theme (v2, written against motionEye main.css/main.html)
   Dark navy base, frosted glass, soft 1px borders, rounded cards, Inter,
   green / purple accents – same tokens as the home dashboard.
   NOTE: uses background-color (never the background shorthand) on elements
   that carry sprite icons, so the icons keep working.
   ===================================================================== */

:root {
    --card:        rgba(255, 255, 255, 0.055);
    --card-hover:  rgba(255, 255, 255, 0.10);
    --card-border: rgba(255, 255, 255, 0.09);
    --glass:       rgba(8, 9, 18, 0.72);
    --glass-light: rgba(8, 9, 18, 0.55);
    --text-1:      #e8eaf0;
    --text-2:      #8b95a8;
    --text-3:      #515b6b;
    --green:       #4ade80;
    --purple:      #a78bfa;
    --blue:        #3b82f6;
    --red:         #f87171;
    --orange:      #fb923c;
    --bg:          #0e1018;
}

/* ── Base ─────────────────────────────────────── */

html { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body {
    color: var(--text-1);
    background-color: var(--bg);
    background-image: linear-gradient(rgba(10, 12, 22, 0.94), rgba(10, 12, 22, 0.94));
    background-attachment: fixed;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
}

@media all and (max-width: 1440px) { body { font-size: 16px; } }
@media all and (max-width: 400px)  { body { font-size: 16px; } }

a, a:visited { color: var(--green); }
a:hover      { color: #86efac; }

::selection { background: rgba(74, 222, 128, 0.3); }

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }

/* ── Header ───────────────────────────────────── */

div.header {
    background-color: var(--glass-light);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--card-border);
    box-shadow: none;
}

span.logo { color: var(--text-1); font-weight: 600; letter-spacing: -0.01em; }
div.logo  { opacity: 1; }
div.hostname { color: var(--text-2); font-size: 18px; }

/* top-bar icon buttons: keep sprites, only tint on hover */
div.button.settings-button,
div.button.logout-button,
div.button.rem-camera-button {
    border-radius: 8px;
    transition: background-color 0.15s, transform 0.1s linear;
}
div.button.settings-button:hover,
div.button.logout-button:hover,
div.button.rem-camera-button:hover { background-color: rgba(255, 255, 255, 0.10); }

div.settings-top-bar.open { background-color: var(--glass); }

/* ── Settings panel ───────────────────────────── */

div.settings {
    background-color: var(--glass);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-right: 1px solid var(--card-border);
}
@media all and (max-width: 1000px) {
    div.settings.open {
        background-color: rgba(10, 12, 22, 0.96);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    }
}

div.settings-progress { background-color: var(--bg); }

div.settings-container form { display: block; padding: 0 12px 20px; }

div.settings-section-title {
    background-color: transparent;
    color: var(--text-2);
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 18px 6px 8px;
}
div.settings-section-title a,
a.settings-section-title { color: var(--text-2); text-decoration: none; }

/* each section's table becomes a card */
table.settings {
    background-color: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 0.7em 0.6em 0.9em;
}

td.settings-item-label,
span.settings-item-label { color: var(--text-2); }
span.settings-item-label { font-size: 0.82em; font-weight: 500; }
td.settings-item-value span.settings-item-label { color: var(--text-1); }
span.settings-item-unit  { color: var(--text-3); }

div.settings-item-separator { border-top-color: var(--card-border); }

span.help-mark { background-color: rgba(255, 255, 255, 0.07); color: var(--text-2); }
div.settings-section-title > span.help-mark { background-color: rgba(255, 255, 255, 0.07); }

span.minimize { opacity: 0.6; }

/* ── Form controls ────────────────────────────── */

select,
input[type=text],
input[type=password],
input[type=number],
textarea {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-1);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    font-family: inherit;
    transition: border-color 0.15s, background-color 0.15s;
}
select.styled, input.styled, textarea.styled { border-radius: 10px; }

select:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus {
    border-color: var(--green);
    background-color: rgba(255, 255, 255, 0.09);
}

input[type=text]:read-only { color: var(--text-3); }
select option { background-color: #151826; color: var(--text-1); }
::placeholder { color: var(--text-3); }

#cameraSelect { background-color: rgba(255, 255, 255, 0.08); }

/* ── Buttons (colours only, geometry untouched) ── */

div.apply-button {
    background-color: rgba(74, 222, 128, 0.18);
    border: 1px solid rgba(74, 222, 128, 0.5);
    color: var(--green);
    border-radius: 10px;
    box-sizing: border-box;
    font-weight: 600;
}
div.apply-button:hover  { background-color: rgba(74, 222, 128, 0.30); }
div.apply-button:active { background-color: rgba(74, 222, 128, 0.14); }
div.apply-button.progress { background-color: rgba(74, 222, 128, 0.18); }

div.normal-button { border-radius: 10px; color: var(--text-1); border: 1px solid var(--card-border); box-sizing: border-box; }

div.update-button, div.backup-button, div.restore-button,
div.edit-mask-button, div.save-mask-button, div.clear-mask-button, div.test-button {
    background: rgba(167, 139, 250, 0.20);
    border-color: rgba(167, 139, 250, 0.45);
}
div.update-button:hover, div.backup-button:hover, div.restore-button:hover,
div.edit-mask-button:hover, div.save-mask-button:hover, div.clear-mask-button:hover, div.test-button:hover {
    background: rgba(167, 139, 250, 0.34);
}
div.update-button:active, div.backup-button:active, div.restore-button:active,
div.edit-mask-button:active, div.save-mask-button:active, div.clear-mask-button:active, div.test-button:active {
    background: rgba(167, 139, 250, 0.14);
}

div.shut-down-button, div.reboot-button {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.45);
    color: var(--red);
}
div.shut-down-button:hover, div.reboot-button:hover   { background: rgba(248, 113, 113, 0.30); }
div.shut-down-button:active, div.reboot-button:active { background: rgba(248, 113, 113, 0.12); }

/* section on/off switches */
div.check-box.section div.check-box-button { background-color: rgba(255, 255, 255, 0.18); }
div.check-box.on.section div.check-box-button { background-color: var(--green); }
div.check-box.on.section:focus div.check-box-button,
div.check-box.on.section:hover div.check-box-button { background-color: #86efac; }

/* ── Camera cards ─────────────────────────────── */

div.camera-frame {
    background-color: var(--card);
    background-clip: padding-box;       /* gutters (the 0.2em borders) stay see-through */
    border-color: transparent;
    border-radius: 18px;
}
div.camera-frame.motion-detected { background-color: rgba(248, 113, 113, 0.22); }

div.camera-container img.camera,
div.camera-container { border-radius: 14px; overflow: hidden; }

div.camera-overlay-top,
div.camera-overlay-bottom {
    background-color: rgba(8, 9, 18, 0.62);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
div.camera-frame.motion-detected div.camera-overlay-top,
div.camera-frame.motion-detected div.camera-overlay-bottom { background-color: rgba(120, 35, 35, 0.75); }

div.camera-overlay-top    { border-radius: 14px 14px 0 0; }
div.camera-overlay-bottom { border-radius: 0 0 14px 14px; }

span.camera-name { color: var(--text-1); font-weight: 600; }
span.camera-fps, span.camera-monitoring { color: var(--text-2); }

div.camera-top-button, div.camera-action-button { transition: background-color 0.15s, opacity 0.15s; border-radius: 10px; }
div.camera-top-button:hover, div.camera-action-button:hover { background-color: rgba(255, 255, 255, 0.10); }

div.camera-overlay-mask { background: rgba(74, 222, 128, 0.18); }

div.camera-progress.visible { opacity: 0.5; }
img.background-logo { opacity: 0.025; }

div.footer { color: var(--text-3); }
div.copyright-note { border-top-color: var(--card-border); }
div.footer a { color: var(--text-2); }

/* ── Media browser (pictures / movies) ────────── */

div.media-dialog-group-button {
    background-color: var(--card);
    color: var(--text-2);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}
div.media-dialog-group-button:hover  { background-color: var(--card-hover); }
div.media-dialog-group-button:active { background-color: var(--card); }
div.media-dialog-group-button.current {
    background-color: rgba(74, 222, 128, 0.18);
    border-color: rgba(74, 222, 128, 0.5);
    color: var(--green);
}
div.media-dialog-group-button.current:hover  { background-color: rgba(74, 222, 128, 0.30); }
div.media-dialog-group-button.current:active { background-color: rgba(74, 222, 128, 0.14); }

div.media-list-group-title { background-color: transparent; color: var(--text-1); font-weight: 600; }

div.media-list-entry { background-color: var(--card); border-bottom-color: var(--card-border); }
div.media-list-entry:hover  { background-color: var(--card-hover); }
div.media-list-entry:active { background-color: var(--card); }
img.media-list-preview { border-color: var(--card-border); border-radius: 6px; }
div.media-list-entry-details { color: var(--text-2); }

div.media-list-download-button, div.media-dialog-button {
    background: rgba(167, 139, 250, 0.22);
    color: var(--text-1);
    border-radius: 8px;
}
div.media-list-download-button:hover, div.media-dialog-button:hover   { background: rgba(167, 139, 250, 0.36); }
div.media-list-download-button:active, div.media-dialog-button:active { background: rgba(167, 139, 250, 0.16); }

div.media-list-delete-button,
div.media-dialog-delete-all-button,
div.button.dialog.delete {
    background: rgba(248, 113, 113, 0.20);
    color: var(--red);
    border-radius: 8px;
}
div.media-list-delete-button:hover, div.media-dialog-delete-all-button:hover { background: rgba(248, 113, 113, 0.34); }
div.media-list-delete-button:active, div.media-dialog-delete-all-button:active { background: rgba(248, 113, 113, 0.14); }

td.login-dialog-error, span#cameraMsgLabel { color: var(--red); }

/* ── Dialogs, sliders, toasts (ui.css classes – best effort) ── */

div.modal-glass { background-color: rgba(5, 6, 12, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

div.modal-container {
    background-color: rgba(14, 16, 26, 0.9);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    color: var(--text-1);
}
div.modal-title-bar { background-color: transparent; border-bottom: 1px solid var(--card-border); color: var(--text-1); font-weight: 600; }

div.button.dialog {
    background-color: var(--card);
    color: var(--text-1);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}
div.button.dialog:hover { background-color: var(--card-hover); }
div.button.dialog.default {
    background-color: rgba(74, 222, 128, 0.18);
    border-color: rgba(74, 222, 128, 0.5);
    color: var(--green);
}
div.button.dialog.default:hover { background-color: rgba(74, 222, 128, 0.30); }

div.popup-message {
    background-color: rgba(14, 16, 26, 0.92);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: var(--text-1);
}

div.progress-bar { background-color: rgba(255, 255, 255, 0.09); border-radius: 99px; }
div.progress-bar-fill { background-color: var(--green); border-radius: 99px; }

div.slider-bar { background-color: rgba(255, 255, 255, 0.09); border-radius: 99px; }

/* ── Round 2: override ui.css widgets (blue → dashboard palette) ───────
   ui.css styles inputs/switches/sliders with higher specificity, so these
   use !important. Blue sprite graphics are recoloured with CSS filters:
   hue-rotate(-62deg) turns motionEye blue into the dashboard green.        */

/* text inputs, selects, textareas */
select,
input[type=text],
input[type=password],
input[type=number],
input[type=email],
textarea {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 10px !important;
    color: var(--text-1) !important;
    box-shadow: none !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-family: inherit !important;
    outline: none !important;
}

select:hover,
input[type=text]:hover,
input[type=password]:hover,
input[type=number]:hover,
textarea:hover { border-color: rgba(255, 255, 255, 0.18) !important; }

select:focus,
input[type=text]:focus,
input[type=password]:focus,
input[type=number]:focus,
textarea:focus {
    border-color: var(--green) !important;
    background-color: rgba(255, 255, 255, 0.09) !important;
}

/* read-only fields look like plain info, not inputs */
input[readonly],
input[readonly]:hover,
input[readonly]:focus {
    background-color: transparent !important;
    border-color: var(--card-border) !important;
    color: var(--text-3) !important;
}

/* drop-downs: neutral chevron instead of the blue arrow */
select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding-right: 32px !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%238b95a8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 11px center !important;
    background-size: 12px 8px !important;
    cursor: pointer;
}
select:focus {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1.5l5 5 5-5' fill='none' stroke='%234ade80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") !important;
}
select option { background-color: #151826 !important; color: var(--text-1) !important; }

#cameraSelect { font-weight: 600; }

/* sliders, progress bars: neutral grey */
div.slider {
    filter: grayscale(1) brightness(1.45);      /* neutral grey slider, matches the muted UI */
}
div.progress-bar {
    filter: grayscale(1) brightness(0.8);       /* disk usage bar: neutral grey */
}

/* icon sprites: muted grey like the dashboard icons, green on hover */
div.button.settings-button,
div.button.logout-button,
div.button.rem-camera-button,
div.camera-top-button {
    filter: grayscale(1) brightness(1.7);
    opacity: 0.8;
    transition: filter 0.15s, opacity 0.15s, background-color 0.15s;
}
div.button.settings-button:hover,
div.button.logout-button:hover,
div.button.rem-camera-button:hover,
div.camera-top-button:hover {
    filter: hue-rotate(-62deg) brightness(1.25);
    opacity: 1;
}

/* section collapse arrows and help marks */
span.minimize { filter: grayscale(1) brightness(1.4); opacity: 0.7; }
span.help-mark { color: var(--text-2) !important; }

/* tidier settings rows */
tr.settings-item td { padding-top: 3px; padding-bottom: 3px; }
td.settings-item-label { padding-right: 12px; }
div.settings-item-separator { margin: 0.6em 0.4em; }

/* checkbox/switch inside section titles sits level with the title text */
div.settings-section-title div.check-box.section { margin-top: -2px; }

/* ── Round 3: bigger controls, purple accents, nicer buttons ───────── */

/* roomier labels and rows */
span.settings-item-label { font-size: 0.9em; }
tr.settings-item td { padding-top: 5px; padding-bottom: 5px; }

/* larger inputs and selects */
select,
input[type=text],
input[type=password],
input[type=number],
input[type=email] {
    height: 38px !important;
    font-size: 15px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 13px !important;
    border-radius: 12px !important;
}
select { padding-right: 36px !important; background-position: right 13px center !important; }
textarea {
    font-size: 15px !important;
    padding: 10px 13px !important;
    border-radius: 12px !important;
    min-height: 90px;
}
input[type=text].number,
input[type=text].working-schedule.number { text-align: left; }

/* switches: explicit purple pill (no filter) */
div.check-box {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 99px !important;
    transition: background-color 0.15s, border-color 0.15s;
}
div.check-box div.check-box-button {
    background-color: rgba(255, 255, 255, 0.38) !important;
    border-radius: 99px !important;
    transition: background-color 0.15s;
}
div.check-box.on {
    background-color: rgba(167, 139, 250, 0.22) !important;
    border-color: rgba(167, 139, 250, 0.6) !important;
}
div.check-box.on div.check-box-button,
div.check-box.on.section div.check-box-button { background-color: var(--purple) !important; }
div.check-box:hover div.check-box-button,
div.check-box.on:hover div.check-box-button,
div.check-box.on.section:hover div.check-box-button,
div.check-box.on.section:focus div.check-box-button { background-color: #c4b5fd !important; }

/* buttons: taller, softer, readable */
div.normal-button {
    height: 38px !important;
    line-height: 36px !important;
    width: 10em !important;
    font-size: 15px !important;
    font-weight: 500;
    border-radius: 12px !important;
    margin: 4px 0 !important;
}

div.update-button, div.backup-button, div.restore-button,
div.edit-mask-button, div.save-mask-button, div.clear-mask-button, div.test-button {
    background: rgba(167, 139, 250, 0.20) !important;
    border: 1px solid rgba(167, 139, 250, 0.45) !important;
    color: #ddd6fe !important;
}
div.update-button:hover, div.backup-button:hover, div.restore-button:hover,
div.edit-mask-button:hover, div.save-mask-button:hover, div.clear-mask-button:hover, div.test-button:hover {
    background: rgba(167, 139, 250, 0.34) !important;
    border-color: rgba(167, 139, 250, 0.7) !important;
    color: #fff !important;
}
div.update-button:active, div.backup-button:active, div.restore-button:active,
div.edit-mask-button:active, div.save-mask-button:active, div.clear-mask-button:active, div.test-button:active {
    background: rgba(167, 139, 250, 0.14) !important;
}

div.shut-down-button, div.reboot-button {
    background: rgba(248, 113, 113, 0.18) !important;
    border: 1px solid rgba(248, 113, 113, 0.45) !important;
    color: #fecaca !important;
}
div.shut-down-button:hover, div.reboot-button:hover {
    background: rgba(248, 113, 113, 0.32) !important;
    border-color: rgba(248, 113, 113, 0.7) !important;
    color: #fff !important;
}

/* Apply (top bar, 50px tall) */
div.apply-button {
    height: 36px !important;
    line-height: 34px !important;
    margin: 7px 10px !important;
    width: 6em !important;
    font-size: 16px;
    border-radius: 12px !important;
    background-color: rgba(74, 222, 128, 0.20) !important;
    border: 1px solid rgba(74, 222, 128, 0.55) !important;
    color: #bbf7d0 !important;
}
div.apply-button:hover { background-color: rgba(74, 222, 128, 0.34) !important; color: #fff !important; }

/* media browser / dialog buttons share the same shape */
div.media-dialog-button,
div.media-list-download-button,
div.media-list-delete-button,
div.media-dialog-delete-all-button,
div.media-dialog-group-button { border-radius: 10px !important; }

/* ── Round 4: collapsed sections show only their title ─────────────── */

/* a collapsed section keeps an empty padded table; hide that card entirely */
div.settings-section-title:has(span.minimize:not(.open)) + table.settings {
    display: none !important;      /* !important: motionEye sets inline display via JS */
}

/* tighter spacing between collapsed titles */
div.settings-section-title:has(span.minimize:not(.open)) { padding-bottom: 6px; }

/* ── Round 5: dashboard-style camera cards, quiet footer, no watermark ── */

/* remove the faint motionEye owl watermark behind the cameras */
img.background-logo { display: none !important; }

/* camera cards = dashboard .widget look: soft fill, 1px border, 18px radius */
div.camera-frame {
    background-color: var(--card);
    box-shadow: inset 0 0 0 1px var(--card-border);
}
div.camera-frame.motion-detected {
    background-color: rgba(248, 113, 113, 0.14);
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.55);
}

/* footer: just a small muted line, no rule */
div.footer { color: var(--text-3); }
div.copyright-note {
    border-top: none;
    margin: 0;
    padding: 0;
    text-align: center;
    font-size: 0.95em;
    letter-spacing: 0.01em;
}
div.copyright-note a, div.footer a { color: var(--text-2); text-decoration: none; transition: color 0.15s; }
div.copyright-note a:hover { color: var(--green); }

/* ── Round 6: compact, vertically centred top bar ─────────────────── */

div.header { height: 50px; }

/* left side: one flex row, everything centred on the same line */
div.settings-top-bar {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    vertical-align: top;
    padding: 0 10px;
    box-sizing: border-box;
}
div.settings-top-bar.closed div.apply-button { display: none !important; }

/* smaller icon buttons (sprites scale with the box) */
div.button.settings-button,
div.button.logout-button,
div.button.rem-camera-button {
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    flex: 0 0 auto;
    vertical-align: middle;
}
div.settings-top-bar.open div.button.rem-camera-button { display: block; }

/* camera selector and hostname match the icon height */
#cameraSelect {
    height: 34px !important;
    font-size: 14px !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    max-width: 220px;
    width: auto !important;
}
div.settings-top-bar.open #cameraSelect { display: block; }

div.hostname {
    font-size: 15px;
    line-height: 34px;
    margin: 0;
    color: var(--text-2);
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Apply sits at the right end of the bar, same height as the controls */
div.apply-button {
    float: none !important;
    margin: 0 0 0 auto !important;
    height: 34px !important;
    line-height: 32px !important;
    width: 5.5em !important;
    font-size: 15px !important;
    flex: 0 0 auto;
}

/* right side: logo on the same centre line */
div.logo {
    display: flex;
    align-items: center;
    height: 50px;
    padding-right: 14px;
}
span.logo { top: 0; font-size: 21px; line-height: 1; }
img.logo  { width: 28px; height: 28px; padding: 0 0 0 8px; }

/* ── Round 7: evenly spaced camera cards, thin border, no hover effect ── */

/* page margins: 12px around the grid (6px padding + 6px card gutter) */
div.page-container:not(.single-cam):not(.full-screen):not(.single-cam-edit) {
    padding: 56px 6px 24px 6px;
}

/* every card gets the same 6px transparent gutter on all four sides
   -> 12px gap between cards, 12px to the window edge */
div.page-container:not(.single-cam):not(.full-screen) div.camera-frame:not(.full-screen-hidden):not(.single-cam-hidden) {
    border: 6px solid transparent;
    padding: 1px;                       /* keeps the 1px card border visible around the picture */
    background-clip: padding-box;
    border-radius: 18px;
}

div.camera-frame { overflow: hidden; }

/* picture and overlay bars fill the card; the card itself does the rounding */
div.camera-container,
div.camera-container img.camera { border-radius: 0; }
div.camera-overlay { top: 1px; right: 1px; bottom: 1px; left: 1px; }
div.camera-overlay-top,
div.camera-overlay-bottom { border-radius: 0; }

/* no hover/press effects on the card or its overlay bars */
div.page-container div.camera-frame:hover,
div.page-container div.camera-frame:active {
    transform: none;
    background-color: var(--card);
    box-shadow: inset 0 0 0 1px var(--card-border);
}
div.page-container div.camera-frame.motion-detected:hover,
div.page-container div.camera-frame.motion-detected:active {
    background-color: rgba(248, 113, 113, 0.14);
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.55);
}
div.page-container div.camera-frame:hover div.camera-overlay-top,
div.page-container div.camera-frame:hover div.camera-overlay-bottom { background-color: rgba(8, 9, 18, 0.62); }
div.page-container div.camera-frame.motion-detected:hover div.camera-overlay-top,
div.page-container div.camera-frame.motion-detected:hover div.camera-overlay-bottom { background-color: rgba(120, 35, 35, 0.75); }

/* ── Round 8: compact camera overlays (name/fps bar + action buttons) ── */

/* top bar of a camera card: one centred row, same icon size as the page top bar */
div.camera-overlay-top { line-height: 1.2; }
div.camera-top-row {
    align-items: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 7px 10px 7px 12px;
    gap: 10px;
}
div.camera-info {
    justify-content: center;
    gap: 3px;
    font-size: 0.8em;
}
div.camera-name, div.camera-fps, div.camera-monitoring { height: auto; }
span.camera-name { padding-left: 0; font-size: 1.05em; }
span.camera-fps, span.camera-monitoring { padding: 0; }
div.camera-fps { font-size: 0.85em; }

div.camera-top-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: center;
    gap: 6px;
    width: auto;
    flex: 0 0 auto;
}
div.camera-top-button {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 8px;
    vertical-align: middle;
}

/* bottom bar (snapshot, record, PTZ …): same size, evenly spaced */
div.camera-action-buttons-wrapper {
    justify-content: center;
    align-items: center;
    gap: 6px;
    max-height: none;
    padding: 0;
}
div.camera-action-buttons-wrapper:has(div.camera-action-button) { padding: 7px 10px; }

/* bottom overlay bar (only holds snapshot / record / PTZ buttons): hidden.
   To get it back for cameras that use those buttons, delete this rule. */
div.camera-overlay-bottom {
    display: none !important;
}
div.camera-action-button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    opacity: 0.85;
}
div.camera-action-button:hover { opacity: 1; }

/* ── Round 9: media browser (pictures / movies list) ──────────────── */

div.modal-title-bar { font-size: 1.05em; letter-spacing: 0.01em; }

/* close (×) button: muted, green on hover */
div.modal-close-button {
    filter: grayscale(1) brightness(1.6);
    opacity: 0.8;
    transition: filter 0.15s, opacity 0.15s;
}
div.modal-close-button:hover { filter: hue-rotate(-62deg) brightness(1.25); opacity: 1; }

/* left column: date groups */
div.media-dialog-groups { padding: 4px 8px 0 4px; box-sizing: content-box; }
div.media-dialog-group-button {
    height: 38px;
    line-height: 36px;
    width: 100%;
    margin: 0 0 6px;
    border-radius: 12px !important;
    font-size: 0.85em;
    font-weight: 500;
}
div.media-dialog-group-button.current {
    background-color: rgba(167, 139, 250, 0.22);
    border-color: rgba(167, 139, 250, 0.55);
    color: #ddd6fe;
}
div.media-dialog-group-button.current:hover  { background-color: rgba(167, 139, 250, 0.34); }
div.media-dialog-group-button.current:active { background-color: rgba(167, 139, 250, 0.16); }

/* list: each file is a card row  [ preview | name + details | Download | Remove ] */
div.media-dialog-list { padding: 4px 6px 4px 0; }

div.media-list-group-title {
    text-align: left;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
    padding: 14px 4px 8px;
}

div.media-list-entry {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    height: auto;
    min-height: 0;
    padding: 9px 12px;
    margin: 0 0 8px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background-color: var(--card);
    box-sizing: border-box;
}
div.media-list-entry:hover  { background-color: var(--card-hover); }
div.media-list-entry:active { background-color: var(--card); }

img.media-list-preview {
    grid-column: 1;
    grid-row: 1 / span 2;
    float: none;
    width: 112px;
    height: 63px;
    margin: 0;
    object-fit: cover;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.04);
}

div.media-list-entry-name {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    text-align: left;
    font-size: 1.02em;
    font-weight: 600;
    padding: 0 0 2px;
    color: var(--text-1);
}
div.media-list-entry-details {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    text-align: left;
    font-size: 0.82em;
    padding: 0;
    color: var(--text-2);
}

/* row buttons: compact, side by side, vertically centred */
div.media-list-download-button,
div.media-list-delete-button {
    grid-row: 1 / span 2;
    align-self: center;
    float: none;
    clear: none;
    width: auto;
    min-width: 92px;
    height: 34px;
    line-height: 32px;
    margin: 0;
    padding: 0 14px;
    font-size: 0.85em;
    font-weight: 500;
    box-sizing: border-box;
    border-radius: 10px !important;
}
div.media-list-download-button {
    grid-column: 3;
    background: rgba(167, 139, 250, 0.20);
    border: 1px solid rgba(167, 139, 250, 0.45);
    color: #ddd6fe;
}
div.media-list-delete-button {
    grid-column: 4;
    background: rgba(248, 113, 113, 0.16);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fecaca;
}
div.media-list-download-button:hover { background: rgba(167, 139, 250, 0.34); color: #fff; }
div.media-list-delete-button:hover   { background: rgba(248, 113, 113, 0.30); color: #fff; }

/* footer buttons (Delete all etc.) */
div.media-dialog-buttons { margin: 10px 0 4px; }
div.media-dialog-button,
div.media-dialog-delete-all-button {
    height: 36px;
    line-height: 34px;
    padding: 0 18px;
    font-size: 0.85em;
    font-weight: 500;
    box-sizing: border-box;
    border-radius: 10px !important;
}
div.media-dialog-delete-all-button {
    background: rgba(248, 113, 113, 0.16) !important;
    border: 1px solid rgba(248, 113, 113, 0.4) !important;
    color: #fecaca !important;
}
div.media-dialog-delete-all-button:hover { background: rgba(248, 113, 113, 0.30) !important; color: #fff !important; }

/* narrow screens: drop the thumbnail, keep name + buttons */
@media all and (max-width: 700px) {
    div.media-list-entry { grid-template-columns: minmax(0, 1fr) auto auto; padding: 9px 10px; }
    img.media-list-preview { display: none; }
    div.media-list-entry-name, div.media-list-entry-details { grid-column: 1; }
    div.media-list-download-button { grid-column: 2; min-width: 0; padding: 0 10px; }
    div.media-list-delete-button   { grid-column: 3; min-width: 0; padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
