/* Ytech Schoolina — sign-in page. Requires tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--yt-bg);
    color: var(--yt-ink);
    font-family: var(--yt-font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--yt-blue-600); text-decoration: none; }
a:hover { color: var(--yt-blue-700); }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--yt-blue-500); outline-offset: 2px; border-radius: 6px; }

.ico {
    width: 20px; height: 20px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Layout ---------- */
.auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    min-height: 100vh;
}

/* ---------- Form side ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    padding: 28px clamp(24px, 5vw, 64px);
    background: var(--yt-surface);
}
.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--yt-ink); }
.brand:hover { color: var(--yt-ink); }
.brand-tile {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 0 0 1px var(--yt-line), 0 4px 12px rgba(6, 32, 51, 0.08);
}
.brand-word {
    display: flex; flex-direction: column;
    font-family: var(--yt-font-display);
    font-weight: 700; font-size: 1.12rem; line-height: 1.1;
    direction: ltr; text-align: start;
}
.brand-word small { font-family: var(--yt-font); font-size: 0.72rem; font-weight: 500; color: var(--yt-muted); letter-spacing: 0.03em; }
.back-home {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--yt-muted);
    font-size: 0.88rem; font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.back-home:hover { background: var(--yt-bg); color: var(--yt-ink); }
.back-home .ico { width: 16px; height: 16px; }
[dir="rtl"] .back-home .ico { transform: scaleX(-1); }

.auth-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}
.auth-card { width: 100%; max-width: 420px; }

.auth-head h1 {
    font-family: var(--yt-font-display);
    font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.auth-head p { margin-top: 8px; color: var(--yt-muted); }

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    margin-top: 22px;
    padding: 12px 14px;
    border-radius: var(--yt-r-md);
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.alert .ico { margin-top: 2px; width: 18px; height: 18px; }
.alert-error { background: var(--yt-bad-bg); border-color: #f6caca; color: #a12f2f; }
.alert-success { background: var(--yt-ok-bg); border-color: #bfe8d6; color: #0b7a50; }
.alert-warning, .alert-info { background: var(--yt-warn-bg); border-color: #f3dfb4; color: #8a5a06; }
.alert-info { background: var(--yt-sky-50); border-color: #cbe9f7; color: var(--yt-blue-700); }

.form { margin-top: 28px; display: grid; gap: 18px; }
.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--yt-ink-2);
}
.control { position: relative; }
.control > .ico {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--yt-faint);
    pointer-events: none;
    transition: color 0.2s;
}
.control input {
    width: 100%;
    height: 52px;
    padding: 0 46px;
    border: 1px solid var(--yt-line-strong);
    border-radius: var(--yt-r-md);
    background: #fbfcfe;
    color: var(--yt-ink);
    font: inherit;
    font-size: 0.98rem;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.control input::placeholder { color: #a3b3c2; }
.control input:hover { border-color: #b7c8d8; }
.control input:focus {
    outline: none;
    border-color: var(--yt-blue-500);
    background: #fff;
    box-shadow: var(--yt-ring);
}
.control:focus-within > .ico { color: var(--yt-blue-600); }
.field.has-error .control input { border-color: var(--yt-bad); }
.field.has-error .control input:focus { box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.15); }
.field-error { margin-top: 6px; color: var(--yt-bad); font-size: 0.85rem; }

.toggle-pass {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: 0; border-radius: 10px;
    background: transparent;
    color: var(--yt-faint);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.toggle-pass:hover { background: var(--yt-bg); color: var(--yt-ink-2); }
.toggle-pass .i-hide { display: none; }
.toggle-pass[aria-pressed="true"] .i-show { display: none; }
.toggle-pass[aria-pressed="true"] .i-hide { display: block; }
.caps {
    display: none;
    margin-top: 6px;
    color: var(--yt-warn);
    font-size: 0.82rem;
}
.caps.is-on { display: block; }

.row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    font-size: 0.92rem;
}
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--yt-ink-2); user-select: none; }
.check input {
    appearance: none; -webkit-appearance: none;
    width: 20px; height: 20px; margin: 0;
    border: 1.5px solid var(--yt-line-strong);
    border-radius: 6px;
    background: #fff center / 12px no-repeat;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.check input:checked {
    border-color: var(--yt-blue-600);
    background-color: var(--yt-blue-600);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.link { font-weight: 600; }

.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: var(--yt-r-md);
    background: var(--yt-grad-btn);
    color: #fff;
    font: inherit; font-size: 1rem; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 22px rgba(18, 134, 204, 0.3);
    transition: transform 0.2s var(--yt-ease), box-shadow 0.2s, filter 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 12px 28px rgba(18, 134, 204, 0.38); }
.btn:active { transform: translateY(0); }
.btn .ico { width: 18px; height: 18px; }
[dir="rtl"] .btn .ico-arrow { transform: scaleX(-1); }
.btn .spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.btn.is-loading { pointer-events: none; filter: saturate(0.85); }
.btn.is-loading .spinner { display: block; }
.btn.is-loading .ico-arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-help {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--yt-line);
    color: var(--yt-muted);
    font-size: 0.88rem;
    display: flex; gap: 10px; align-items: flex-start;
}
.auth-help .ico { width: 18px; height: 18px; color: var(--yt-blue-600); margin-top: 2px; }

/* Demo accounts (APP_SYNC only) */
.demo { margin-top: 24px; }
.demo-title { font-size: 0.85rem; color: var(--yt-muted); margin-bottom: 10px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.demo-grid button {
    width: 100%; padding: 10px; border: 1px solid var(--yt-line); border-radius: 10px;
    background: var(--yt-bg); color: var(--yt-ink-2); font: inherit; font-size: 0.85rem; cursor: pointer;
}
.demo-grid button:hover { border-color: var(--yt-blue-500); color: var(--yt-blue-700); }

.auth-foot {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    color: var(--yt-faint);
    font-size: 0.82rem;
}

/* ---------- Brand side ---------- */
.auth-aside {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(40px, 6vw, 88px);
    background: var(--yt-grad-navy);
    color: #fff;
}
.auth-aside.has-image { background: var(--yt-navy-900) var(--bg-image) center / cover no-repeat; }
.auth-aside.has-image::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(160deg, rgba(6, 32, 51, 0.82), rgba(3, 17, 29, 0.92));
}
.aside-deco {
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(60% 50% at 85% 0%, rgba(26, 160, 220, 0.35), transparent 70%),
        radial-gradient(50% 45% at 0% 100%, rgba(127, 212, 245, 0.16), transparent 70%);
}
.aside-grid {
    position: absolute; inset: 0; z-index: -1;
    background-image:
        linear-gradient(rgba(127, 212, 245, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 212, 245, 0.07) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 25%, transparent 80%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 25%, transparent 80%);
}
.aside-inner { max-width: 520px; }
.aside-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    border: 1px solid rgba(127, 212, 245, 0.3);
    border-radius: 999px;
    background: rgba(127, 212, 245, 0.08);
    color: #c6ebfa;
    font-size: 0.85rem;
}
.aside-chip i { width: 8px; height: 8px; border-radius: 50%; background: #4cd29a; }
.auth-aside h2 {
    margin-top: 22px;
    font-family: var(--yt-font-display);
    font-size: clamp(1.8rem, 1.2rem + 1.8vw, 2.7rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
}
.auth-aside h2 span {
    display: block;
    background: linear-gradient(120deg, #a5e3fa, #4cc0ef 50%, #1aa0dc);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.aside-lead { margin-top: 16px; color: #b4cde0; font-size: 1.04rem; line-height: 1.8; }
.aside-list { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 14px; }
.aside-list li { display: flex; gap: 12px; align-items: flex-start; color: #d4e5f1; }
.aside-list .ico {
    flex: none;
    padding: 7px; width: 34px; height: 34px;
    border-radius: 10px;
    background: rgba(127, 212, 245, 0.12);
    color: var(--yt-sky-300);
}
.aside-list b { display: block; color: #fff; font-weight: 600; }
.aside-list small { color: #9fbbd0; font-size: 0.88rem; }

.aside-card {
    margin-top: 36px;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    max-width: 380px;
    border-radius: var(--yt-r-lg);
    background: #fff;
    color: var(--yt-ink);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.aside-card .badge {
    display: grid; place-items: center;
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--yt-ok-bg); color: var(--yt-ok);
}
.aside-card b { display: block; font-size: 0.92rem; }
.aside-card small { color: var(--yt-muted); font-size: 0.8rem; }
.aside-card .pct { margin-inline-start: auto; font-family: var(--yt-font-display); font-weight: 700; font-size: 1.3rem; color: var(--yt-blue-600); direction: ltr; }

/* Photo variant: copy sits over the darker top of the photo, the attendance card floats at the bottom */
.auth-aside.has-photo {
    justify-content: flex-start;
    background-position: center 62%;
}
.auth-aside.has-photo::before {
    background:
        linear-gradient(180deg, rgba(3, 17, 29, 0.94) 0%, rgba(6, 32, 51, 0.78) 30%, rgba(6, 32, 51, 0.12) 58%, rgba(3, 17, 29, 0.6) 100%),
        linear-gradient(90deg, rgba(6, 32, 51, 0.35), transparent 60%);
}
.auth-aside.has-photo .aside-deco,
.auth-aside.has-photo .aside-grid,
.auth-aside.has-photo .aside-list { display: none; }
.auth-aside.has-photo .aside-card {
    position: absolute;
    inset-inline-start: clamp(24px, 4vw, 56px);
    bottom: clamp(24px, 4vw, 48px);
    margin: 0;
    width: min(340px, calc(100% - 48px));
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* One-time, transform/opacity-only entrance */
.reveal { animation: rise 0.6s var(--yt-ease) both; }
.reveal-2 { animation-delay: 0.08s; }
.reveal-3 { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Toast ---------- */
.toasts {
    position: fixed;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 100;
    display: grid; gap: 10px;
    width: min(380px, calc(100vw - 32px));
}
.toast {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--yt-r-md);
    background: #fff;
    box-shadow: var(--yt-shadow-lg);
    border-inline-start: 4px solid var(--yt-blue-500);
    font-size: 0.92rem;
    animation: rise 0.4s var(--yt-ease) both;
}
.toast.error { border-color: var(--yt-bad); }
.toast.success { border-color: var(--yt-ok); }
.toast.warning { border-color: var(--yt-warn); }
.toast button { margin-inline-start: auto; border: 0; background: none; color: var(--yt-faint); cursor: pointer; font-size: 1.1rem; line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { order: -1; padding: 28px 24px 32px; }
    .auth-aside.has-photo { min-height: 220px; background-position: center 45%; }
    .aside-list, .aside-card, .aside-lead { display: none; }
    .auth-aside h2 { margin-top: 14px; font-size: 1.5rem; }
    .auth-main { padding: 20px 20px 24px; }
    .auth-top .brand { display: none; }
    .auth-form-wrap { padding: 12px 0 28px; align-items: flex-start; }
    .auth-top { justify-content: flex-end; }
}
.aside-brand { display: none; align-items: center; gap: 10px; color: #fff; margin-bottom: 18px; }
@media (max-width: 960px) {
    .aside-brand { display: flex; }
    .aside-chip { display: none; }
    .auth-aside h2 { margin-top: 0; }
}
.aside-brand .brand-tile { width: 38px; height: 38px; box-shadow: none; }
.aside-brand .brand-word small { color: #9fbbd0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
