/**
 * StudentWala customizations on top of Metronic styles.css (frozen — no Metronic theme updates).
 * Loaded immediately after styles.css via partials/metronic-styles.blade.php.
 * Requires --pt-primary from resources/css/app.css (Vite, loaded in the same head block).
 */
:root {
    --primary:             var(--pt-primary);
    --primary-foreground:  #ffffff;
    --ring:                color-mix(in oklab, var(--pt-primary) 45%, transparent);
    /* Demo fable page background — warm stone-50, not pure white */
    --background:          var(--sw-bg, #fafaf9);
}

html.dark {
    --primary: var(--pt-primary);
}

/* Tailwind default ring is blue-500 — keep every ring on theme primary */
*,
*::before,
*::after {
    --tw-ring-color: color-mix(in oklab, var(--pt-primary) 40%, transparent);
}

html {
    accent-color: var(--pt-primary);
}

/* Themed operator dropdown — Windows native <select> list is always blue */
.pt-themed-select {
    position: relative;
    width: 100%;
}
.pt-themed-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: calc(var(--spacing, 0.25rem) * 7);
    padding: 0 0.625rem;
    border: 1px solid var(--input, #e4e4e7);
    border-radius: 0.375rem;
    background: var(--background, #fff);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: var(--foreground, #111827);
    text-align: left;
    cursor: pointer;
}
.pt-themed-select__trigger:hover {
    border-color: color-mix(in oklab, var(--pt-primary) 35%, var(--input, #e4e4e7));
}
.pt-themed-select__trigger:focus-visible,
.pt-themed-select [aria-expanded="true"] .pt-themed-select__trigger,
.pt-themed-select:has([aria-expanded="true"]) .pt-themed-select__trigger {
    outline: none;
    border-color: var(--pt-primary);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--pt-primary) 28%, transparent);
}
.pt-themed-select__trigger.is-invalid {
    border-color: #f87171;
}
.pt-themed-select__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pt-themed-select__label.is-placeholder {
    color: var(--muted-foreground, #71717a);
}
.pt-themed-select__chev {
    flex-shrink: 0;
    font-size: 0.625rem;
    color: var(--muted-foreground, #71717a);
    transition: transform 0.15s ease;
}
.pt-themed-select:has([aria-expanded="true"]) .pt-themed-select__chev {
    transform: rotate(180deg);
}
.pt-themed-select__menu {
    position: absolute;
    z-index: 70;
    top: calc(100% + 0.25rem);
    left: 0;
    right: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: 16rem;
    margin: 0;
    padding: 0.25rem 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--pt-border-header, #e7e5e4);
    border-radius: 0.375rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
html.dark .pt-themed-select__menu {
    background: var(--background, #0a1410);
    border-color: var(--border, #1f3d32);
}
.pt-themed-select__option {
    display: block;
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: 0;
    background: transparent;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: var(--foreground, #111827);
    text-align: left;
    cursor: pointer;
}
.pt-themed-select__option:hover {
    background: var(--pt-primary-light, #ccfbf1);
    color: var(--pt-label-color, #134e4a);
}
.pt-themed-select__option.is-active {
    background: var(--pt-primary);
    color: #fff;
}
.pt-themed-select__option.is-active:hover {
    background: var(--pt-primary);
    color: #fff;
}
html.dark .pt-themed-select__option:hover {
    background: color-mix(in oklab, var(--pt-primary) 22%, var(--background));
    color: var(--foreground);
}

.pt-themed-select__trigger--flush {
    border: 0;
    background: var(--background, #fff);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Native <select> fallback — OS/Chrome highlight is blue; use Fresh Teal where the browser allows */
select,
select.kt-select {
    accent-color: var(--pt-primary);
}

select.kt-select:focus,
select.kt-select:focus-visible {
    outline: none;
    border-color: var(--pt-primary);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--pt-primary) 28%, transparent);
}

select.kt-select option {
    background-color: var(--background, #fff);
    color: var(--foreground, #111827);
}

select.kt-select option:checked,
select.kt-select option:checked:hover {
    background-color: var(--pt-primary);
    background-image: linear-gradient(0deg, var(--pt-primary) 0%, var(--pt-primary) 100%);
    color: var(--primary-foreground, #fff);
}

select.kt-select option:hover {
    background-color: var(--pt-primary-light, #ccfbf1);
    color: var(--pt-label-color, #134e4a);
}

html.dark select.kt-select option:hover {
    background-color: color-mix(in oklab, var(--pt-primary) 22%, var(--background));
    color: var(--foreground);
}

/* Chrome 135+ / Edge — style the open picker (Windows native list cannot be themed) */
@supports (appearance: base-select) {
    select.kt-select {
        appearance: base-select;
        background-image: none;
    }

    select.kt-select::picker-icon {
        color: #9f9fa9;
        margin-inline-start: auto;
    }

    select.kt-select:open::picker-icon {
        rotate: 180deg;
    }

    select.kt-select::picker(select) {
        appearance: base-select;
        margin-top: 0.125rem;
        padding: 0.25rem 0;
        overflow: hidden;
        border: 1px solid var(--pt-border-header, #e7e5e4);
        border-radius: 0.375rem;
        background: var(--background, #fff);
        color: var(--foreground, #111827);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    }

    select.kt-select option {
        padding: 0.4rem 0.75rem;
        background-color: transparent;
        color: inherit;
    }

    select.kt-select option:hover,
    select.kt-select option:focus {
        background-color: var(--pt-primary-light, #ccfbf1);
        background-image: none;
        color: var(--pt-label-color, #134e4a);
    }

    select.kt-select option:checked,
    select.kt-select option:checked:hover {
        background-color: var(--pt-primary);
        background-image: none;
        color: var(--primary-foreground, #fff);
    }
}

/* WhatsApp / parent communication accent — green reserved for messaging only */
:root {
    --sw-whatsapp:           #16a34a;
    --sw-whatsapp-light:     #dcfce7;
    --sw-sidebar-brand-ring: rgba(255, 255, 255, 0.15);
}

/* Sidebar — custom menu icons */
#sidebar.kt-sidebar .pt-sidebar-menu-icon {
    display: block;
}

/* Today dashboard quick actions */
.sw-today-stat-icon {
    background-color: color-mix(in oklab, var(--pt-primary) 12%, white) !important;
    color: var(--pt-label-color) !important;
}

.sw-today-stat-icon--whatsapp {
    background-color: var(--sw-whatsapp-light) !important;
    color: var(--sw-whatsapp) !important;
}
