/*
 * Senna shared component styles
 *
 * Custom utility classes used across all templates.
 * Colours reference careabout-ui design tokens (--dt-*) supplied by the CDN.
 */

[x-cloak] { display: none !important; }

/* ── Card ───────────────────────────────────────────── */

.card {
    background: var(--dt-color-bg-surface);
    border-radius: var(--dt-radius-component-card);
    box-shadow: var(--dt-shadow-component-card);
    border: 1px solid var(--dt-color-border-subtle);
}
.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--dt-color-border-subtle);
}
.card-body {
    padding: 1rem;
}

/* Soft brand-green → page wash for full-page public layouts. The CDN's
   bg-gradient-hero-green only tints the top/bottom edges, so it reads as white
   behind a tall centred card; this fades top-down and stays visible. */
.page-gradient {
    background: linear-gradient(
        to bottom,
        var(--dt-color-bg-surface-muted) 0%,
        var(--dt-color-bg-page) 55%
    );
}

/* ── Buttons ────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: var(--dt-font-size-body-sm);
    font-weight: 500;
    border-radius: var(--dt-radius-component-button);
    transition: all var(--dt-motion-duration-fast) var(--dt-motion-easing-standard);
    cursor: pointer;
    text-decoration: none;
}
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--dt-color-focus-ring);
}
.btn-primary {
    background: var(--dt-color-button-primary-bg);
    color: var(--dt-color-button-primary-text);
    border: 1px solid var(--dt-color-button-primary-border);
}
.btn-primary:hover {
    background: var(--dt-color-button-primary-bg-hover);
}
.btn-secondary {
    background: var(--dt-color-button-secondary-bg);
    color: var(--dt-color-button-secondary-text);
    border: 1px solid var(--dt-color-button-secondary-border);
}
.btn-secondary:hover {
    background: var(--dt-color-button-secondary-bg-hover);
}
.btn-danger {
    background: var(--dt-color-status-error-500);
    color: var(--dt-color-neutral-0);
    border: none;
}
.btn-danger:hover {
    background: #b91c1c;
}
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--dt-font-size-label-sm);
}

/* ── Inputs ─────────────────────────────────────────── */

.input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: var(--dt-font-size-body-sm);
    border: 1px solid var(--dt-color-border-default);
    border-radius: var(--dt-radius-component-input);
}
.input:focus {
    outline: none;
    border-color: var(--dt-color-border-brand);
    box-shadow: 0 0 0 2px var(--dt-color-focus-ring);
}

/* ── Radio & Checkbox ───────────────────────────────── */
/* Server-rendered equivalents of the careabout-ui <RadioButton> / <Checkbox>
   atoms (src/atoms/RadioButton, src/atoms/Checkbox). Token choices mirror the
   React components exactly:
   - radio:    24px, border-2 btn-secondary-border, checked → bg brand-strong
               with an inset white ring (the dot) + border-brand.
   - checkbox: 24px, rounded-xs, border-2 border-default, checked → bg
               brand-strong + white tick (checkbox-checked-icon) + border-brand.
   - focus:    ring-focus, offset 2 (rendered as an outline so it never
               clobbers the radio's inset-shadow dot).
   The :checked / :has(:checked) rules live here (not in the template) so the
   rendered HTML never contains the literal "checked" outside the attribute. */

.radio,
.checkbox {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
    border: 2px solid;
    background: var(--dt-color-button-secondary-bg);
    cursor: pointer;
    transition:
        border-color var(--dt-motion-duration-fast) var(--dt-motion-easing-standard),
        background-color var(--dt-motion-duration-fast) var(--dt-motion-easing-standard);
}
.radio {
    border-radius: var(--dt-radius-corner-full);
    border-color: var(--dt-color-button-secondary-border);
}
.checkbox {
    border-radius: var(--dt-radius-corner-xs);
    border-color: var(--dt-color-border-default);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}
.radio:checked,
.checkbox:checked {
    border-color: var(--dt-color-border-brand);
    background-color: var(--dt-color-text-brand-strong);
}
.radio:checked {
    /* inset white ring → leaves a brand-green centre dot */
    box-shadow: inset 0 0 0 4px var(--dt-color-button-secondary-bg);
}
.checkbox:checked {
    /* White tick — mirrors careabout-ui's .checkbox-checked-icon atom */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4.5 12.5 10 18 19.5 6'/%3E%3C/svg%3E");
}
.radio:focus-visible,
.checkbox:focus-visible {
    outline: 2px solid var(--dt-color-focus-ring);
    outline-offset: 2px;
}
.radio:disabled,
.checkbox:disabled {
    opacity: var(--dt-opacity-disabled);
    cursor: not-allowed;
}

/* Selectable card row wrapping a .radio / .checkbox — the careabout-ui atom's
   <label> shell. Green border, soft-green fill on hover and when selected. */
.field-option {
    border: 2px solid var(--dt-color-button-secondary-border);
    border-radius: var(--dt-radius-component-input);
    background: var(--dt-color-button-secondary-bg);
    cursor: pointer;
    transition:
        border-color var(--dt-motion-duration-fast) var(--dt-motion-easing-standard),
        background-color var(--dt-motion-duration-fast) var(--dt-motion-easing-standard);
}
.field-option:hover {
    background: var(--dt-color-button-secondary-bg-hover);
}
.field-option:has(:checked) {
    border-color: var(--dt-color-border-brand);
    background: var(--dt-color-button-secondary-bg-hover);
}
.field-option:has(:disabled) {
    opacity: var(--dt-opacity-disabled);
    cursor: not-allowed;
}

/* ── Badges ─────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: var(--dt-font-size-label-sm);
    font-weight: 500;
    border-radius: var(--dt-radius-corner-full);
}
.badge-draft     { background: var(--dt-color-neutral-100); color: var(--dt-color-neutral-700); }
.badge-scheduled { background: var(--dt-color-accent-blue-100); color: #1e40af; }
.badge-confirmed { background: var(--dt-color-accent-green-200); color: var(--dt-color-brand-primary); }
.badge-cancelled { background: var(--dt-color-status-error-bg); color: var(--dt-color-status-error-500); }
.badge-completed { background: var(--dt-color-brand-primary-soft); color: var(--dt-color-brand-primary); }
.badge-no_show   { background: var(--dt-color-status-warning-bg); color: var(--dt-color-status-warning-500); }
.badge-blue      { background: var(--dt-color-accent-blue-100); color: #1e40af; }
.badge-green     { background: var(--dt-color-brand-primary-soft); color: var(--dt-color-brand-primary); }
.badge-red       { background: var(--dt-color-status-error-bg); color: var(--dt-color-status-error-500); }
.badge-gray      { background: var(--dt-color-neutral-100); color: var(--dt-color-neutral-700); }
.badge-yellow    { background: var(--dt-color-status-warning-bg); color: var(--dt-color-status-warning-500); }
.badge-orange    { background: var(--dt-color-accent-orange-100); color: var(--dt-color-accent-orange-400); }

/* ── Loading skeleton ───────────────────────────────── */

.skeleton {
    animation: pulse 2s infinite;
    background: var(--dt-color-neutral-100);
    border-radius: var(--dt-radius-corner-xs);
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── HTMX loading indicator ─────────────────────────── */

.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-flex;
}
.htmx-request.htmx-indicator {
    display: inline-flex;
}

/* ── Nav link active state ──────────────────────────── */

.nav-link-active {
    color: var(--dt-color-brand-primary) !important;
    font-weight: 600;
    background-color: var(--dt-color-brand-primary-soft);
    padding: 0.25rem 0.5rem;
    border-radius: var(--dt-radius-component-button);
}
