/* ============================================================
   Login / Auth pages — fully responsive, centered
   ============================================================ */

/* Force hidden always */
[hidden] {
    display: none !important;
}

/* ============================================================
   Desktop layout
   ============================================================ */
.auth-body {
    min-height: 100vh;
    background: var(--hero-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-bottom: 90px;
    position: relative;
    overflow-x: hidden;
}

/* Decorative background blobs — desktop only */
.auth-body::before,
.auth-body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}
.auth-body::before {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}
.auth-body::after {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
}

.auth-main {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    box-shadow: var(--shadow-lg);
    animation: cardIn 0.5s ease-out;
    width: 100%;
    box-sizing: border-box;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-brand {
    text-align: center;
    margin-bottom: 22px;
}

.auth-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--header-gradient);
    color: #fff;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    margin-bottom: 12px;
    overflow: hidden;
}
.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.auth-school-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 2px;
}
.auth-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.auth-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 2px;
}
.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 20px;
}

/* PWA install row */
.auth-pwa-top {
    text-align: center;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

/* Alerts */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 0.86rem;
    margin-bottom: 18px;
}
.auth-alert-icon { flex-shrink: 0; }
.auth-alert-error { background: var(--danger-soft); color: #991b1b; }
.auth-alert-info  { background: var(--info-soft);   color: #075985; }

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.form-field label {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-strong);
}
.form-field input {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.94rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-page);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.form-field input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-link {
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 500;
}
.form-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.form-check input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.btn-block { width: 100%; }

.auth-footer {
    text-align: center;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.auth-pwa {
    text-align: center;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.auth-install-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--success);
    font-weight: 500;
}
.auth-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Password toggle */
.password-wrap {
    position: relative;
    width: 100%;
}
.password-wrap input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-faint);
    font-size: 1rem;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
}
.password-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}
.password-toggle.active {
    color: var(--primary);
}
.password-toggle .toggle-icon {
    display: inline-block;
    line-height: 1;
    user-select: none;
}

/* ============================================================
   MOBILE — vertically + horizontally centered, full-width card
   ============================================================ */
@media (max-width: 640px) {
    /* Hide decorative blobs on mobile — prevents overflow */
    .auth-body::before,
    .auth-body::after {
        display: none;
    }

    .auth-body {
        padding: 16px;
        /* Reserve space for the fixed bottom bar */
        padding-bottom: 100px;
        /* Center both ways */
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }

    .auth-main {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
        padding: 0;
        box-sizing: border-box;
    }

    .auth-card {
        padding: 24px 18px;
        border-radius: 14px;
        width: 100%;
        box-sizing: border-box;
    }

    .auth-brand {
        margin-bottom: 16px;
    }
    .auth-logo {
        width: 50px;
        height: 50px;
        font-size: 20px;
        margin-bottom: 8px;
    }
    .auth-school-name {
        font-size: 1rem;
    }
    .auth-tagline {
        font-size: 0.75rem;
    }
    .auth-title {
        font-size: 1.15rem;
    }
    .auth-subtitle {
        font-size: 0.82rem;
        margin-bottom: 16px;
    }
    .auth-pwa-top {
        margin-bottom: 14px;
    }
    .auth-form {
        gap: 12px;
    }
    .auth-footer {
        margin-top: 14px;
        padding-top: 14px;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .auth-body {
        padding: 8px;
        padding-bottom: 90px;
    }
    .auth-card {
        padding: 20px 14px;
    }
}

/* Landscape mobile — ensure scroll if needed */
@media (max-height: 600px) and (max-width: 900px) {
    .auth-body {
        align-items: flex-start;
        padding-top: 24px;
    }
}