/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --purple: #7c3aed;
    --purple-light: #a78bfa;
    --purple-pale: #f3f0ff;
    --purple-dark: #5b21b6;
    --white: #ffffff;
    --bg: #f8f7fc;
    --text: #1e1b2e;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border: #e9e4f8;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(124, 58, 237, .08);
    --shadow-md: 0 8px 32px rgba(124, 58, 237, .14);
    --transition: 0.2s ease;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* ===== LAYOUT ===== */
.login-page {
    display: flex;
    min-height: 100vh;
}

/* ===== LEFT PANEL ===== */
.login-panel {
    width: 42%;
    flex-shrink: 0;
    background: linear-gradient(145deg, #5b21b6 0%, #7c3aed 50%, #a78bfa 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
}

.panel-content {
    position: relative;
    z-index: 2;
    color: #fff;
}

.panel-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .25);
}

.panel-logo .material-icons-round {
    font-size: 30px;
    color: #fff;
}

.panel-title {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 16px;
    font-style: italic;
    font-family: 'DM Serif Display', serif;
}

.panel-title em {
    font-style: italic;
    font-family: 'DM Serif Display', serif;
    color: #ddd6fe;
}

.panel-sub {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, .75);
    line-height: 1.75;
    margin-bottom: 48px;
    max-width: 340px;
}

/* Stats row */
.panel-stats {
    display: flex;
    gap: 36px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, .6);
    font-weight: 500;
}

/* Decorative blobs */
.panel-blobs {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}

.blob-1 {
    width: 320px;
    height: 320px;
    top: -100px;
    right: -80px;
}

.blob-2 {
    width: 200px;
    height: 200px;
    bottom: 60px;
    left: -60px;
}

.blob-3 {
    width: 120px;
    height: 120px;
    bottom: 200px;
    right: 30px;
}

/* ===== RIGHT FORM PANEL ===== */
.login-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--white);
}

.login-form-inner {
    width: 100%;
    max-width: 420px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--purple);
}

.back-link .material-icons-round {
    font-size: 17px;
}

.home-corner-link {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    color: var(--purple);
    border-radius: 50%;
    border: 1px solid var(--border);
    box-shadow: 0 12px 22px rgba(124, 58, 237, .14);
    text-decoration: none;
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.home-corner-link:hover {
    transform: translateY(-1px);
    background: #f8f5ff;
    box-shadow: 0 16px 28px rgba(124, 58, 237, .18);
}

.home-corner-link .material-icons-round {
    font-size: 20px;
}

.form-heading {
    margin-bottom: 28px;
}

.form-heading h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #4F19A5;
}

.form-heading p {
    font-size: 0.88rem;
    color: #6F30D5;
}

/* Links */
.link-purple {
    color: #9958FF;
    text-decoration: none;
    font-weight: 600;
}

.link-purple .material-symbols-outlined {
    font-size: 17px;
}

.link-purple:hover {
    text-decoration: underline;
}

.link-muted {
    color: #9958FF;
    font-size: 0.8rem;
}

.link-muted:hover {
    color: var(--purple);
}

/* ===== ALERTS ===== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert .material-icons-round {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-error .material-icons-round {
    color: #ef4444;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-success .material-icons-round {
    color: #22c55e;
}

/* ===== FORM FIELDS ===== */
.field-group {
    margin-bottom: 20px;
}

.field-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #9E73EA;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 7px;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.label-row label {
    margin-bottom: 0;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 18px;
    color: #C9ABFF;
    pointer-events: none;
    transition: color var(--transition);
}

.input-wrap input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: 1.5px solid #C9ABFF;
    border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background: #ffffff78;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrap input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .1);
}

.input-wrap input:focus~.input-icon,
.input-wrap:focus-within .input-icon {
    color: var(--purple);
}

.input-wrap input::placeholder {
    color: var(--text-light);
}

/* Password toggle */
.toggle-pw {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: background var(--transition);
}

.toggle-pw:hover {
    background: var(--purple-pale);
}

.toggle-pw .material-icons-round {
    font-size: 18px;
    color: #C9ABFF;
}

/* ===== SUBMIT BUTTON ===== */
.btn-login {
    width: 100%;
    padding: 13px 24px;
    border-radius: 50px;
    background: var(--purple);
    color: #fff;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition);
    margin-top: 28px;
    margin-bottom: 0;
}

.btn-login:hover:not(:disabled) {
    background: var(--purple-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, .35);
}

.btn-login:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-arrow {
    font-size: 20px;
}

/* ===== DIVIDER ===== */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0;
    color: var(--text-light);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== REGISTER CTA ===== */
.register-cta {
    text-align: center;
}

.register-cta p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.btn-register {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: 50px;
    border: 2px solid var(--purple);
    background: transparent;
    color: var(--purple);
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-register:hover {
    background: var(--purple);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, .25);
}

.btn-register .material-icons-round {
    font-size: 17px;
}

/* ===== SPINNER ===== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */

/* ── Tablet: ≤ 820px ── */
@media (max-width: 820px) {

    .login-page {
        flex-direction: column;
        min-height: 100vh;
    }

    /* Left panel shrinks to a compact header */
    .login-panel {
        width: 100%;
        padding: 32px 24px 28px;
        min-height: auto;
        justify-content: flex-start;
    }

    .panel-content {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .panel-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 20px;
    }

    .panel-logo .material-icons-round {
        font-size: 24px;
    }

    .panel-title {
        font-size: 1.7rem;
        margin-bottom: 10px;
    }

    .panel-sub {
        font-size: 0.86rem;
        margin-bottom: 24px;
        max-width: 100%;
    }

    .panel-stats {
        gap: 24px;
    }

    .stat-num {
        font-size: 1.3rem;
    }

    .blob-1 {
        width: 180px;
        height: 180px;
        top: -60px;
        right: -40px;
    }

    .blob-2 { display: none; }
    .blob-3 { display: none; }

    /* Form panel becomes a white card below */
    .login-form-wrap {
        flex: 1;
        padding: 36px 24px 40px;
        align-items: flex-start;
    }

    .login-form-inner {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .form-top {
        margin-bottom: 24px;
    }

    .form-heading h2 {
        font-size: 1.4rem;
    }

    .btn-login {
        margin-top: 20px;
    }
}

/* ── Mobile: ≤ 480px ── */
@media (max-width: 480px) {

    /* Panel: even more compact, hide stats entirely */
    .login-panel {
        padding: 24px 20px 20px;
    }

    .panel-title {
        font-size: 1.4rem;
    }

    .panel-sub {
        font-size: 0.82rem;
        margin-bottom: 16px;
    }

    .panel-stats {
        display: none; /* too cramped on very small screens */
    }

    .panel-logo {
        width: 40px;
        height: 40px;
        margin-bottom: 14px;
    }

    /* Form */
    .login-form-wrap {
        padding: 28px 18px 36px;
    }

    .login-form-inner {
        max-width: 100%;
    }

    .form-heading h2 {
        font-size: 1.2rem;
    }

    .form-heading p {
        font-size: 0.82rem;
    }

    /* Full-width register button */
    .btn-register {
        width: 100%;
        justify-content: center;
    }

    /* Stack label row on tiny screens */
    .label-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* forgot_password.php — step indicator */
    .reset-steps {
        gap: 4px !important;
    }

    .reset-step {
        font-size: 0.72rem !important;
        gap: 5px !important;
    }

    .step-connector {
        width: 20px !important;
    }

    /* forgot_password.php — email confirmed pill */
    .email-confirmed {
        font-size: 0.78rem !important;
        padding: 8px 12px !important;
        word-break: break-all;
    }

    /* forgot_password.php — success box */
    .success-box h3 {
        font-size: 1.05rem !important;
    }

    .success-box .big-check {
        width: 52px !important;
        height: 52px !important;
    }

    .success-box .big-check .material-icons-round {
        font-size: 26px !important;
    }
}

/* AUTH PAGE */

.auth-page {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(145deg, #5b21b6 0%, #7c3aed 50%, #a78bfa 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 104px 48px 64px;
}

/* Decorative blobs across the full page */
.auth-blobs {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}

.auth-blob-1 {
    width: 440px;
    height: 440px;
    top: -160px;
    right: -120px;
}

.auth-blob-2 {
    width: 280px;
    height: 280px;
    bottom: -100px;
    left: -80px;
}

.auth-blob-3 {
    width: 150px;
    height: 150px;
    top: 58%;
    left: 40%;
    background: rgba(255, 255, 255, .06);
}

/* Back link floats fixed on the purple background, top-left */
.auth-back-link {
    position: fixed;
    top: 22px;
    left: 24px;
    z-index: 1100;
    color: rgba(255, 255, 255, .85);
}

.auth-back-link:hover {
    color: #fff;
}

/* Auth Content */
.auth-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1140px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 64px;
}

.auth-hero {
    flex: 1;
    min-width: 0;
    color: #fff;
}

.auth-hero .panel-title {
    margin-bottom: 16px;
    text-align: center;
}

.auth-hero .panel-sub {
    margin-bottom: 0;
    text-align: center;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Floating white card */
.auth-card {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    max-width: 462px;
    background: #f1e9ff;
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(30, 15, 70, .35);
    padding: 40px 44px;
}

.auth-card-logo {
    text-align: center;
    margin-top: -25px;
}

.auth-card-logo img {
    width: 150px;
    height: auto;
    display: inline-block;
}

.auth-card .form-heading {
    text-align: center;
    margin-top: -10px;
}

/* ── Tablet: keep the side-by-side layout, just tighten spacing ── */
@media (max-width: 1040px) {
    .auth-content {
        gap: 40px;
    }

    .auth-hero {
        max-width: 380px;
    }

    .auth-card {
        max-width: 420px;
        padding: 44px 40px;
    }
}

/* ── Small tablet / large phone: stack, hero stays left-aligned ── */
@media (max-width: 680px) {
    .auth-page {
        padding: 92px 24px 48px;
        align-items: flex-start;
    }

    .auth-content {
        flex-direction: column;
        align-items: stretch;
        gap: 30px;
    }

    .auth-hero {
        max-width: 100%;
    }

    .auth-hero .panel-title {
        font-size: 1.8rem;
    }

    .auth-hero .panel-sub {
        max-width: 100%;
    }

    .auth-card {
        max-width: 460px;
        margin: 0 auto;
    }

    .auth-blob-2 {
        display: none;
    }
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .auth-page {
        padding: 82px 16px 40px;
    }

    .auth-back-link {
        top: 18px;
        left: 18px;
    }

    .auth-hero .panel-title {
        font-size: 1.5rem;
    }

    .auth-hero .panel-sub {
        font-size: 0.85rem;
    }

    .auth-card {
        margin-top: 30px;
        padding: 36px 24px;
        border-radius: 22px;
    }

    .auth-card-logo img {
        width: 130px !important;
    }
}