/* ============================================
   1. RESET & VARIABLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Squiz Theme Colors */
    --primary: #6F4096;
    --primary-dark: #2E1344;
    --on-primary: #FFFFFF;
    --on-primary-light: #DBC2EF;
    --secondary: #FFFFFF;
    --on-secondary: #281934;
    --positive: #3C925D;
    --on-positive: #FFFFFF;
    --negative: #B92828;
    --on-negative: #FFFFFF;
    --background: #F9F1DB;
    --background-variant: #FCF8EE;
    --on-background: #281934;
    --on-background-light: #776C81;
    --surface: #FFFFFF;
    --on-surface: #281934;
    --on-surface-light: #464646;
    --outline: #765E87;
    --outline-light: #B4ACB9;
    --outline-dark: #28202E;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-headline: 32px;
    --font-size-title: 22px;
    --font-size-body: 16px;
    --font-size-label: 12px;
    --line-height-body: 24px;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    
    /* Border radius */
    --radius: 8px;
    --radius-lg: 12px;
}

html {
    height: 100%;
}

/* ============================================
   2. LAYOUT (Body, Main Content, Footer)
   ============================================ */

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--on-background);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    line-height: 1.5;
    margin: 0;
    overflow-x: hidden;
}

/* Main content container - takes available space between header and footer */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

/* Footer - always at bottom */
.footer {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
    border-top: 1px solid var(--outline-light);
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.footer-link {
    color: var(--on-background-light);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary);
}

.footer-separator {
    color: var(--on-background-light);
    font-size: 14px;
}

.footer-language {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-left: auto;
}

.footer-language-label {
    font-size: 12px;
    color: var(--on-background-light);
    font-weight: 500;
}

.footer-language-select {
    padding: 6px 12px;
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--on-background);
    background-color: var(--surface);
    border: 1px solid var(--outline-light);
    border-radius: var(--radius);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 120px;
}

.footer-language-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 64, 150, 0.1);
}

.footer-language-select:hover {
    border-color: var(--outline);
}

/* ============================================
   3. PAGE COMPONENTS
   ============================================ */

/* Page wrapper - centers content vertically (for reset password page) */
.page-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: var(--spacing-md);
}

.container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(40, 25, 52, 0.1);
    position: relative;
}

/* Full-page content (for Terms and Privacy pages) */
.page-content {
    flex: 1;
    width: 100%;
    padding: var(--spacing-lg) var(--spacing-md);
}

.content-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--on-background-light);
    text-decoration: none;
    font-size: var(--font-size-body);
    margin-bottom: var(--spacing-md);
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.back-link::before {
    content: '←';
    font-size: 18px;
}

.page-title {
    font-size: var(--font-size-headline);
    font-weight: 500;
    line-height: 1.2;
    color: var(--on-background);
    margin-bottom: var(--spacing-md);
    margin-top: 0;
}

.page-body {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    color: var(--on-background);
}

.page-body p {
    margin-bottom: var(--spacing-sm);
}

/* ============================================
   4. UI COMPONENTS
   ============================================ */

/* Typography */
.headline {
    font-size: var(--font-size-headline);
    font-weight: 500;
    line-height: 1.2;
    color: var(--on-background);
    margin-bottom: var(--spacing-xs);
}

.body-text {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    color: var(--on-background-light);
    margin-bottom: var(--spacing-lg);
    max-width: 100%;
}

/* Icons */
.success-icon,
.error-icon {
    margin-bottom: var(--spacing-sm);
}

.success-icon svg,
.error-icon svg {
    display: block;
}

/* Form */
#reset-form {
    width: 100%;
    margin-top: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-sm);
    text-align: left;
}

.label {
    display: block;
    font-size: var(--font-size-label);
    font-weight: 500;
    color: var(--on-background);
    margin-bottom: var(--spacing-xs);
}

.input-wrapper {
    position: relative;
}

.input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 48px;
    font-size: var(--font-size-body);
    font-family: var(--font-family);
    color: var(--on-background);
    background-color: var(--surface);
    border: 1px solid var(--outline-light);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 64, 150, 0.1);
}

.input.error {
    border-color: var(--negative);
}

.input::placeholder {
    color: var(--outline-light);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--on-background-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--on-background);
}

.toggle-password svg {
    display: block;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 12px 24px;
    font-size: var(--font-size-body);
    font-weight: 500;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn-primary:disabled {
    background-color: var(--outline-light);
    color: var(--on-surface-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--on-secondary);
    border: 1px solid var(--outline);
}

.btn-secondary:hover {
    background-color: var(--background-variant);
}

/* Loading state */
#submit-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#submit-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--on-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   5. STATES
   ============================================ */

.state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.state.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* Error message */
.error-message {
    color: var(--negative);
    font-size: var(--font-size-body);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-xs);
    background-color: rgba(185, 40, 40, 0.1);
    border-radius: var(--radius);
    text-align: left;
}

/* Visually hidden (for accessibility) */
.visually-hidden {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   6. RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    .card {
        padding: var(--spacing-sm);
    }
    
    .headline {
        font-size: 28px;
    }
    
    .body-text {
        font-size: 15px;
    }
    
    .footer {
        padding: var(--spacing-sm) 0;
    }
    
    .footer-content {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: center;
    }
    
    .footer-language {
        margin-left: 0;
    }
    
    .footer-language-select {
        min-width: 100px;
        font-size: 13px;
        padding: 5px 10px;
    }
}

/* ============================================
   7. ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
.input:focus-visible,
.toggle-password:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
