*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --coral: #ff6b6b;
    --amber: #ffa94d;
    --lime: #69db7c;
    --cyan: #4dabf7;
    --violet: #9775fa;
    --ink: #0e0f1a;
    --ink2: #161728;
    --ink3: #1e2035;
    --surface: #252743;
    --border: #2e3154;
    --text: #e8eaf6;
    --text2: #8b91c4;
    --text3: #4a4f7a;
}

html,
body {
    min-height: 90vh;
    font-family: 'Instrument Sans', sans-serif;
    background: var(--ink);
    color: var(--text);
    overflow-x: hidden;
}

/* ── ANIMATED BACKGROUND ── */
.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(255, 107, 107, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 80%, rgba(151, 117, 250, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(77, 171, 247, 0.06) 0%, transparent 70%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: drift linear infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--coral);
    top: -100px;
    left: -100px;
    animation-duration: 20s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--violet);
    bottom: -80px;
    right: -80px;
    animation-duration: 25s;
    animation-direction: reverse;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--cyan);
    top: 50%;
    left: 60%;
    animation-duration: 18s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(40px, -30px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 40px) scale(0.95);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* Grid lines */
.grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* Floating particles */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: float-up linear infinite;
    opacity: 0;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-10vh) scale(1.5);
        opacity: 0;
    }
}

/* ── LAYOUT ── */
.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
    .page {
        grid-template-columns: 1fr;
    }

    .left-panel {
        display: none;
    }
}

/* ── LEFT PANEL ── */
.left-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.left-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-right: 1px solid var(--border);
}

.panel-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: var(--coral);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 20px;
    width: fit-content;
    margin-bottom: 40px;
    animation: fade-in 0.8s ease both;
}

.panel-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--coral);
    animation: pulse 2s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

.panel-headline {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: clamp(36px, 4vw, 52px);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 24px;
    animation: fade-up 0.8s ease 0.1s both;
}

.panel-headline .line-coral {
    color: var(--coral);
}

.panel-headline .line-amber {
    color: var(--amber);
}

.panel-headline .line-lime {
    color: var(--lime);
}

.panel-desc {
    font-size: 15px;
    color: var(--text2);
    line-height: 1.7;
    max-width: 380px;
    margin-bottom: 48px;
    animation: fade-up 0.8s ease 0.2s both;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fade-up 0.8s ease 0.3s both;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: var(--text2);
}

.feature-dot {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.dot-coral {
    background: rgba(255, 107, 107, 0.15);
}

.dot-amber {
    background: rgba(255, 169, 77, 0.15);
}

.dot-lime {
    background: rgba(105, 219, 124, 0.15);
}

.dot-cyan {
    background: rgba(77, 171, 247, 0.15);
}

.dot-violet {
    background: rgba(151, 117, 250, 0.15);
}

/* decorative card */
.deco-card {
    position: absolute;
    bottom: 60px;
    right: -30px;
    background: var(--ink3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: fade-up 1s ease 0.5s both;
}

.deco-avatars {
    display: flex;
}

.deco-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--ink3);
    margin-left: -8px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.deco-av:first-child {
    margin-left: 0;
}

.deco-text {
    font-size: 12px;
    color: var(--text2);
}

.deco-text strong {
    display: block;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
}

/* ── RIGHT PANEL (FORM) ── */
.right-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.form-box {
    width: 100%;
    max-width: 420px;
    animation: fade-up 0.9s ease 0.15s both;
}

.locale-switcher-login {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
}

.locale-switcher-login form {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    backdrop-filter: blur(8px);
}

.locale-switcher-login .locale-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.locale-switcher-login .locale-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.locale-switcher-login .locale-btn.active {
    background: #ff6b6b;
    color: #fff;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.logo-mark {
    width: 50px;
    /* height: 40px; */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral), var(--amber));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.35);
    animation: glow 3s ease infinite;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 107, 107, 0.6);
    }
}

.logo-name {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
}

.logo-name span {
    color: var(--coral);
}

/* Form header */
.form-title {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 30px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 6px;
}

.form-sub {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 36px;
}

/* Fields */
.field {
    margin-bottom: 18px;
    position: relative;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text2);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.field:focus-within .field-label {
    color: var(--coral);
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text3);
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

.field:focus-within .input-icon {
    color: var(--coral);
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    background: var(--ink3);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 14px 13px 44px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

input:focus {
    border-color: var(--coral);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

input::placeholder {
    color: var(--text3);
}

/* Password toggle */
.pw-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    transition: color 0.2s;
    z-index: 1;
}

.pw-toggle:hover {
    color: var(--text2);
}

/* Teacher code field */
.teacher-code-wrap {
    overflow: hidden;
    /* max-height: 0; */
    max-height: 120px;
    opacity: 1;
    transform: translateY(0);
    /* transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.35s ease,
        transform 0.35s ease; */
}

/* .teacher-code-wrap.open {
    max-height: 120px;
    opacity: 1;
    transform: translateY(0);
} */

/* Toggle checkbox */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    width: fit-content;
    user-select: none;
}

.toggle-track {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--border);
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#has_code:checked+.toggle-row .toggle-track {
    background: var(--coral);
}

#has_code:checked+.toggle-row .toggle-track::after {
    transform: translateX(18px);
}

#has_code {
    display: none;
}

.toggle-label {
    font-size: 13px;
    color: var(--text2);
    transition: color 0.2s;
}

.toggle-row:hover .toggle-label {
    color: var(--text);
}

/* Code badge */
.code-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--coral);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 6px;
}

/* Submit button */
.btn-submit {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--coral) 0%, var(--amber) 100%);
    color: #fff;
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 24px rgba(255, 107, 107, 0.35);
    margin-top: 8px;
    letter-spacing: 0.02em;
}

.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.5);
}

.btn-submit:hover::before {
    opacity: 1;
}

.btn-submit:active {
    transform: translateY(0);
}

/* Ripple */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text3);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Role chips */
.role-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    flex: 1;
    min-width: 80px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text2);
    font-family: 'Instrument Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chip-icon {
    font-size: 18px;
}

.chip:hover {
    border-color: var(--text3);
    color: var(--text);
}

.chip.selected {
    border-color: var(--coral);
    background: rgba(255, 107, 107, 0.1);
    color: var(--coral);
}

/* Bottom link */
.form-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 13px;
    color: var(--text3);
}

.form-footer a {
    color: var(--coral);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Error state */
input.error {
    border-color: var(--coral);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.error-msg {
    font-size: 12px;
    color: var(--coral);
    margin-top: 6px;
    display: none;
}

/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.btn-submit.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-submit.loading .btn-text {
    opacity: 0;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Remember row */
.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text2);
    cursor: pointer;
}

.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--coral);
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
}

.forgot-link {
    font-size: 13px;
    color: var(--coral);
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* ── FORM ROW (2 fields side by side) ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ── SELECT (matches input style, with chevron) ── */
select {
    width: 100%;
    background-color: var(--ink3);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 38px 13px 44px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 14px;
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b91c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
}

select:focus {
    border-color: var(--coral);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.field:focus-within select {
    border-color: var(--coral);
}

select option {
    background: var(--ink3);
    color: var(--text);
    padding: 10px;
}

select:invalid,
select option[disabled] {
    color: var(--text3);
}

/* ── REGISTER PAGE (wider right panel + form) ── */
body.register-page .page {
    grid-template-columns: 0.8fr 1.2fr;
}

body.register-page .form-box {
    max-width: 620px;
}

@media (max-width: 900px) {
    body.register-page .page {
        grid-template-columns: 1fr;
    }
}