/* MathSprint Auth Pages — Shared Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --orange: #FF6B35;
    --orange-light: #FF8F62;
    --teal: #1B998B;
    --teal-light: #2DC5B4;
    --navy: #0D1B2A;
    --cream: #FFF8F0;
    --purple: #7B61FF;
    --yellow: #FFD166;
    --pink: #FF6B8A;
    --gray-100: #F7F5F2;
    --gray-200: #EDEBE8;
    --gray-400: #8E8A85;
    --gray-600: #5A5652;
    --red: #E74C3C;
    --green: #27AE60;
}

body {
    font-family: 'DM Sans', sans-serif;
    color: var(--navy);
    background: var(--cream);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
}

/* NAV */
.auth-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 2rem;
    background: rgba(255, 248, 240, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(13, 27, 42, 0.06);
}

.auth-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--navy);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--orange);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    transform: rotate(-3deg);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--gray-600);
    transition: all 0.15s;
}

.lang-toggle:hover {
    border-color: var(--gray-400);
    background: white;
}

.lang-current {
    font-weight: 500;
}

.lang-dropdown,
.lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 0.4rem;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 200;
}

.lang-dropdown.open,
.lang-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--navy);
    transition: background 0.1s;
    text-align: left;
}

.lang-option:hover {
    background: var(--gray-100);
}

.lang-option.active {
    background: rgba(255, 107, 53, 0.08);
    color: var(--orange);
    font-weight: 500;
}

/* AUTH LAYOUT */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 1.5rem 3rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 40px rgba(13, 27, 42, 0.06);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--orange), var(--pink), var(--purple));
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.auth-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* FORM */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--navy);
    background: white;
    transition: all 0.15s;
    outline: none;
}

.form-input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-link {
    font-size: 0.85rem;
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.form-link:hover {
    color: var(--orange-light);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    width: 100%;
    background: var(--orange);
    color: white;
    padding: 0.85rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--orange-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--navy);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-ghost {
    background: transparent;
    color: var(--orange);
    padding: 0.5rem 1rem;
}

.btn-ghost:hover {
    background: rgba(255, 107, 53, 0.06);
}

/* MESSAGES */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    display: none;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.alert.show {
    display: flex;
}

.alert-error {
    background: rgba(231, 76, 60, 0.08);
    color: var(--red);
    border: 1px solid rgba(231, 76, 60, 0.15);
}

.alert-success {
    background: rgba(39, 174, 96, 0.08);
    color: var(--green);
    border: 1px solid rgba(39, 174, 96, 0.15);
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* FOOTER LINKS */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.88rem;
    color: var(--gray-600);
}

.auth-footer a {
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* LOADING SPINNER */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading .btn-text {
    opacity: 0.7;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PASSWORD VISIBILITY */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    font-size: 1.1rem;
}

.password-toggle:hover {
    color: var(--gray-600);
}

/* DECORATIVE */
.auth-decoration {
    position: fixed;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.deco-1 {
    width: 300px;
    height: 300px;
    background: var(--yellow);
    opacity: 0.06;
    top: -80px;
    right: -80px;
}

.deco-2 {
    width: 200px;
    height: 200px;
    background: var(--teal);
    opacity: 0.05;
    bottom: -40px;
    left: -40px;
}

.deco-3 {
    width: 150px;
    height: 150px;
    background: var(--purple);
    opacity: 0.04;
    bottom: 30%;
    right: -60px;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .auth-nav {
        padding: 0.75rem 1rem;
    }

    .auth-page {
        padding: 5rem 1rem 2rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .auth-header h1 {
        font-size: 1.4rem;
    }
}

/* ============================================================ */
/* APP DASHBOARD STYLES */
/* ============================================================ */

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 6rem 1.5rem 3rem;
    width: 100%;
}

.welcome-header {
    margin-bottom: 2rem;
}

.welcome-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.welcome-header p {
    color: var(--gray-600);
    font-size: 1rem;
}

/* Profile Cards */
.profiles-section {
    margin-bottom: 2rem;
}

.profiles-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.profile-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    border-color: var(--orange);
}

.profile-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.profile-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.profile-grade {
    font-size: 0.82rem;
    color: var(--gray-400);
    margin-bottom: 0.75rem;
}

.profile-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--yellow);
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
}

.profile-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.15s;
}

.profile-card:hover .profile-delete {
    opacity: 1;
}

.profile-delete:hover {
    color: var(--red);
    background: rgba(231, 76, 60, 0.08);
}

/* Add Child Card */
.add-child-card {
    background: var(--gray-100);
    border: 2px dashed var(--gray-200);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.add-child-card:hover {
    border-color: var(--orange);
    background: rgba(255, 107, 53, 0.04);
}

.add-child-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--orange);
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.add-child-card span {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 0.92rem;
}

/* Add Child Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 27, 42, 0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    position: relative;
}

.modal h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.avatar-option {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.avatar-option:hover {
    border-color: var(--orange);
    background: rgba(255, 107, 53, 0.04);
}

.avatar-option.selected {
    border-color: var(--orange);
    background: rgba(255, 107, 53, 0.08);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.15);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
}

/* Coming Soon Banner */
.coming-soon {
    background: white;
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.coming-soon-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.coming-soon h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.coming-soon p {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--navy);
    transition: all 0.15s;
}

.user-btn:hover {
    border-color: var(--gray-400);
}

.user-avatar-small {
    font-size: 1.1rem;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 0.4rem;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 200;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--navy);
    transition: background 0.1s;
    text-align: left;
}

.user-dropdown button:hover {
    background: var(--gray-100);
}

.user-dropdown button.logout {
    color: var(--red);
}

@media (max-width: 600px) {
    .app-container {
        padding: 5rem 1rem 2rem;
    }

    .profiles-grid {
        grid-template-columns: 1fr 1fr;
    }

    .welcome-header h1 {
        font-size: 1.4rem;
    }
}
