/* ============================================
   TimeHub Auth Pages — Dark Purple Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500&family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,700;1,300&display=swap');

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a14;
    --bg-card: #12121f;
    --bg-input: #1a1a2e;
    --bg-input-focus: #1f1f35;
    --border-color: #2a2a45;
    --border-focus: #7c3aed;
    --text-primary: #f0f0f5;
    --text-secondary: #9090b0;
    --text-muted: #606080;
    --accent-purple: #7c3aed;
    --accent-purple-hover: #431293;
    --accent-purple-glow: rgba(124, 58, 237, 0.25);
    --accent-purple-soft: rgba(124, 58, 237, 0.12);
    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --success-color: #22c55e;
    --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.auth-body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* --- Background glow effect --- */
body.auth-body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body.auth-body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 40, 200, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* --- Auth Container --- */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 0 20px;
    margin: 40px auto;
}

/* --- Auth Card --- */
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.3), transparent);
}

/* --- Header --- */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-purple);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px var(--accent-purple-glow);
}

.auth-icon svg {
    width: 28px;
    height: 28px;
    color: white;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Form Groups --- */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.input-wrapper {
    position: relative;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-purple-soft);
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--text-secondary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-group input[type="password"] {
    padding-right: 48px;
}

.form-group input[type="text"].password-visible {
    padding-right: 48px;
}

/* --- Checkbox --- */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 24px 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent-purple);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    cursor: pointer;
}

.checkbox-group label a {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.checkbox-group label a:hover {
    color: var(--accent-purple);
}

/* --- Buttons --- */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent-purple);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Syne', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: var(--accent-purple-hover);
    box-shadow: 0 8px 24px var(--accent-purple-glow);
    transform: translateY(-1px);
}

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

/* --- Divider --- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Social Button --- */
.btn-social {
    width: 100%;
    padding: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-social:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
}

.btn-social img,
.btn-social svg {
    width: 20px;
    height: 20px;
}

/* --- Auth Footer Link --- */
.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.auth-switch a:hover {
    color: var(--accent-purple);
}



/* --- Error Messages --- */
.form-errors {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.form-errors ul {
    list-style: none;
}

.form-errors li {
    font-size: 0.85rem;
    color: var(--error-color);
    padding: 2px 0;
}

.field-error {
    font-size: 0.8rem;
    color: var(--error-color);
    margin-top: 6px;
}

.form-group input.is-invalid {
    border-color: var(--error-color);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .auth-container {
        padding: 0 16px;
        margin: 20px auto;
    }

    .auth-card {
        padding: 35px 25px;
        border-radius: var(--radius-lg);
    }

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

    .auth-header p {
        font-size: 0.85rem;
    }

    .auth-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .auth-icon svg {
        width: 24px;
        height: 24px;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 0 12px;
    }

    .auth-card {
        padding: 30px 20px;
        border: 1px solid var(--border-color);
        background: var(--bg-card);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .btn-primary,
    .btn-social {
        padding: 13px;
        font-size: 0.9rem;
    }

    .auth-switch {
        margin-top: 20px;
        font-size: 0.85rem;
    }

    .otp-input {
        font-size: 1.2rem;
        padding: 14px;
    }
}

/* --- Django Messages / Alerts --- */
.auth-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--success-color);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.25);
    color: #eab308;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #3b82f6;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- OTP Input --- */
.otp-input {
    width: 100%;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5em;
    transition: var(--transition);
    outline: none;
}

.otp-input::placeholder {
    color: var(--text-muted);
    letter-spacing: 0.3em;
    font-size: 1rem;
    font-weight: 400;
}

.otp-input:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-purple-soft);
}

/* --- Resend Link --- */
.resend-section {
    text-align: center;
    margin-top: 20px;
}

.resend-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
}

.resend-link:hover {
    color: var(--accent-purple);
}

/* --- Email Display --- */
.email-display {
    text-align: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.email-display strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Secondary Button --- */
.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-secondary:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
    background: var(--accent-purple-soft);
}