/* ===== CSS Variables ===== */
:root {
    /* Colors - matching 7aiapp theme */
    --primary-blue: #3B82F6;
    --primary-purple: #A855F7;
    --success-green: #22C55E;
    --error-red: #EF4444;
    --warning-yellow: #F59E0B;

    /* Background colors */
    --bg-primary: #0F0F1A;
    --bg-secondary: #1A1A2E;
    --bg-card: rgba(26, 26, 46, 0.95);
    --bg-input: rgba(255, 255, 255, 0.05);

    /* Text colors */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);

    /* Border colors */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(59, 130, 246, 0.5);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow-blue: 0 0 40px rgba(59, 130, 246, 0.3);
    --shadow-glow-purple: 0 0 40px rgba(168, 85, 247, 0.3);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== Grid Pattern Background ===== */
.grid-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
}

/* ===== Gradient Overlays - Soft & Natural ===== */
.gradient-blue {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at -10% -10%,
        rgba(51, 102, 204, 0.18) 0%,
        rgba(61, 122, 214, 0.12) 15%,
        rgba(71, 142, 224, 0.06) 30%,
        rgba(81, 162, 234, 0.02) 45%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 1;
}

.gradient-purple {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 110% 110%,
        rgba(139, 69, 199, 0.18) 0%,
        rgba(149, 79, 209, 0.12) 15%,
        rgba(159, 89, 219, 0.06) 30%,
        rgba(169, 99, 229, 0.02) 45%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 1;
}

/* ===== Container ===== */
.container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    gap: var(--spacing-xl);
}

/* ===== Logo Section ===== */
.logo-section {
    text-align: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    box-shadow: var(--shadow-md), var(--shadow-glow-blue);
    border: 2px solid rgba(59, 130, 246, 0.3);
    transition: transform var(--transition-normal);
}

.app-icon:hover {
    transform: scale(1.05);
}

.logo-text {
    text-align: left;
}

.app-name {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.app-tagline {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-blue);
}

/* ===== Card ===== */
.card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ===== State Containers ===== */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ===== Loading State ===== */
.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-lg);
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ===== Error State ===== */
.error-icon {
    color: var(--error-red);
    margin-bottom: var(--spacing-lg);
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.error-message {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: var(--spacing-xl);
}

/* ===== Success State ===== */
.success-icon {
    color: var(--success-green);
    margin-bottom: var(--spacing-lg);
    animation: successPop 0.5s ease;
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.success-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--success-green);
}

.success-message {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: var(--spacing-xl);
}

.success-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* ===== Form ===== */
.form-header {
    margin-bottom: var(--spacing-xl);
}

.form-icon {
    color: var(--success-green);
    margin-bottom: var(--spacing-md);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.reset-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ===== Input Groups ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.input-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: var(--spacing-md);
    color: var(--text-tertiary);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: var(--spacing-md);
    padding-left: calc(var(--spacing-md) * 2 + 20px);
    padding-right: calc(var(--spacing-md) * 2 + 20px);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary-blue);
}

.toggle-password {
    position: absolute;
    right: var(--spacing-md);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

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

/* ===== Password Strength ===== */
.password-strength {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.strength-bars {
    display: flex;
    gap: 4px;
    flex: 1;
}

.strength-bar {
    height: 4px;
    flex: 1;
    background: var(--border-color);
    border-radius: 2px;
    transition: background var(--transition-fast);
}

.strength-bar.weak { background: var(--error-red); }
.strength-bar.fair { background: var(--warning-yellow); }
.strength-bar.good { background: var(--primary-blue); }
.strength-bar.strong { background: var(--success-green); }

.strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 80px;
    text-align: right;
}

.strength-text.weak { color: var(--error-red); }
.strength-text.fair { color: var(--warning-yellow); }
.strength-text.good { color: var(--primary-blue); }
.strength-text.strong { color: var(--success-green); }

/* ===== Password Match ===== */
.password-match,
.password-mismatch {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
}

.password-match {
    color: var(--success-green);
}

.password-mismatch {
    color: var(--error-red);
}

.match-icon,
.mismatch-icon {
    flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--success-green), #16A34A);
    color: white;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

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

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

.btn-primary.loading {
    pointer-events: none;
}

.btn-primary.loading .btn-icon {
    animation: spin 1s linear infinite;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== Security Note ===== */
.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    color: var(--primary-blue);
    font-size: 0.8125rem;
}

/* ===== Footer ===== */
.footer {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    text-align: center;
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
        justify-content: flex-start;
        padding-top: var(--spacing-2xl);
    }

    .logo-wrapper {
        flex-direction: column;
        text-align: center;
    }

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

    .app-name {
        font-size: 1.875rem;
    }

    .card {
        padding: var(--spacing-lg);
    }

    .form-title {
        font-size: 1.25rem;
    }

    .btn {
        padding: var(--spacing-md);
    }
}

@media (max-width: 360px) {
    .app-icon {
        width: 56px;
        height: 56px;
    }

    .app-name {
        font-size: 1.5rem;
    }
}

/* ===== Dark Mode Preference (already dark by default) ===== */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #F8FAFC;
        --bg-secondary: #F1F5F9;
        --bg-card: rgba(255, 255, 255, 0.95);
        --bg-input: rgba(0, 0, 0, 0.03);
        --text-primary: #1E293B;
        --text-secondary: rgba(30, 41, 59, 0.7);
        --text-tertiary: rgba(30, 41, 59, 0.5);
        --border-color: rgba(0, 0, 0, 0.1);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
        --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    }

    .grid-pattern {
        background-image:
            linear-gradient(rgba(59, 130, 246, 0.06) 1px, transparent 1px),
            linear-gradient(90deg, rgba(59, 130, 246, 0.06) 1px, transparent 1px);
    }

    .gradient-blue {
        background: radial-gradient(
            circle at -10% -10%,
            rgba(51, 102, 204, 0.12) 0%,
            rgba(61, 122, 214, 0.08) 15%,
            rgba(71, 142, 224, 0.04) 30%,
            transparent 50%
        );
    }

    .gradient-purple {
        background: radial-gradient(
            circle at 110% 110%,
            rgba(139, 69, 199, 0.12) 0%,
            rgba(149, 79, 209, 0.08) 15%,
            rgba(159, 89, 219, 0.04) 30%,
            transparent 50%
        );
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
