/* ========================================
   SHARED STYLES FOR ALL AUTH PAGES
   These styles are used by login, registration,
   and other authentication-related pages
   ======================================== */

/* Global Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* CSS Variables */
:root {
    /* Colors */
    --surface: #ffffff;
    --surface-alt: #f9fafb;
    --surface-hover: #f3f4f6;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --error-border: #fecaca;
    --success: #16a34a;
    --warning: #ca8a04;
    --validated-bg: #f0fdf4;  /* Light green background for validated fields */
    --validated-border: #86efac;  /* Light green border for validated fields */

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

    /* Font Sizes */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-base: 16px;
    --font-lg: 20px;
    --font-xl: 25px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Box Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

    /* Container Widths */
    --container-width-default: 480px;  /* For login */
    --container-width-wide: 1000px;     /* Increased from 800px for registration */
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --surface: #1f2937;
    --surface-alt: #111827;
    --surface-hover: #374151;
    --text: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border: #374151;
    --validated-bg: #064e3b;  /* Darker green background for dark mode */
    --validated-border: #059669;  /* Darker green border for dark mode */
}

/* Page Layout */
.auth-page {
    min-height: 100vh;
    padding: var(--space-2xl) var(--space-xl);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 7.5vh;
}

/* Main Container */
.auth-container {
    width: 100%;
    max-width: var(--container-width, var(--container-width-default));
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Logo Section */
.auth-logo {
    width: 100%;
    margin-bottom: var(--space-2xl);
    text-align: center;
    display: flex;
    justify-content: center;
    position: relative;
}

.auth-logo img {
    width: 300px;
    height: auto;
    object-fit: contain;
}

/* Form Container */
.auth-box {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl);
    position: relative;
    top: 0;
}

/* Controls Container */
.controls-container {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0;
    position: relative;
    z-index: 1000;
    overflow: visible;
    margin-bottom: -1px;  /* Remove gap between buttons and auth-box */
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: auto;
    min-width: 48px;
    height: 40px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--surface);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-sm);
}

.theme-toggle-btn:hover {
    background: var(--surface-hover);
}

.theme-toggle__icon {
    width: 24px;
    height: 24px;
    color: var(--text);
    position: absolute;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.theme-toggle__icon--dark {
    transform: translateY(100%);
    opacity: 0;
}

.theme-toggle-btn.is-dark-theme .theme-toggle__icon {
    transform: translateY(-100%);
    opacity: 0;
}

.theme-toggle-btn.is-dark-theme .theme-toggle__icon--dark {
    transform: translateY(0);
    opacity: 1;
}

/* Language selector */
.language-dropdown {
    position: relative;
    display: inline-block;
}

/* Base style shared between button and options */
.language-button,
.language-option {
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 100px;
}

/* Explicit font sizing to prevent inheritance issues */
button.language-button {
    font-size: 0.75rem !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    height: 40px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

li.language-option {
    font-size: 0.75rem !important;
    font-family: inherit !important;
    font-weight: inherit !important;
}

.language-button {
    appearance: none;
    background: var(--surface);
    border: none;
    color: var(--text);
    position: relative;
}

.language-button:hover {
    background-color: var(--surface-hover);
}

.language-list {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    margin: 0;
    padding: 0;
    list-style: none;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.language-list.show {
    display: block;
}

.language-option:hover {
    background-color: var(--surface-hover);
}

.language-option.selected {
    background-color: var(--surface-hover);
}

/* Only add separator for the first non-primary language */
.language-option.separator:first-of-type {
    border-top: 1px solid var(--border);
    margin-top: 2px;
    padding-top: 2px;
}

/* Hide the original form */
.language-form {
    display: none;
}

/* Form Layout */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    width: 100%;
}

/* Grid System */
.form-row {
    display: grid;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    grid-template-columns: var(--grid-columns, 1fr);
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xxs);
    width: 100%;
}

/* Form Labels */
.form-group label {
    font-size: var(--font-base);
    font-weight: 500;
    color: var(--text);
}

.required-field::after {
    content: "*";
    color: var(--error);
    margin-left: var(--space-xxs);
}

/* Form Controls */
.form-control {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-md);
    font-size: var(--font-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s ease;
}

/* Validated field styles */
.form-control.validated {
    background-color: var(--validated-bg);
    border-color: var(--validated-border);
    padding-right: calc(var(--space-md) + 24px); /* Make room for checkmark */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2316a34a'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-sm) center;
    background-size: 20px 20px;
}

/* Focus state */
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Navigation Buttons Container */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    width: 100%;
}

/* Button Base */
.btn {
    height: 48px;
    padding: 0 var(--space-xl);
    font-size: var(--font-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-width: 160px;
}

/* Primary Button */
.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--hover-blue);
}

/* Secondary Button */
.btn-secondary {
    background: rgba(64, 157, 255, 0.1);  /* Primary blue with 10% opacity */
    border: none;
    color: var(--primary-blue);
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(64, 157, 255, 0.15);  /* Slightly darker on hover */
    color: var(--hover-blue);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .form-actions {
        flex-direction: column-reverse;
        gap: var(--space-sm);
    }

    .btn {
        width: 100%;
    }

    .auth-page {
        padding-top: 10vh;
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: var(--space-lg);
        padding-top: 5vh;
    }

    .auth-box {
        padding: var(--space-lg);
    }
}

/* Section Styles */
.section-container {
    margin-bottom: var(--space-md);
    transition: margin 0.3s ease;
}

.section-container.collapsed {
    margin-bottom: var(--space-sm);
}

.section-container h3 {
    font-size: var(--font-lg);
    font-weight: 500;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

/* Step Title */
.step-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-sm);
}

/* Step Description */
.step-description {
    color: var(--text-secondary);
    font-size: var(--font-base);
    margin-bottom: var(--space-lg);
}

/* Form Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.form-check-label {
    font-size: var(--font-base);
    color: var(--text);
}

/* Collapsible Address Sections */
#postal_address_fields,
#visiting_address_fields {
    max-height: 1000px;  /* Large enough to contain content */
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out, margin 0.3s ease-out;
    opacity: 1;
    margin-top: var(--space-md);
}

#postal_address_fields.collapsed,
#visiting_address_fields.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
} 