/*
 * Waskita Design System v1
 * Shared visual foundation for Portal, CBT, and HEBAT.
 * Functional page rules stay in each application's app.css.
 */
@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --wds-font: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --wds-ink: #14213d;
    --wds-muted: #60708a;
    --wds-canvas: #f4f7fb;
    --wds-surface: #ffffff;
    --wds-surface-soft: #f8faff;
    --wds-line: #e3e9f2;
    --wds-line-strong: #d3dcea;
    --wds-brand: #1e3a8a;
    --wds-brand-strong: #172e70;
    --wds-brand-soft: #edf3ff;
    --wds-accent: #f4b51f;
    --wds-focus: rgba(37, 99, 235, 0.22);
    --wds-radius-sm: 0.75rem;
    --wds-radius: 1rem;
    --wds-radius-lg: 1.25rem;
    --wds-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --wds-shadow-sm: 0 5px 18px rgba(30, 58, 138, 0.06);
    --wds-shadow-md: 0 16px 40px rgba(30, 58, 138, 0.09);
}

body[data-app="elearning"] {
    --wds-brand: #1d4ed8;
    --wds-brand-strong: #183b91;
    --wds-brand-soft: #edf4ff;
}

body[data-app="hebat"] {
    --wds-brand: #0f766e;
    --wds-brand-strong: #115e59;
    --wds-brand-soft: #ecfdf8;
    --wds-focus: rgba(13, 148, 136, 0.22);
}

html {
    font-family: var(--wds-font);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body[data-app-shell],
body[data-app-shell].font-sans,
body[data-app-shell] .font-sans,
body[data-app-shell] button,
body[data-app-shell] input,
body[data-app-shell] select,
body[data-app-shell] textarea,
.swal2-container {
    font-family: var(--wds-font) !important;
}

body[data-app-shell] {
    color: var(--wds-ink);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

html:not([data-theme="dark"]):not(.dark) body[data-app-shell][data-app-context="dashboard"] {
    background:
        radial-gradient(circle at 78% -10%, rgba(59, 130, 246, 0.08), transparent 32rem),
        var(--wds-canvas) !important;
}

body[data-app-shell] h1,
body[data-app-shell] h2,
body[data-app-shell] h3,
body[data-app-shell] h4 {
    color: inherit;
    font-family: var(--wds-font);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

body[data-app-shell] h1 {
    font-weight: 800;
}

body[data-app-shell] h2,
body[data-app-shell] h3,
body[data-app-shell] h4 {
    font-weight: 700;
}

body[data-app-shell] p,
body[data-app-shell] li,
body[data-app-shell] td,
body[data-app-shell] label {
    text-wrap: pretty;
}

body[data-app-shell] a,
body[data-app-shell] button,
body[data-app-shell] input,
body[data-app-shell] select,
body[data-app-shell] textarea,
body[data-app-shell] summary {
    transition-duration: 160ms;
    transition-property: color, background-color, border-color, box-shadow, opacity, transform;
    transition-timing-function: ease;
}

body[data-app-shell] button:not(:disabled):active,
body[data-app-shell] a[class*="bg-"]:active {
    transform: translateY(1px);
}

body[data-app-shell] :focus-visible {
    outline: 3px solid var(--wds-focus);
    outline-offset: 2px;
}

body[data-app-shell] ::selection {
    background: rgba(37, 99, 235, 0.2);
    color: #0f245d;
}

/* Application shell */
body[data-app-shell] [data-app-sidebar] {
    border-color: var(--wds-line) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(249, 251, 255, 0.98)),
        var(--wds-surface) !important;
    box-shadow: 12px 0 36px rgba(30, 58, 138, 0.06) !important;
}

body[data-app-shell] [data-app-sidebar] nav a,
body[data-app-shell] [data-app-sidebar] nav button {
    min-height: 2.75rem;
    border: 1px solid transparent;
    border-radius: var(--wds-radius-sm) !important;
}

body[data-app-shell] [data-app-sidebar] nav a.bg-blue-50,
body[data-app-shell] [data-app-sidebar] nav a[class*="text-waskita-blue"].bg-blue-50,
body[data-app-shell] [data-app-sidebar] nav a[class*="text-blue-900"].bg-blue-50 {
    border-color: rgba(37, 99, 235, 0.1);
    background: linear-gradient(135deg, var(--wds-brand-soft), #ffffff) !important;
    box-shadow: inset 3px 0 0 var(--wds-brand), var(--wds-shadow-xs) !important;
}

body[data-app="hebat"] [data-app-sidebar] nav a.bg-blue-50 {
    border-color: rgba(13, 148, 136, 0.12);
}

body[data-app-shell] [data-app-sidebar] nav a:not(.bg-blue-50):hover,
body[data-app-shell] [data-app-sidebar] nav button:not(:disabled):hover {
    border-color: var(--wds-line);
    background-color: var(--wds-surface-soft) !important;
}

body[data-app-shell] [data-app-topbar] {
    min-height: 4.5rem;
    height: 4.5rem;
    border-color: rgba(211, 220, 234, 0.85) !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 1px 0 rgba(30, 58, 138, 0.03);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
}

body[data-app-shell] [data-app-content] {
    background: transparent;
    scroll-behavior: smooth;
}

body[data-app-shell] [data-app-content] > footer,
body[data-app-shell] [data-app-content] > .wds-footer {
    color: #91a0b6 !important;
}

/* Cards and content surfaces */
html:not([data-theme="dark"]):not(.dark) body[data-app-shell][data-app-context="dashboard"] main section.bg-white,
html:not([data-theme="dark"]):not(.dark) body[data-app-shell][data-app-context="dashboard"] main article.bg-white,
html:not([data-theme="dark"]):not(.dark) body[data-app-shell][data-app-context="dashboard"] main div.bg-white.rounded-2xl.border,
html:not([data-theme="dark"]):not(.dark) body[data-app-shell][data-app-context="dashboard"] main div.bg-white.rounded-3xl.border {
    border-color: var(--wds-line) !important;
    box-shadow: var(--wds-shadow-sm);
}

body[data-app-shell] .card-hover {
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

body[data-app-shell] .card-hover:hover {
    border-color: var(--wds-line-strong) !important;
    box-shadow: var(--wds-shadow-md) !important;
    transform: translateY(-2px);
}

/* Forms */
body[data-app-shell] input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]),
body[data-app-shell] select,
body[data-app-shell] textarea {
    border-color: var(--wds-line-strong);
    border-radius: 0.875rem !important;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
}

body[data-app-shell] input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):hover,
body[data-app-shell] select:hover,
body[data-app-shell] textarea:hover {
    border-color: #b9c6d8;
}

body[data-app-shell] input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):focus,
body[data-app-shell] select:focus,
body[data-app-shell] textarea:focus {
    border-color: var(--wds-brand) !important;
    box-shadow: 0 0 0 4px var(--wds-focus) !important;
    outline: none !important;
}

body[data-app-shell] input::placeholder,
body[data-app-shell] textarea::placeholder {
    color: #9aa8ba;
}

body[data-app-shell] input:disabled,
body[data-app-shell] select:disabled,
body[data-app-shell] textarea:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

body[data-app-shell] input[type="checkbox"],
body[data-app-shell] input[type="radio"] {
    accent-color: var(--wds-brand);
}

/* Data tables */
body[data-app-shell] table {
    border-color: var(--wds-line);
    font-variant-numeric: tabular-nums;
}

html:not([data-theme="dark"]):not(.dark) body[data-app-shell] thead {
    background-color: #f7f9fd;
}

body[data-app-shell] th {
    color: #65758c;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

body[data-app-shell] td,
body[data-app-shell] th {
    border-color: var(--wds-line) !important;
}

html:not([data-theme="dark"]):not(.dark) body[data-app-shell] tbody tr:hover {
    background-color: #fafcff;
}

/* Dialogs and SweetAlert */
body[data-app-shell] dialog,
body[data-app-shell] [role="dialog"],
.swal2-popup {
    border: 1px solid var(--wds-line) !important;
    border-radius: var(--wds-radius-lg) !important;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.2) !important;
}

body[data-app-shell] dialog::backdrop {
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(5px);
}

.swal2-title {
    color: var(--wds-ink) !important;
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em;
}

.swal2-html-container {
    color: var(--wds-muted) !important;
    line-height: 1.65 !important;
}

.swal2-actions .swal2-styled {
    min-height: 2.75rem;
    border-radius: 0.8rem !important;
    padding-inline: 1.1rem !important;
    font-weight: 700 !important;
}

/* Dark mode remains optional; light is the first-load default. */
html[data-theme="dark"] body[data-app-shell],
html.dark body[data-app-shell] {
    --wds-ink: #f8fafc;
    --wds-muted: #c1ccdb;
    --wds-canvas: #0b1220;
    --wds-surface: #111b2e;
    --wds-surface-soft: #172238;
    --wds-line: #27354a;
    --wds-line-strong: #34445d;
    --wds-brand-soft: rgba(59, 130, 246, 0.16);
}

html[data-theme="dark"] body[data-app-shell] [data-app-sidebar],
html.dark body[data-app-shell] [data-app-sidebar] {
    background: linear-gradient(180deg, #101a2c, #0d1627) !important;
}

html[data-theme="dark"] body[data-app-shell] [data-app-topbar],
html.dark body[data-app-shell] [data-app-topbar] {
    background-color: rgba(15, 23, 42, 0.9) !important;
}

html[data-theme="dark"] body[data-app-shell] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] body[data-app-shell] select,
html[data-theme="dark"] body[data-app-shell] textarea,
html.dark body[data-app-shell] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html.dark body[data-app-shell] select,
html.dark body[data-app-shell] textarea {
    border-color: var(--wds-line-strong);
    background-color: #111b2e;
    color: #f8fafc;
}

@media (max-width: 639px) {
    body[data-app-shell] [data-app-sidebar] {
        width: min(18rem, calc(100vw - 1.25rem)) !important;
    }

    body[data-app-shell] [data-app-topbar] {
        min-height: 4rem;
        height: 4rem;
    }

    body[data-app-shell] [data-app-content] {
        padding: 1rem !important;
    }

    body[data-app-shell] h1 {
        line-height: 1.18;
    }
}

@media (prefers-reduced-motion: reduce) {
    body[data-app-shell] *,
    body[data-app-shell] *::before,
    body[data-app-shell] *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    body[data-app-shell] {
        background: #ffffff !important;
        color: #000000 !important;
    }
}
