/* Global Styles */
/* B2 (UX-PLAN §1.3): the Google Fonts @import and the :root palette are gone.
   The fourteen --primary-color/--gray-color/... names are aliases in
   tokens.css's derived block (every page that links this file links
   tokens.css first); the font is Figtree through --font-sans. */

/* B21 s3 (CODE-13): this sheet is the `components` cascade layer; the order is declared once, in tokens.css. */
@layer components {


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Scrollbars: invisible track, minimal thumb ────────────────────────────
   App-wide, both themes, every region — chat (the document scroller),
   sidebar, Activity panel, Artifact panel, code blocks, hub pages, menus,
   modals. ONE treatment. The seven per-component treatments this replaced
   are deleted, not overridden; do not add an eighth.

   v176 hid scrollbars outright. That removed the only affordance telling a
   user there is more content, so the thumb is back — but the TRACK is not:
   it is transparent, so no channel or groove is drawn on any surface and
   the thumb appears to float on whatever it sits on.

   Colour is derived from --color-foreground, so it is muted in both themes
   with no hue and no second token. 20% resting / 32% hover is deliberately
   low contrast.

   ── Why the two mechanisms are fenced apart, not stacked ──
   Chromium implements BOTH, and gives `scrollbar-color` precedence: setting
   it would make Chromium discard the ::-webkit- rules below and lose the
   radius and the inset, since `scrollbar-color` carries only two flat
   colours. So the pseudo-elements are the primary path (Chromium + Safari)
   and the standard properties are fenced behind a query only Firefox
   matches. Firefox consequently renders a thin muted thumb with square ends,
   no inset and NO ARROW BUTTONS: it exposes no button surface at all, and
   `scrollbar-width: auto` would buy arrows on Windows only, at the cost of
   the thin thumb everywhere. Accepted approximation, not addressable in CSS. */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: transparent;
}
/* Explicit and load-bearing: the UA track is a visible strip in several
   themes, and `background: transparent` on ::-webkit-scrollbar alone does
   not suppress it. */
::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece,
::-webkit-scrollbar-corner {
    background: transparent;
    border: 0;
    box-shadow: none;
}
/* The 3px transparent border is what produces BOTH the inset from the edge
   and the 4px visual width inside a 10px box; background-clip keeps the
   fill off the border so the inset stays see-through rather than painting
   a wider bar. min-height/-width stop the thumb shrinking to a dot on a
   very long document. */
::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--color-foreground) 20%, transparent);
    background-clip: content-box;
    border: 3px solid transparent;
    border-radius: var(--radius-pill);
    min-height: 36px;
    min-width: 36px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: color-mix(in srgb, var(--color-foreground) 32%, transparent);
}

/* ── Arrow buttons ────────────────────────────────────────────────────────
   The native button slots, at both ends of every vertical scrollbar. Not
   custom elements: these are ::-webkit-scrollbar-button, so click-to-step,
   click-and-hold repeat, the hit area and the RTL edge are all the UA's.

   The GLYPH is ours by necessity, not by choice. Any ::-webkit-scrollbar
   rule switches Chromium to custom rendering for that scroller and it stops
   painting the UA triangle — the slot is an empty box and there is no
   property that brings the triangle back. Painting it here is what keeps
   the arrow at the thumb's exact tone, so the two stay in step if that mix
   is ever retuned; a UA triangle is drawn in a colour CSS cannot reach.

   Two linear-gradients per triangle, one per half, each filling one side of
   its own diagonal solid — a 6x3 filled wedge centred in the 10px box. The
   ±0.5px ramp at the diagonal is antialiasing; coincident stops stair-step
   at 3px.
   45deg runs toward the top-right, so its perpendicular bands read as `\`;
   135deg runs toward the bottom-right and reads as `/`. The first image
   pairs with the first background-position (2px, the left half). So
   `45,135` is `\` then `/` = a DOWN triangle, and `135,45` is `/` then `\`
   = an UP triangle.

   Firefox shows no arrows: `scrollbar-width: thin` removes the buttons and
   `scrollbar-color` has no button slot. Same documented approximation as
   its square thumb ends (:46). */
::-webkit-scrollbar-button:vertical:decrement:start,
::-webkit-scrollbar-button:vertical:increment:end {
    display: block;
    height: 10px;
    width: 10px;
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: 3px 3px, 3px 3px;
    background-position: 2px 4px, 5px 4px;
}
::-webkit-scrollbar-button:vertical:decrement:start {
    background-image:
        linear-gradient(135deg, transparent calc(50% - 0.5px),
            color-mix(in srgb, var(--color-foreground) 20%, transparent) calc(50% + 0.5px)),
        linear-gradient(45deg,
            color-mix(in srgb, var(--color-foreground) 20%, transparent) calc(50% - 0.5px),
            transparent calc(50% + 0.5px));
}
::-webkit-scrollbar-button:vertical:increment:end {
    background-image:
        linear-gradient(45deg, transparent calc(50% - 0.5px),
            color-mix(in srgb, var(--color-foreground) 20%, transparent) calc(50% + 0.5px)),
        linear-gradient(135deg,
            color-mix(in srgb, var(--color-foreground) 20%, transparent) calc(50% - 0.5px),
            transparent calc(50% + 0.5px));
}
::-webkit-scrollbar-button:vertical:decrement:start:hover {
    background-image:
        linear-gradient(135deg, transparent calc(50% - 0.5px),
            color-mix(in srgb, var(--color-foreground) 32%, transparent) calc(50% + 0.5px)),
        linear-gradient(45deg,
            color-mix(in srgb, var(--color-foreground) 32%, transparent) calc(50% - 0.5px),
            transparent calc(50% + 0.5px));
}
::-webkit-scrollbar-button:vertical:increment:end:hover {
    background-image:
        linear-gradient(45deg, transparent calc(50% - 0.5px),
            color-mix(in srgb, var(--color-foreground) 32%, transparent) calc(50% + 0.5px)),
        linear-gradient(135deg,
            color-mix(in srgb, var(--color-foreground) 32%, transparent) calc(50% - 0.5px),
            transparent calc(50% + 0.5px));
}
/* Chromium offers TWO slots at each end. The secondary pair is suppressed —
   one arrow per end, not two. Horizontal bars (code blocks, wide tables)
   stay button-free: the affordance asked for is up/down, and a blank slot
   on a 40px-wide overflow strip is dead space. */
::-webkit-scrollbar-button:vertical:increment:start,
::-webkit-scrollbar-button:vertical:decrement:end,
::-webkit-scrollbar-button:horizontal {
    display: none;
    width: 0;
    height: 0;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--color-foreground);
    background-color: var(--color-surface-2);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-5);
}

/* Header */
header {
    background-color: var(--color-card);
    color: var(--color-foreground);
    padding: 1rem 0;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--color-shadow) 5%, transparent);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}


.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-inline-start: var(--space-6);
}

.nav-links a {
    color: var(--color-foreground);
    text-decoration: none;
    font-weight: 500;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease, width .3s ease;
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover {
    color: var(--color-primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Forms */
.form-container {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2.5rem;
    margin: 3rem auto;
    max-width: 500px;
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--color-primary), var(--color-primary));
}

.form-container h2 {
    margin-bottom: 1.5rem;
    color: var(--color-foreground);
    font-weight: 600;
    text-align: center;
}

.form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-foreground);
    font-size: var(--text-base);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.checkbox-group label {
    display: inline;
    margin-bottom: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease, outline .3s ease;
    background-color: var(--color-surface-2);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

button, .btn {
    display: inline-block;
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    text-decoration: none;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    text-align: center;
}

/* Round 13 — split: accent hover is reserved for primary ACTION buttons
   (.btn) only. Bare <button> gets a neutral token fill so the global
   accent stops out-cascading each component's own neutral hover (sidebar,
   mode trigger, conversation rows, etc.). Component hovers still win
   because they're scoped higher; this is just the sane fallback. */
/* Accent hover reserved for primary ACTION buttons (.btn) only — the class
   those buttons explicitly opt into. */
.btn:hover {
    background-color: var(--color-primary-text);
}
/* App-wide NEUTRAL default for bare <button> (sidebar, triggers, icon
   buttons). Low specificity so each component's own hover still wins;
   token-based so it's theme-correct and matches the dropdown-row hover.
   Excludes the send button and DS [data-slot=button] (they own their hover). */
/* B21 s3 (UX-B15S1-NEW-013 = UX-B14S2-NEW-006): :where() makes it what the
   comment above says, specificity 0. The :not() list gave it (0,4,1), so in
   dark it out-ranked every component's own hover (a hovered .ihub-btn read
   #0b0e14 on #2a2c2f, 1.37:1). */
:where(button:hover:not(.chat-send-btn):not([data-slot="button"]):not(.step-row)) {
    background-color: color-mix(in srgb, var(--color-foreground) 6%, transparent);
}
/* Round 13 — dark-mode parity for the bare-button neutral fill. The light
   rule above uses --color-foreground (which already flips to #f0f0f0 in
   dark), but the components' dark hover is #ffffff 8% — keep exact parity
   with .sidebar-btn / dropdown dark hovers. Covers both html.dark-mode
   and body.dark-mode toggles (the app uses both). */
:where(html.dark-mode, body.dark-mode) :where(button:hover:not(.chat-send-btn):not([data-slot="button"]):not(.step-row)) {
    background-color: color-mix(in srgb, var(--color-foreground) 8%, transparent);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
}

.btn-secondary {
    background-color: var(--color-primary-text);
}

.btn-secondary:hover {
    background-color: color-mix(in srgb, var(--color-primary) 53%, var(--color-foreground));
}

.btn-danger {
    background-color: var(--color-danger);
}

.btn-danger:hover {
    background-color: var(--color-danger);
}



/* Flash Messages */
.flash {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash i {
    margin-right: 10px;
    font-size: var(--text-h2);
}

.flash-error {
    background-color: var(--color-danger-tint);
    color: var(--color-danger);
    border-left: 4px solid var(--color-danger);
}

.flash-success {
    background-color: var(--color-surface-2);
    color: var(--color-success);
    border-left: 4px solid var(--color-success);
}

.flash-warning {
    background-color: var(--color-warning-tint);
    color: var(--color-warning);
    border-left: 4px solid var(--color-warning);
}

/* Cards */
.card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-weight: 600;
    color: var(--color-foreground);
    display: flex;
    align-items: center;
}

.card-header h3 i {
    margin-right: 0.5rem;
    color: var(--color-primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--text-sm);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
}

.dashboard-header h1 {
    font-weight: 600;
    color: var(--color-foreground);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-left: 4px solid var(--color-primary);
}

.stat-card i {
    font-size: var(--text-4xl);
    margin-right: 1rem;
    color: var(--color-primary);
}

.stat-card.events {
    border-left-color: var(--color-primary);
}

.stat-card.events i {
    color: var(--color-primary);
}

.stat-card.recordings {
    border-left-color: var(--color-primary);
}

.stat-card.recordings i {
    color: var(--color-primary);
}

.stat-card.views {
    border-left-color: var(--color-success);
}

.stat-card.views i {
    color: var(--color-success);
}

.stat-info h3 {
    font-size: var(--text-3xl);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--color-muted-foreground);
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* The Video Analytics pages' back links (UX-B21 s2: they painted the
   browser's default link blue, 1.96:1 on the dark ground) */
.back-link a {
    color: var(--color-primary-text);
}

/* Events */
.events-header, .cameras-header, .recordings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.d-inline {
    display: inline;
}

.section-description {
    margin-bottom: 2rem;
    color: var(--color-muted-foreground);
    max-width: 800px;
}

.events-filters {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.events-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.event-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border-left: 4px solid var(--color-primary);
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.event-info h3 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--color-muted-foreground);
    font-size: var(--text-sm);
}

.event-date, .event-time, .event-type {
    display: flex;
    align-items: center;
}

.event-date i, .event-time i, .event-type i {
    margin-right: 0.5rem;
}

.event-description {
    margin-bottom: 1.5rem;
    color: var(--color-foreground);
}

.event-recordings {
    margin-bottom: 1.5rem;
}

.recording-count {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-surface-2);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: var(--text-sm);
    color: var(--color-muted-foreground);
}

.recording-count i {
    margin-right: 0.5rem;
    color: var(--color-primary);
}

.event-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

/* Event Details */
.event-header, .camera-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.event-header h2, .camera-header h2 {
    margin-right: 1rem;
}

.event-type-badge {
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: var(--text-sm);
    font-weight: 500;
}

.recordings-section {
    margin-top: 3rem;
}

.recordings-section h3 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.recordings-section h3 i {
    margin-right: 0.75rem;
}

/* Video Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--color-scrim);
}

.modal-content {
    background-color: var(--color-card);
    margin: 5% auto;
    width: 80%;
    max-width: 900px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
}

.modal-header h3 {
    margin: 0;
    font-weight: 600;
}

.close {
    color: var(--color-muted-foreground);
    font-size: var(--text-3xl);
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--color-foreground);
}

.modal-body {
    padding: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.empty-state i {
    font-size: var(--text-4xl);
    color: var(--color-muted-foreground);
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    color: var(--color-muted-foreground);
}

/* Camera Styles */
.cameras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.camera-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    position: relative;
    overflow: hidden;
    border-top: 4px solid var(--color-primary);
}

.camera-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.camera-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.camera-icon i {
    font-size: var(--text-4xl);
    color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    padding: 1rem;
    border-radius: 50%;
}

.status-indicator {
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    bottom: 0;
    right: calc(50% - 25px);
    border: 2px solid var(--color-border);
}

.status-indicator.active {
    background-color: color-mix(in srgb, var(--color-success) 67%, var(--color-background));
}

.status-indicator.inactive {
    background-color: color-mix(in srgb, var(--color-danger) 68%, var(--color-background));
}

.camera-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.camera-info h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.camera-location {
    color: var(--color-muted-foreground);
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-location i {
    margin-right: 0.5rem;
}

.camera-status {
    font-size: var(--text-sm);
    margin-bottom: 0.5rem;
}

.active-text {
    color: var(--color-success);
    font-weight: 500;
}

.inactive-text {
    color: var(--color-danger);
    font-weight: 500;
}

.camera-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--color-surface-2);
    border-radius: var(--border-radius);
    padding: 3rem 1rem;
    text-align: center;
}

.camera-placeholder i {
    font-size: var(--text-4xl);
    color: var(--color-muted-foreground);
    margin-bottom: 1rem;
}

.camera-placeholder p {
    color: var(--color-muted-foreground);
    margin-bottom: 0.5rem;
}

.camera-placeholder small {
    color: var(--color-muted-foreground);
    opacity: 0.7;
}

.camera-feed {
    margin-bottom: 2rem;
}

/* Live Feed Styles */
.live-feed-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background-color: var(--color-foreground);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#camera-feed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    background: linear-gradient(to bottom, var(--color-scrim) 0%, transparent 100%);
}

.feed-info {
    display: flex;
    flex-direction: column;
}

.feed-camera-name {
    color: var(--color-primary-foreground);
    font-weight: 600;
    font-size: var(--text-lg);
    margin-bottom: 0.25rem;
    text-shadow: 1px 1px 2px color-mix(in srgb, var(--color-shadow) 50%, transparent);
}

.feed-timestamp {
    color: color-mix(in srgb, var(--color-card) 80%, transparent);
    font-size: var(--text-sm);
    text-shadow: 1px 1px 2px color-mix(in srgb, var(--color-shadow) 50%, transparent);
}

.feed-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.feed-indicator {
    background-color: var(--color-danger);
    color: var(--color-danger-foreground);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: var(--text-ui);
    font-weight: 600;
    margin-bottom: 0.25rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.feed-quality {
    background-color: color-mix(in srgb, var(--color-card) 20%, transparent);
    color: var(--color-primary-foreground);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: var(--text-xs);
}

.feed-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to top, color-mix(in srgb, var(--color-shadow) 70%, transparent) 0%, transparent 100%);
    z-index: 10;
}

.feed-control-group {
    display: flex;
    gap: 0.5rem;
}

.feed-control-btn {
    background-color: color-mix(in srgb, var(--color-card) 20%, transparent);
    color: var(--color-primary-foreground);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
}

.feed-control-btn:hover {
    background-color: color-mix(in srgb, var(--color-card) 30%, transparent);
}

.feed-connection-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: color-mix(in srgb, var(--color-card) 80%, transparent);
    font-size: var(--text-sm);
}

.feed-status-text {
    color: var(--color-success);
    font-size: var(--text-ui);
    margin-top: 0.25rem;
}

.camera-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--color-muted-foreground);
}

.camera-meta span {
    display: flex;
    align-items: center;
}

.camera-meta i {
    margin-right: 0.5rem;
}

.camera-status {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: var(--text-sm);
    font-weight: 500;
    margin-left: 1rem;
}

.camera-status.active {
    background-color: color-mix(in srgb, var(--color-success) 10%, transparent);
    color: var(--color-success);
}

.camera-status.inactive {
    background-color: color-mix(in srgb, var(--color-danger) 10%, transparent);
    color: var(--color-danger);
}

/* Live View Preview */
.live-view-preview {
    margin-bottom: 2rem;
}

.live-view-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border-left: 4px solid var(--color-primary);
}

.live-view-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.live-view-icon {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.live-view-icon i {
    font-size: var(--text-4xl);
}

.live-view-content {
    flex-grow: 1;
}

.live-view-content h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.live-view-content p {
    color: var(--color-muted-foreground);
    margin-bottom: 1rem;
}

/* Live View Preview */
.live-view-preview {
    margin-bottom: 2rem;
}

/* Insights Preview */

.insights-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border-left: 4px solid color-mix(in srgb, var(--color-primary) 80%, var(--color-background));
}

.insights-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}









/* Dashboard Recordings */
.recordings-preview .recording-thumbnail {
    position: relative;
    height: 150px;
    overflow: hidden;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.recordings-preview .recording-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recordings-preview .card:hover .recording-thumbnail img {
    transform: scale(1.05);
}

.recordings-preview .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: color-mix(in srgb, var(--color-card) 90%, transparent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: var(--text-xl);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.recordings-preview .card:hover .play-icon {
    opacity: 1;
}

.live-view-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border-left: 4px solid var(--color-primary);
}

.live-view-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.live-view-icon {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.live-view-icon i {
    font-size: var(--text-4xl);
}

.live-view-content {
    flex-grow: 1;
}

.live-view-content h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.live-view-content p {
    color: var(--color-muted-foreground);
    margin-bottom: 1rem;
}

/* Utility Classes */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 2rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

/* Recordings */
.recordings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.recordings-filters {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted-foreground);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
}

.video-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.recordings-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.recording-card {
    background-color: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-top: 4px solid var(--color-primary);
}

.recording-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.recording-thumbnail {
    height: 180px;
    background-color: var(--color-surface-2);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    display: block;
}

.recording-card:hover .recording-thumbnail img {
    transform: scale(1.05);
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: color-mix(in srgb, var(--color-card) 90%, transparent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: var(--text-xl);
    opacity: 0;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
}

.recording-card:hover .play-icon {
    opacity: 1;
}

.match-score {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: color-mix(in srgb, var(--color-primary) 85%, transparent);
    color: var(--color-primary-foreground);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: var(--text-ui);
    font-weight: 600;
    box-shadow: 0 2px 5px color-mix(in srgb, var(--color-shadow) 20%, transparent);
}

.recording-info {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.recording-info h3 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: var(--text-lg);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recording-info p {
    color: var(--color-foreground);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.8em;
}

.recording-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--color-muted-foreground);
    font-size: var(--text-sm);
    margin-top: auto;
    margin-bottom: 1rem;
}

.recording-date,
.recording-duration,
.recording-camera {
    display: flex;
    align-items: center;
}

.recording-date i,
.recording-duration i,
.recording-camera i {
    margin-right: 5px;
}

/* Chat */

.chat-header {
    padding: 1.25rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h2 {
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
}

.chat-header h2 i {
    margin-right: 10px;
    color: var(--color-primary);
}





.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 1.25rem;
    max-width: 75%;
    display: flex;
    flex-direction: column;
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--color-shadow) 10%, transparent);
}

.message-user {
    align-self: flex-end;
}

.message-user .message-content {
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
    border-bottom-right-radius: 4px;
}

.message-ai {
    align-self: flex-start;
}

.message-ai .message-content {
    background-color: var(--color-card);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: var(--text-xs);
    color: var(--color-muted-foreground);
    margin-top: 0.5rem;
    align-self: flex-end;
}

.message-user .message-time {
    margin-right: 0.5rem;
}

.message-ai .message-time {
    margin-left: 0.5rem;
}

.message-model {
    font-size: var(--text-2xs);
    color: var(--color-primary);
    margin-top: 0.25rem;
    font-weight: 500;
    align-self: flex-start;
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.chat-input-container {
    padding: 1.25rem;
    background-color: var(--color-card);
    border-top: 1px solid color-mix(in srgb, var(--color-shadow) 5%, transparent);
}


.chat-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--color-surface-2);
    border-radius: 24px;
    padding: 0.5rem 1rem;
}

.media-upload-btn {
    background: transparent;
    color: var(--color-muted-foreground);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border: none;
    padding: 0;
    margin-right: 0.5rem;
}

.media-upload-btn:hover {
    color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 0;
    font-size: var(--text-base);
}

.chat-input:focus {
    outline: none;
    box-shadow: none;
}

.chat-send-btn {
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border: none;
    padding: 0;
}

/* (Round 5 removed the .chat-send-btn:hover block — the canonical send-btn
   styling lives in chat_enhanced.css. The old rule painted --secondary-color
   (blue) + scale(1.05), both wrong for the themed send button.) */

.chat-send-btn i {
    font-size: var(--text-h2);
}

/* Media Preview */
.media-preview {
    background-color: var(--color-surface-2);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}


#image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
    object-fit: contain;
}

#video-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
}

.remove-media-btn {
    background-color: color-mix(in srgb, var(--color-shadow) 10%, transparent);
    color: var(--color-muted-foreground);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease, opacity .3s ease, transform .3s ease;
    border: none;
    padding: 0;
    margin-left: 0.5rem;
}

.remove-media-btn:hover {
    background-color: color-mix(in srgb, var(--color-shadow) 20%, transparent);
    color: var(--color-foreground);
}

/* Message Media */
.message-media {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    max-width: 300px;
}




/* Responsive */
@media (max-width: 768px) {
    /* INT-NEW-168 (UX-B24 s2): the legacy pages' header (partials/_app_header.html)
       wraps its seven links under the wordmark at a phone's width; it widened
       the page to 751 px at 390 (every role, /events/dashboard). */
    .app-nav { flex-wrap: wrap; row-gap: var(--space-2); }
    .app-nav .nav-links { flex-wrap: wrap; row-gap: var(--space-2); column-gap: var(--space-4); padding-inline-start: 0; margin: 0; }
    .app-nav .nav-links li { margin-inline-start: 0; }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .recordings-list {
        grid-template-columns: 1fr;
    }


    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        height: 200px;
    }
}

/* Required field indicator */
.form-group .required {
    color: var(--color-danger);
    margin-left: 3px;
}

/* Resume upload progress bar styles */
.upload-progress {
    margin-top: 10px;
}



} /* end @layer components */
