/*
 * Design system for every Galène page: shadcn preset b51GEGHJ2
 * (style "base-luma", base colour "mist", lime primary, Inter, Lucide).
 *
 * Tokens keep shadcn's names so a future React frontend can share them.
 * Light and dark follow the visitor's system setting.
 *
 * Radius scale (from --radius 0.625rem): sm 6 · md 8 · lg 10 · xl 14 ·
 * 2xl 18 · 3xl 22 · 4xl 26. Spacing on a 4px base.
 */

:root {
    color-scheme: light;

    --background: oklch(1 0 0);
    --foreground: oklch(0.148 0.004 228.8);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.148 0.004 228.8);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.148 0.004 228.8);
    --primary: oklch(0.841 0.238 128.85);
    --primary-foreground: oklch(0.405 0.101 131.063);
    --secondary: oklch(0.967 0.001 286.375);
    --secondary-foreground: oklch(0.21 0.006 285.885);
    --muted: oklch(0.963 0.002 197.1);
    --muted-foreground: oklch(0.56 0.021 213.5);
    --accent: oklch(0.963 0.002 197.1);
    --accent-foreground: oklch(0.218 0.008 223.9);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.925 0.005 214.3);
    --input: oklch(0.925 0.005 214.3);
    --ring: oklch(0.723 0.014 214.4);
    --sidebar: oklch(0.987 0.002 197.1);
    --sidebar-foreground: oklch(0.148 0.004 228.8);
    --sidebar-primary: oklch(0.648 0.2 131.684);
    --sidebar-primary-foreground: oklch(0.986 0.031 120.757);
    --sidebar-accent: oklch(0.963 0.002 197.1);
    --sidebar-accent-foreground: oklch(0.218 0.008 223.9);
    --sidebar-border: oklch(0.925 0.005 214.3);
    --sidebar-ring: oklch(0.723 0.014 214.4);

    /* Ring of the card, dialog and menu surfaces, drawn inset (1px inside
       the edge) so a neighbouring bar can never paint over it. The preset uses
       ring-foreground/5 in light; on white that is 1.1:1 and the top edge
       (which gets no shadow) disappears, so light uses 10% like dark. */
    --surface-ring: color-mix(in oklch, var(--foreground) 10%, transparent);
    /* Video tiles stay dark in both themes: footage is framed in black. */
    --tile: oklch(0.218 0.008 223.9);
    --scrim: rgb(0 0 0 / 0.6);

    --radius: 0.625rem;
    --radius-sm: calc(var(--radius) * 0.6);
    --radius-md: calc(var(--radius) * 0.8);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) * 1.4);
    --radius-2xl: calc(var(--radius) * 1.8);
    --radius-3xl: calc(var(--radius) * 2.2);
    --radius-4xl: calc(var(--radius) * 2.6);

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 18px;
    --text-2xl: 24px;
    --text-3xl: 30px;

    --focus-ring: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --background: oklch(0.148 0.004 228.8);
        --foreground: oklch(0.987 0.002 197.1);
        --card: oklch(0.218 0.008 223.9);
        --card-foreground: oklch(0.987 0.002 197.1);
        --popover: oklch(0.218 0.008 223.9);
        --popover-foreground: oklch(0.987 0.002 197.1);
        --primary: oklch(0.768 0.233 130.85);
        --primary-foreground: oklch(0.405 0.101 131.063);
        --secondary: oklch(0.274 0.006 286.033);
        --secondary-foreground: oklch(0.985 0 0);
        --muted: oklch(0.275 0.011 216.9);
        --muted-foreground: oklch(0.723 0.014 214.4);
        --accent: oklch(0.275 0.011 216.9);
        --accent-foreground: oklch(0.987 0.002 197.1);
        --destructive: oklch(0.704 0.191 22.216);
        --border: oklch(1 0 0 / 10%);
        --input: oklch(1 0 0 / 15%);
        --ring: oklch(0.56 0.021 213.5);
        --sidebar: oklch(0.218 0.008 223.9);
        --sidebar-foreground: oklch(0.987 0.002 197.1);
        --sidebar-primary: oklch(0.768 0.233 130.85);
        --sidebar-primary-foreground: oklch(0.274 0.072 132.109);
        --sidebar-accent: oklch(0.275 0.011 216.9);
        --sidebar-accent-foreground: oklch(0.987 0.002 197.1);
        --sidebar-border: oklch(1 0 0 / 10%);
        --sidebar-ring: oklch(0.56 0.021 213.5);

        --surface-ring: color-mix(in oklch, var(--foreground) 10%, transparent);
    }
}

/* ---------- base ---------- */

*, :after, :before {
    box-sizing: border-box;
    border-color: var(--border);
}

body, html {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    line-height: 1.43;
    color: var(--foreground);
    background-color: var(--background);
    text-align: left;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

textarea, input, select, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 500;
}

h1 {
    font-size: var(--text-base);
}

a {
    color: inherit;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

::selection {
    background: var(--primary);
    color: var(--primary-foreground);
}

.inline {
    display: inline;
}

.signature {
    clear: both;
    padding: 24px;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    text-align: left;
}

.signature a {
    color: var(--muted-foreground);
}

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

/* ---------- Button ---------- */
/* .btn = default size (h-9). Variants: primary (.btn-blue, .btn-success,
   .btn-primary), .btn-secondary / .btn-default, .btn-outline, .btn-ghost,
   .btn-destructive / .btn-cancel. Sizes: .btn-sm, .btn-lg / .btn-large,
   .btn-icon. */

.btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-4xl);
    background-clip: padding-box;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    color: var(--secondary-foreground);
    background-color: var(--secondary);
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.btn:focus-visible {
    border-color: var(--ring);
    box-shadow: var(--focus-ring);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled, .btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: .5;
}

.btn .fas, .btn .far {
    font-size: 16px;
}

.btn-blue, .btn-success, .btn-primary {
    color: var(--primary-foreground);
    background-color: var(--primary);
}

.btn-blue:hover, .btn-success:hover, .btn-primary:hover {
    background-color: color-mix(in oklch, var(--primary) 80%, transparent);
}

/* Secondary is the default look; only it takes this hover. */
.btn:not(.btn-blue, .btn-success, .btn-primary, .btn-outline, .btn-ghost, .btn-cancel, .btn-destructive, .btn-warn):hover {
    background-color: color-mix(in oklch, var(--secondary), var(--foreground) 5%);
}

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

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

.btn-ghost {
    color: var(--foreground);
    background-color: transparent;
}

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

.btn-cancel, .btn-destructive {
    color: var(--destructive);
    background-color: color-mix(in oklch, var(--destructive) 10%, transparent);
}

.btn-cancel:hover, .btn-destructive:hover {
    background-color: color-mix(in oklch, var(--destructive) 20%, transparent);
}

.btn-cancel:focus-visible, .btn-destructive:focus-visible {
    border-color: color-mix(in oklch, var(--destructive) 40%, transparent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 20%, transparent);
}

.btn-warn {
    color: var(--foreground);
    background-color: var(--muted);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    gap: 4px;
}

.btn-lg, .btn-large {
    height: 40px;
    padding: 0 16px;
}

.btn-icon {
    width: 36px;
    padding: 0;
}

.btn-lg.btn-icon, .btn-large.btn-icon {
    width: 40px;
}

.btn-sm.btn-icon {
    width: 32px;
}

@media (prefers-color-scheme: dark) {
    .btn-cancel, .btn-destructive {
        background-color: color-mix(in oklch, var(--destructive) 20%, transparent);
    }

    .btn-cancel:hover, .btn-destructive:hover {
        background-color: color-mix(in oklch, var(--destructive) 30%, transparent);
    }

    .btn-outline {
        background-color: transparent;
    }

    .btn-outline:hover {
        background-color: color-mix(in oklch, var(--input) 30%, transparent);
    }

    .btn-ghost:hover {
        background-color: color-mix(in oklch, var(--muted) 50%, transparent);
    }
}

/* ---------- Input, Textarea, NativeSelect ---------- */

.form-control, .select, .input,
input[type="text"].input, input[type="password"].input {
    display: block;
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 4px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-3xl);
    font-size: var(--text-sm);
    color: var(--foreground);
    background-color: color-mix(in oklch, var(--input) 50%, transparent);
    outline: none;
    transition: color .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.form-control::placeholder, .input::placeholder {
    color: var(--muted-foreground);
    opacity: 1;
}

.form-control:focus-visible, .select:focus-visible, .input:focus-visible,
.form-control:focus, .input:focus {
    border-color: var(--ring);
    box-shadow: var(--focus-ring);
}

.form-control[aria-invalid="true"], .input[aria-invalid="true"] {
    border-color: var(--destructive);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 20%, transparent);
}

.form-control:disabled, .select:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.form-control-inline, .select-inline {
    display: block;
}

.select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 32px;
    cursor: pointer;
    text-overflow: ellipsis;
}

.select option {
    background-color: Canvas;
    color: CanvasText;
}

/* The chevron of a NativeSelect: wrap the select in .select-wrap. */
.select-wrap {
    position: relative;
    display: block;
}

.select-wrap::after {
    content: "\e06d";
    font-family: "lucide";
    position: absolute;
    top: 50%;
    right: 10px;
    font-size: 16px;
    line-height: 1;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
}

/* ---------- Field: a label over its control ---------- */

.field {
    display: grid;
    gap: 8px;
}

/* ---------- Label ---------- */

.label-text, .field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
}

/* ---------- Switch (checkbox with role="switch" or .switch) ---------- */

.switch {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 20px;
    margin: 0;
    border: 2px solid transparent;
    border-radius: 999px;
    background-color: color-mix(in oklch, var(--input) 90%, transparent);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.switch::before {
    content: "";
    display: block;
    width: 24px;
    height: 16px;
    border-radius: 999px;
    background-color: var(--background);
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, background-color .15s ease;
}

.switch:checked {
    border-color: var(--primary);
    background-color: var(--primary);
}

.switch:checked::before {
    transform: translateX(16px);
}

.switch:focus-visible {
    border-color: var(--ring);
    box-shadow: var(--focus-ring);
}

@media (prefers-color-scheme: dark) {
    .switch::before {
        background-color: var(--foreground);
    }

    .switch:checked::before {
        background-color: var(--primary-foreground);
    }
}

/* ---------- Dialog ---------- */

.dialog, dialog.room-dialog {
    width: min(448px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    border: 0;
    border-radius: var(--radius-4xl);
    color: var(--popover-foreground);
    background-color: var(--popover);
    box-shadow: var(--shadow-xl), inset 0 0 0 1px var(--surface-ring);
    overflow: auto;
}

.dialog::backdrop, dialog.room-dialog::backdrop {
    background: rgb(0 0 0 / .3);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.dialog-header {
    display: grid;
    gap: 8px;
}

.dialog-title {
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1.25;
}

.dialog-description {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.optional {
    font-weight: 400;
    color: var(--muted-foreground);
}

/* ---------- Field extras ---------- */

.field-hint {
    margin: 0;
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--muted-foreground);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-error {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--destructive);
}

.form-error[hidden] {
    display: none;
}

/* An input with its action, e.g. a link and Copy. */
.copy-row {
    display: flex;
    gap: 8px;
}

.copy-row .form-control {
    flex: 1;
    text-overflow: ellipsis;
}

/* ---------- Segmented (Tabs list used as a choice) ---------- */

.segmented {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 4px;
    border-radius: 999px;
    background: var(--muted);
}

.segment {
    position: relative;
    flex: 1;
    height: 100%;
    margin: 0;
}

.segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    color: color-mix(in oklch, var(--foreground) 60%, transparent);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

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

.segment input:checked + label {
    color: var(--foreground);
    background: var(--background);
    box-shadow: var(--shadow-sm);
}

.segment input:focus-visible + label {
    border-color: var(--ring);
    box-shadow: var(--focus-ring);
}

@media (prefers-color-scheme: dark) {
    .segment input:checked + label {
        border-color: var(--input);
        background: color-mix(in oklch, var(--input) 30%, transparent);
        box-shadow: none;
    }
}

/* ---------- Card ---------- */

.card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0;
    border-radius: var(--radius-4xl);
    background-color: var(--card);
    color: var(--card-foreground);
    box-shadow: var(--shadow-md), inset 0 0 0 1px var(--surface-ring);
    overflow: hidden;
}

.card-header, .card-content, .card-footer {
    padding: 0 24px;
}

.card-header {
    display: grid;
    gap: 6px;
}

.card-title {
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1.375;
}

.card-description {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

/* ---------- Badge ---------- */

.badge {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 20px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-3xl);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    color: var(--secondary-foreground);
    background-color: var(--secondary);
}

.badge-primary {
    color: var(--primary-foreground);
    background-color: var(--primary);
}

.badge-outline {
    border-color: var(--border);
    color: var(--foreground);
    background-color: transparent;
}

/* ---------- Avatar ---------- */

.avatar {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    color: var(--muted-foreground);
    background-color: var(--muted);
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- Tooltip: data-tooltip on a control ---------- */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 80;
    width: max-content;
    max-width: 240px;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 400;
    line-height: 1.33;
    color: var(--background);
    background-color: var(--foreground);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity .1s ease, transform .1s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: .3s;
}

/* ---------- Empty ---------- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
}

.empty-media {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xl);
    font-size: 20px;
    color: var(--foreground);
    background-color: var(--muted);
}

.empty-title {
    font-size: var(--text-lg);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.empty-description {
    max-width: 360px;
    margin: -8px 0 0;
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--muted-foreground);
}

/* ---------- Table ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    height: 40px;
    padding: 0 8px;
    font-weight: 500;
    text-align: left;
    color: var(--foreground);
}

.table td {
    padding: 8px;
    border-top: 1px solid var(--border);
}

.table td.num, .table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0s !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
}
