* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #416666ff;
    --accent-color: #c8553dff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #fff7ebff;
    --surface: #ffffff;
    --text-primary: #0f274a;
    --text-secondary: #6b7280;
    --border: #e2e8f0;
    --border-focus: #416666ff;
    --shadow: 0 clamp(0.0625rem, 0.5vw, 0.125rem) clamp(0.1875rem, 1vw, 0.375rem) 0 rgb(0 0 0 / 0.1), 0 clamp(0.0625rem, 0.5vw, 0.125rem) clamp(0.125rem, 0.8vw, 0.25rem) -clamp(0.0625rem, 0.5vw, 0.125rem) rgb(0 0 0 / 0.1);
    --shadow-lg: 0 clamp(0.625rem, 3vw, 1.25rem) clamp(0.9375rem, 4vw, 1.875rem) -clamp(0.1875rem, 1vw, 0.375rem) rgb(0 0 0 / 0.1), 0 clamp(0.25rem, 1.5vw, 0.5rem) clamp(0.375rem, 2vw, 0.75rem) -clamp(0.25rem, 1.5vw, 0.5rem) rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.5rem, 2vw, 2rem);
}

/* Settings Dropdown */
.settings-dropdown {
    position: fixed;
    top: clamp(1rem, 4vw, 2rem);
    right: clamp(1rem, 4vw, 2rem);
    z-index: 1000;
}

.settings-btn {
    background: var(--surface);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    color: var(--text-secondary);
    padding: clamp(0.5rem, 2vw, 0.75rem);
    border-radius: clamp(0.5rem, 3vw, 0.75rem);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(2.5rem, 8vw, 3rem);
    height: clamp(2.5rem, 8vw, 3rem);
    box-shadow: var(--shadow);
}

.settings-btn:hover {
    color: var(--primary-color);
    background: rgba(65, 102, 102, 0.05);
    transform: rotate(90deg);
}

.settings-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(65, 102, 102, 0.3);
}

.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    border-radius: clamp(0.5rem, 3vw, 0.75rem);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--background);
    border-radius: clamp(0.5rem, 3vw, 0.75rem) clamp(0.5rem, 3vw, 0.75rem) 0 0;
}

.settings-header i {
    color: var(--primary-color);
}

.language-options {
    padding: 0.5rem 0;
}

.lang-option {
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.lang-option:hover {
    background: var(--background);
}

.lang-option.active {
    background: rgba(65, 102, 102, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.lang-option i.fa-flag {
    width: 1rem;
    text-align: center;
}

.lang-option i.fa-check {
    margin-left: auto;
    color: var(--primary-color);
    font-size: 0.75rem;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: clamp(2rem, 6vw, 2.5rem);
    height: clamp(2rem, 6vw, 2.5rem);
    border: clamp(0.125rem, 0.8vw, 0.25rem) solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: clamp(18.75rem, 80vw, 31.25rem);
    position: relative;
}

.auth-card {
    background: var(--surface);
    border-radius: clamp(0.75rem, 2.5vw, 1rem);
    padding: clamp(1.25rem, 5vw, 2rem);
    box-shadow: var(--shadow-lg);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    transition: all 0.3s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.auth-header h1 {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: clamp(0.375rem, 1.5vw, 0.5rem);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
}

/* Form Styles */
.form-group {
    margin-bottom: clamp(1.25rem, 3vw, 1.5rem);
}

.form-group.half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(0.75rem, 2.5vw, 1rem);
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: clamp(0.375rem, 1.5vw, 0.5rem);
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
}

.form-input {
    width: 100%;
    padding: clamp(0.75rem, 2.5vw, 0.875rem) clamp(0.875rem, 2.5vw, 1rem);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 clamp(0.125rem, 0.8vw, 0.1875rem) rgba(65, 102, 102, 0.1);
    transform: translateY(-clamp(0.03125rem, 0.2vw, 0.0625rem));
}

.form-input::placeholder {
    color: var(--text-secondary);
}

/* Phone Input Styles */
.phone-input-group {
    display: flex;
    gap: clamp(0.375rem, 1.5vw, 0.5rem);
    flex-wrap: wrap;
}

.country-code-container {
    position: relative;
    flex-shrink: 0;
}

.country-code-select {
    padding: clamp(0.75rem, 2.5vw, 0.875rem) clamp(0.875rem, 2.5vw, 1rem);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: clamp(0.375rem, 1.5vw, 0.5rem);
    min-width: clamp(6rem, 20vw, 7.5rem);
    transition: all 0.3s ease;
}

.country-code-select:hover {
    border-color: var(--border-focus);
}

.phone-number-input {
    flex: 1;
    min-width: clamp(12rem, 40vw, 18rem);
}

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    box-shadow: var(--shadow-lg);
    max-height: clamp(12rem, 40vw, 15.625rem);
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-clamp(0.5rem, 2vw, 0.625rem));
    transition: all 0.3s ease;
    margin-top: clamp(0.125rem, 0.8vw, 0.25rem);
}

.country-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.country-search-input {
    width: 100%;
    padding: clamp(0.625rem, 2vw, 0.75rem);
    border: none;
    border-bottom: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    outline: none;
    background: var(--surface);
}

#countryList {
    max-height: clamp(10rem, 35vw, 12.5rem);
    overflow-y: auto;
}

.country-option {
    padding: clamp(0.625rem, 2vw, 0.75rem);
    display: flex;
    align-items: center;
    gap: clamp(0.625rem, 2vw, 0.75rem);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.country-option:hover {
    background: var(--background);
}

.country-option.selected {
    background: rgba(65, 102, 102, 0.1);
    color: var(--primary-color);
}

.country-flag {
    font-size: clamp(1rem, 3vw, 1.2rem);
}

.country-code {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
}

/* Button */
.auth-btn {
    width: 100%;
    padding: clamp(0.75rem, 2.5vw, 0.875rem) clamp(1.25rem, 4vw, 1.5rem);
    border: none;
    border-radius: clamp(0.5rem, 2vw, 0.75rem);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-btn.primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 clamp(0.125rem, 0.8vw, 0.25rem) clamp(0.75rem, 3vw, 0.875rem) rgba(200, 85, 61, 0.3);
}

.auth-btn.primary:hover:not(:disabled) {
    transform: translateY(-clamp(0.0625rem, 0.3vw, 0.125rem));
    box-shadow: 0 clamp(0.25rem, 1.2vw, 0.375rem) clamp(1rem, 4vw, 1.25rem) rgba(200, 85, 61, 0.4);
}

.auth-btn.primary:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Auth Switch */
.auth-switch {
    text-align: center;
    margin-top: clamp(1.25rem, 3vw, 1.5rem);
    padding-top: clamp(1.25rem, 3vw, 1.5rem);
    border-top: clamp(0.0625rem, 0.3vw, 0.125rem) solid var(--border);
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-left: clamp(0.125rem, 0.8vw, 0.25rem);
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: var(--accent-color);
}

/* Loading Animation */
.loading {
    display: inline-flex;
    align-items: center;
    gap: clamp(0.375rem, 1.5vw, 0.5rem);
}

.spinner {
    width: clamp(0.875rem, 2.5vw, 1rem);
    height: clamp(0.875rem, 2.5vw, 1rem);
    border: clamp(0.0625rem, 0.3vw, 0.125rem) solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Success Animation */
.success-icon {
    color: var(--success-color);
}

/* Language Transition */
.content-transition {
    opacity: 0;
    transform: translateY(clamp(0.5rem, 2vw, 0.625rem));
    transition: all 0.3s ease;
}

.content-transition.active {
    opacity: 1;
    transform: translateY(0);
}

.select-container {
    position: relative;
}

.select-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--surface);
    cursor: pointer;
    padding-right: clamp(2.5rem, 8vw, 3rem);
}

.select-arrow {
    position: absolute;
    right: clamp(0.875rem, 2.5vw, 1rem);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    transition: all 0.3s ease;
}

.select-input:focus + .select-arrow {
    color: var(--primary-color);
    transform: translateY(-50%) rotate(180deg);
}

.select-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 clamp(0.125rem, 0.8vw, 0.1875rem) rgba(65, 102, 102, 0.1);
    transform: translateY(-clamp(0.03125rem, 0.2vw, 0.0625rem));
}

.select-input option {
    padding: clamp(0.375rem, 1.5vw, 0.5rem);
    background: var(--surface);
    color: var(--text-primary);
}

/* Responsive - Now mostly handled by clamp() but keeping for extreme cases */
@media (max-width: 30rem) {
    .form-group.half {
        grid-template-columns: 1fr;
    }

    .phone-input-group {
        flex-direction: column;
    }

    .phone-number-input {
        min-width: auto;
    }

    .country-code-select {
        min-width: auto;
    }
}

/* Help text styling */
.form-help-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.form-help-text em {
    color: var(--text-secondary);
    font-size: 0.875rem;
}