/* ============================================
   VAPE OS THEME - GLASSMORPHISM DESIGN
   Version: 3.0.0 - Clean & Mobile First
   ============================================ */

/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    min-height: 100%;
    min-height: -webkit-fill-available;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    /* Colors */
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* Glass Effects */
    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-glass-hover: rgba(255, 255, 255, 0.15);
    --bg-glass-active: rgba(255, 255, 255, 0.2);
    --border-glass: rgba(255, 255, 255, 0.2);
    
    /* Shadows & Effects */
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-lg: 0 15px 40px 0 rgba(31, 38, 135, 0.5);
    --blur: blur(10px);
    --blur-heavy: blur(20px);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    
    /* Layout */
    --container-max-width: 1200px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 20px;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
}

/* ============================================
   ONBOARDING PAGE STYLES
   ============================================ */

body.onboarding-page {
    height: 100vh;
    height: -webkit-fill-available;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

/* Animated Background Blobs */
.vape-os-container {
    height: 100vh;
    height: -webkit-fill-available;
    overflow: hidden;
    position: relative;
}

.vape-os-container::before,
.vape-os-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
    pointer-events: none;
}

.vape-os-container::before {
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    top: -20%;
    right: -20%;
}

.vape-os-container::after {
    width: min(500px, 90vw);
    height: min(500px, 90vw);
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    bottom: -25%;
    left: -25%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Main Screen Wrapper */
.vape-os-screen {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    height: 100vh;
    height: -webkit-fill-available;
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Status Bar */
.vape-os-status-bar {
    background: var(--bg-glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow);
    text-align: center;
}

.status-bar-title {
    font-size: clamp(1rem, 4vw, 1.125rem);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

/* Content Area */
.vape-os-content {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-lg);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    box-shadow: var(--shadow);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Progress Dots */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: clamp(1.5rem, 5vw, 2.5rem);
    flex-wrap: wrap;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.dot.active {
    background: var(--text-primary);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Form Steps */
.form-step {
    display: none;
    flex: 1;
    min-height: 0;
    animation: slideIn 0.4s ease;
}

.form-step.active {
    display: flex;
    flex-direction: column;
}

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.welcome-title {
    font-size: clamp(2rem, 8vw, 2.25rem);
    font-weight: 700;
    text-align: center;
    margin: clamp(1.5rem, 5vw, 2.5rem) 0;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 1.75rem);
}

.welcome-subtitle, 
.step-subtitle {
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 3vw, 1rem);
    line-height: 1.6;
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

/* Welcome Icon */
.welcome-icon {
    font-size: clamp(4rem, 15vw, 6.25rem);
    text-align: center;
    margin: clamp(2rem, 8vw, 3rem) 0;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.form-label {
    display: block;
    color: var(--text-primary);
    font-size: clamp(0.875rem, 3vw, 1rem);
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.form-input, 
.form-select {
    width: 100%;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(1rem, 4vw, 1.25rem);
    font-size: 16px; /* Prevents zoom on iOS */
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: var(--transition);
    font-family: inherit;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-input:focus, 
.form-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

.form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select option {
    background: var(--primary-dark);
    color: white;
}

.form-hint {
    display: block;
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2.5vw, 0.8125rem);
    margin-top: var(--spacing-xs);
}

/* Radio and Checkbox Groups */
.radio-group, 
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.radio-option, 
.checkbox-option {
    display: flex;
    align-items: center;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(1rem, 4vw, 1.25rem);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px; /* Touch target */
}

.radio-option:hover, 
.checkbox-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.radio-option input[type="radio"],
.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.radio-label, 
.checkbox-label {
    font-size: clamp(0.875rem, 3vw, 1rem);
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(1.5rem, 5vw, 2rem);
    font-size: clamp(0.875rem, 3vw, 1rem);
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    min-height: 48px; /* Touch target */
    gap: var(--spacing-xs);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px 0 rgba(124, 58, 237, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(124, 58, 237, 0.4);
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

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

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: auto;
    padding-top: var(--spacing-lg);
}

.nav-buttons .btn-secondary {
    flex: 0 0 auto;
    min-width: 120px;
}

.nav-buttons .btn-primary {
    flex: 1;
}

/* ============================================
   LOGIN & AUTH STYLES
   ============================================ */

.login-link {
    text-align: center;
    margin-top: var(--spacing-md);
    font-size: clamp(0.875rem, 3vw, 0.9375rem);
    color: var(--text-secondary);
}

.login-link a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.login-link a:hover,
.login-link a:focus {
    color: var(--primary-light);
    text-decoration: underline;
}

.login-form {
    max-width: 400px;
    margin: 0 auto;
    padding-top: var(--spacing-sm);
}

.divider {
    text-align: center;
    margin: var(--spacing-lg) 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.divider span {
    background: transparent;
    padding: 0 var(--spacing-sm);
    position: relative;
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
}

/* ============================================
   SUCCESS SCREEN
   ============================================ */

.success-icon {
    font-size: clamp(4rem, 12vw, 5rem);
    text-align: center;
    margin: clamp(2rem, 6vw, 2.5rem) 0 clamp(1.5rem, 4vw, 1.875rem);
    animation: bounce 1s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.success-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 3vw, 1rem);
    margin-bottom: clamp(2rem, 6vw, 2.5rem);
    line-height: 1.6;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error,
.form-input.error,
.form-select.error {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #fca5a5;
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.error-message::before {
    content: '⚠️';
    font-size: 1rem;
}

/* ============================================
   GENERAL PAGE STYLES (NON-ONBOARDING)
   ============================================ */

body:not(.onboarding-page) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated blobs for all pages */
body:not(.onboarding-page)::before,
body:not(.onboarding-page)::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
}

body:not(.onboarding-page)::before {
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    top: -20%;
    right: -20%;
    animation: float 20s infinite ease-in-out;
}

body:not(.onboarding-page)::after {
    width: min(500px, 90vw);
    height: min(500px, 90vw);
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    bottom: -25%;
    left: -25%;
    animation-delay: -10s;
    animation: float 20s infinite ease-in-out;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.glass-card:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .vape-os-screen {
        padding: var(--spacing-md);
    }
    
    .nav-buttons {
        flex-direction: row;
    }
    
    .nav-buttons .btn-secondary {
        flex: 0 0 120px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .welcome-title {
        margin-top: var(--spacing-xl);
    }
    
    .form-group {
        margin-bottom: var(--spacing-md);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* Mobile-specific optimizations */
@media (max-width: 767px) {
    /* Ensure proper touch targets */
    .btn,
    .radio-option,
    .checkbox-option,
    .form-input,
    .form-select {
        min-height: 48px;
    }
    
    /* Stack navigation buttons on mobile */
    .nav-buttons {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .nav-buttons .btn-secondary {
        flex: 1;
        width: 100%;
    }
    
    /* Adjust form spacing for mobile */
    .form-group {
        margin-bottom: var(--spacing-sm);
    }
    
    /* Reduce content padding on mobile */
    .vape-os-content {
        padding: var(--spacing-md);
    }
    
    /* Mobile viewport height fix */
    body.onboarding-page {
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .vape-os-container,
    .vape-os-screen {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575px) {
    .vape-os-screen {
        padding: var(--spacing-xs);
    }
    
    .vape-os-content {
        padding: var(--spacing-sm);
        border-radius: var(--border-radius);
    }
    
    .status-bar-title {
        font-size: 0.875rem;
    }
    
    .progress-dots {
        margin-bottom: var(--spacing-sm);
    }
    
    .radio-option, 
    .checkbox-option {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus indicators */
.btn:focus,
.form-input:focus,
.form-select:focus,
.radio-option:focus-within,
.checkbox-option:focus-within {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-glass: rgba(255, 255, 255, 0.3);
        --bg-glass-hover: rgba(255, 255, 255, 0.4);
        --border-glass: rgba(255, 255, 255, 0.5);
        --text-secondary: rgba(255, 255, 255, 0.9);
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-glass: rgba(0, 0, 0, 0.3);
        --bg-glass-hover: rgba(0, 0, 0, 0.4);
        --bg-glass-active: rgba(0, 0, 0, 0.5);
        --border-glass: rgba(255, 255, 255, 0.1);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .glass-card {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .vape-os-container::before,
    .vape-os-container::after,
    body::before,
    body::after {
        display: none !important;
    }
    
    .btn {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}