/**
 * cz-switch — accessible toggle wrapping a native <input type="checkbox">.
 * The input is visually hidden; the track + thumb react to :checked /
 * :focus-visible / :disabled.
 *
 * @package ClimaZona
 */

.cz-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
}

.cz-switch__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cz-switch__track {
    width: 100%;
    height: 100%;
    background: var(--input);
    border-radius: var(--border-radius-full);
    position: relative;
    transition: background var(--transition-base);
    cursor: pointer;
}

.cz-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--background);
    border-radius: var(--border-radius-full);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base);
}

.cz-switch__input:checked + .cz-switch__track {
    background: var(--theme-primary, var(--ring));
}

.cz-switch__input:checked + .cz-switch__track .cz-switch__thumb {
    transform: translateX(18px);
}

.cz-switch__input:focus-visible + .cz-switch__track {
    box-shadow: 0 0 0 var(--ring-offset) var(--background),
                0 0 0 calc(var(--ring-offset) + 2px) var(--ring);
}

.cz-switch__input:disabled + .cz-switch__track {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
    .cz-switch__track,
    .cz-switch__thumb {
        transition: none;
    }
}

/* ─── Pref row (label + description + control) ────────────────── */

.cz-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color-light);
}

.cz-pref-row:last-child {
    border-bottom: none;
}

.cz-pref-row__text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.cz-pref-row__label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
}

.cz-pref-row__desc {
    font-size: var(--font-size-xs);
    color: var(--muted-foreground);
    line-height: var(--line-height-snug);
}

.cz-pref-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
}

.cz-pref-status {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--muted-foreground);
    min-height: 1.25em;
    transition: opacity var(--transition-fast);
}

.cz-pref-status[data-state="saving"] {
    color: var(--muted-foreground);
}

.cz-pref-status[data-state="saved"] {
    color: var(--color-success-foreground);
}

.cz-pref-status[data-state="error"] {
    color: var(--color-error-foreground);
}

/* ─── Page header for sub-pages of /mi-cuenta/ ────────────────── */

.cz-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.cz-page-header__title {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
    letter-spacing: var(--tracking-tight);
}

.cz-page-header__description {
    margin: 0 0 var(--spacing-lg) 0;
    color: var(--muted-foreground);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

/* ─── "Coming soon" cards — disabled appearance ──────────────── */

.cz-card--coming-soon {
    opacity: 0.65;
    background: var(--muted);
}

.cz-card--coming-soon .cz-status-badge {
    background: var(--card);
}
