/* =============================================================================
   File        : assets/css/auth.css
   Purpose     : Styles for all authentication pages — login, register,
                 forgot password, reset password, verify email.
                 Uses CSS variables so the entire colour scheme can be changed
                 from one place.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables — Edit these to retheme the entire app
   ----------------------------------------------------------------------------- */
:root {
    /* Brand colours */
    --color-primary:        #00C896;   /* Hyvolution green */
    --color-primary-dark:   #00A87E;
    --color-primary-light:  #E6FBF5;
    --color-primary-glow:   rgba(0, 200, 150, 0.18);

    /* Neutrals */
    --color-bg:             #0D1117;   /* Deep dark background */
    --color-surface:        #161B22;   /* Card surface */
    --color-surface-2:      #1C2330;   /* Input fields */
    --color-border:         #2A3340;
    --color-border-focus:   #00C896;

    /* Text */
    --color-text:           #E6EDF3;
    --color-text-muted:     #8B949E;
    --color-text-faint:     #3D444D;

    /* Feedback */
    --color-success:        #00C896;
    --color-success-bg:     #0D2A22;
    --color-error:          #FF6B6B;
    --color-error-bg:       #2A1515;
    --color-warning:        #F0A500;
    --color-warning-bg:     #2A2000;
    --color-info:           #58A6FF;
    --color-info-bg:        #0D1F33;

    /* Layout */
    --radius-sm:            6px;
    --radius-md:            12px;
    --radius-lg:            20px;
    --shadow-card:          0 8px 40px rgba(0,0,0,0.5);
    --shadow-glow:          0 0 30px rgba(0,200,150,0.12);

    /* Typography */
    --font-display:         'Syne', sans-serif;
    --font-body:            'DM Sans', sans-serif;
    --font-mono:            'JetBrains Mono', monospace;
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    overflow-x: hidden;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,200,150,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,200,150,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Glow orb top-left */
body::after {
    content: '';
    position: fixed;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0,200,150,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* -----------------------------------------------------------------------------
   Auth Container — the card wrapper
   ----------------------------------------------------------------------------- */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text);
}

.auth-logo-mark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(0,200,150,0.3);
}

.auth-logo-name {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-logo-name span {
    color: var(--color-primary);
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 40px 36px;
    box-shadow: var(--shadow-card), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

/* Top accent line */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.auth-card-header {
    margin-bottom: 28px;
}

.auth-card-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-card-header p {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Form Elements
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}

.form-label .required {
    color: var(--color-error);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
    -webkit-appearance: none;
}

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

.form-input:focus {
    border-color: var(--color-border-focus);
    background: var(--color-bg);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-input.input-error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(255,107,107,0.12);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-faint);
    pointer-events: none;
    line-height: 1;
}

.input-wrapper .form-input {
    padding-left: 40px;
}

/* Password toggle button */
.btn-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

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

/* Field-level error text */
.field-error {
    font-size: 12px;
    color: var(--color-error);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Password strength indicator */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 3px;
    background: var(--color-border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
    background: var(--color-error);
}

.strength-fill.s1 { width: 25%; background: var(--color-error); }
.strength-fill.s2 { width: 50%; background: var(--color-warning); }
.strength-fill.s3 { width: 75%; background: var(--color-info); }
.strength-fill.s4 { width: 100%; background: var(--color-success); }

.strength-label {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* Form row — two inputs side by side on wider screens */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    text-decoration: none;
    letter-spacing: 0.1px;
    padding: 12px 20px;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--color-primary);
    color: #0D1117;
    width: 100%;
    padding: 13px;
    font-size: 15px;
    box-shadow: 0 4px 20px rgba(0,200,150,0.25);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 4px 24px rgba(0,200,150,0.35);
}

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

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    width: 100%;
    padding: 11px;
}

.btn-ghost:hover {
    background: var(--color-surface-2);
    color: var(--color-text);
}

/* Loading spinner inside button */
.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.3);
    border-top-color: #0D1117;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

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

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

/* -----------------------------------------------------------------------------
   Alert / Flash Messages
   ----------------------------------------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
    animation: alertSlideIn 0.25s ease;
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.alert--success {
    background: var(--color-success-bg);
    border-color: rgba(0,200,150,0.3);
    color: var(--color-success);
}

.alert--error {
    background: var(--color-error-bg);
    border-color: rgba(255,107,107,0.3);
    color: var(--color-error);
}

.alert--warning {
    background: var(--color-warning-bg);
    border-color: rgba(240,165,0,0.3);
    color: var(--color-warning);
}

.alert--info {
    background: var(--color-info-bg);
    border-color: rgba(88,166,255,0.3);
    color: var(--color-info);
}

/* -----------------------------------------------------------------------------
   Auth Card Footer — "Already have an account? Login" etc.
   ----------------------------------------------------------------------------- */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.auth-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--color-text-faint);
    font-size: 12px;
}

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

/* -----------------------------------------------------------------------------
   Success / Confirm State (used in verify-email, payment-success etc.)
   ----------------------------------------------------------------------------- */
.state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
}

.state-icon--success {
    background: var(--color-success-bg);
    border: 2px solid rgba(0,200,150,0.3);
    color: var(--color-success);
    box-shadow: 0 0 30px rgba(0,200,150,0.15);
}

.state-icon--error {
    background: var(--color-error-bg);
    border: 2px solid rgba(255,107,107,0.3);
    color: var(--color-error);
}

.state-icon--pending {
    background: var(--color-warning-bg);
    border: 2px solid rgba(240,165,0,0.3);
    color: var(--color-warning);
}

.state-center {
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Terms checkbox
   ----------------------------------------------------------------------------- */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

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

.checkbox-group label {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.5;
    cursor: pointer;
}

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

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 520px) {
    .auth-card {
        padding: 28px 22px 24px;
    }
    .auth-card-header h1 {
        font-size: 21px;
    }
}

/* -----------------------------------------------------------------------------
   Page fade-in animation
   ----------------------------------------------------------------------------- */
.auth-wrapper {
    animation: pageFadeIn 0.35s ease;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
