/* =====================================================================
   Tadora UI Design System (CSS Variables)
   ===================================================================== */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(20, 26, 46, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.3);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    
    --google-color: #ffffff;
    --google-bg: #1f2937;
    
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: #3b82f6;
    
    --radius-lg: 16px;
    --radius-md: 10px;
    
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

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

/* Dominican Flag Glow Effect in BG */
.glow-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 47, 108, 0.25) 0%, rgba(206, 17, 38, 0.15) 50%, rgba(11, 15, 25, 0) 100%);
    z-index: 0;
    pointer-events: none;
    filter: blur(80px);
}

/* =====================================================================
   Layout Containers
   ===================================================================== */
.app-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #ce1126 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.theme-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.badge-dot.pulse-green {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* =====================================================================
   Card Component (Glassmorphic)
   ===================================================================== */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: translateY(20px);
    display: none;
}

.card.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.card-header {
    margin-bottom: 25px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.card-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.badge-stage {
    display: inline-block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
}

/* =====================================================================
   Forms & Input Elements
   ===================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 15px;
}

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

.form-input, .form-select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

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

.form-input:focus, .form-select:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Prefixes & Icons inside Inputs */
.input-prefix {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.input-field-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

#phone-number {
    padding-left: 70px;
}

#onboarding-phone {
    padding-left: 70px;
}

#onboarding-phone:disabled {
    opacity: 0.8;
    color: var(--text-secondary);
    background-color: rgba(15, 23, 42, 0.4);
    cursor: not-allowed;
}

#full-name {
    padding-left: 42px;
}

#province-select, #municipality-select {
    padding-left: 42px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.input-wrapper::after {
    /* Custom chevron for select inputs */
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.input-wrapper:not(:has(select))::after {
    display: none;
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.input-status-icon {
    position: absolute;
    right: 14px;
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.flag-icon {
    font-size: 16px;
}

/* =====================================================================
   Buttons (Premium Aesthetics)
   ===================================================================== */
.btn {
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    box-shadow: 0 6px 18px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-google {
    background-color: var(--google-bg);
    color: var(--google-color);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-google:hover {
    background-color: #2d3748;
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn-sec {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

/* =====================================================================
   OTP Digital Inputs
   ===================================================================== */
.otp-digits-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 15px 0;
}

.otp-input {
    width: 48px;
    height: 54px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
    outline: none;
    transition: all 0.2s ease;
}

.otp-input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.otp-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.back-navigation {
    font-size: 12px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}

.back-navigation:hover {
    color: var(--text-primary);
}

/* =====================================================================
   Divider & Layout Helpers
   ===================================================================== */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider::before {
    margin-right: .5em;
}

.divider::after {
    margin-left: .5em;
}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.hidden { display: none !important; }

/* Language toggle buttons */
.language-toggle-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lang-btn {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.lang-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--text-primary);
    font-weight: 600;
}

.flag-circle {
    font-size: 16px;
}

/* =====================================================================
   Overlay & Custom Loader Animations
   ===================================================================== */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fade-in 0.2s ease;
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

.loader-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Toast System */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #1e293b;
    border: 1px solid var(--error);
    border-left: 4px solid var(--error);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
    border-color: var(--success);
    border-left-color: var(--success);
}

.toast-icon {
    font-size: 18px;
}

#toast.hidden {
    display: none !important;
}

.toast-icon {
    color: var(--error);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* =====================================================================
   Developer Simulation Dashboard (Supabase Visualizer)
   ===================================================================== */
.demo-dashboard {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-top: 10px;
    overflow: hidden;
    font-size: 12px;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.dashboard-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-icon {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.dashboard-header.active .toggle-icon {
    transform: rotate(180deg);
}

.dashboard-content {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.db-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 12px;
}

@media (min-width: 400px) {
    .db-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.db-section h4 {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.db-section pre {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    overflow-x: auto;
    color: #38bdf8;
    max-height: 150px;
}

.db-actions {
    display: flex;
    justify-content: flex-end;
}

/* =====================================================================
   Animation Library
   ===================================================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in 0.4s ease forwards;
}

.animate-pulse {
    animation: pulse 2s infinite ease-in-out;
}
