/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --secondary-light: #f472b6;
    --accent-color: #fbbf24;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    --bg-primary: #fef7ff;
    --bg-secondary: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #fef7ff 0%, #f0f9ff 50%, #fff7ed 100%);
    
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    
    --border-radius: 20px;
    --border-radius-sm: 12px;
    --border-radius-lg: 28px;
    
    --font-primary: 'Inter', 'Quicksand', sans-serif;
    --font-display: 'Pacifico', cursive;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-gradient);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background particles */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    animation: float 20s infinite linear;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; background: rgba(236, 72, 153, 0.3); }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; background: rgba(251, 191, 36, 0.3); }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; background: rgba(99, 102, 241, 0.3); }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; background: rgba(16, 185, 129, 0.3); }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; background: rgba(236, 72, 153, 0.3); }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; background: rgba(251, 191, 36, 0.3); }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; background: rgba(99, 102, 241, 0.3); }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; background: rgba(16, 185, 129, 0.3); }

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 2;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1rem 0;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Glass card effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 400;
}

.hero-luna {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.luna-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.luna-face {
    font-size: 3rem;
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.3));
    animation: lunaFloat 3s ease-in-out infinite;
}

.luna-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: lunaGlow 2s ease-in-out infinite alternate;
}

@keyframes lunaFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes lunaGlow {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.luna-intro {
    max-width: 400px;
    padding: 1rem 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
}

.luna-intro::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid rgba(99, 102, 241, 0.1);
}

/* Form styles */
.card-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-input {
    padding: 0.875rem 1rem;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-primary);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Language select */
.language-select {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.8);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Countdown styles */
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.countdown-item {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: var(--transition);
}

.countdown-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.countdown-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.countdown-number.flip {
    animation: flip 0.6s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

.countdown-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Welcome section */
.welcome-content {
    text-align: center;
    padding: 2rem 0;
}

.welcome-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--success-color);
}

.welcome-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Luna chat styles */
.luna-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.luna-avatar-small {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.luna-face-small {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.luna-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chat-container {
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.luna {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message-avatar.user {
    background: var(--primary-color);
    color: white;
}

.message-avatar.luna {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-content.user {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content.luna {
    background: white;
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    background: white;
    margin-right: 0.75rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-send-btn {
    padding: 0.75rem;
    min-width: auto;
}

/* Quick questions */
.quick-questions {
    margin-top: 1.5rem;
}

.quick-questions h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.question-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.question-btn {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.question-btn:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Milestone styles */
.milestone-content {
    text-align: center;
}

.milestone-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.milestone-week {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.milestone-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.milestone-details {
    text-align: left;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.milestone-details h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.milestone-details p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.milestone-details a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.milestone-details a:hover {
    text-decoration: underline;
}

/* Name spinner styles */
.spinner-container {
    text-align: center;
}

.gender-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.gender-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.gender-btn:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.gender-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.gender-icon {
    font-size: 1.25rem;
}

.name-wheel {
    margin: 2rem 0;
}

.name-display {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.name-display.spinning {
    animation: spin 0.1s linear infinite;
    border-color: var(--secondary-color);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin-btn {
    font-size: 1.125rem;
    padding: 1rem 2rem;
}

.name-result {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--accent-color);
    font-weight: 600;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    color: var(--text-secondary);
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer-luna {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .hero-luna {
        flex-direction: column;
        text-align: center;
    }
    
    .luna-intro::before {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .countdown-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .countdown-item {
        padding: 1rem 0.5rem;
    }
    
    .countdown-number {
        font-size: 2rem;
    }
    
    .gender-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .name-display {
        width: 150px;
        height: 150px;
        font-size: 1.5rem;
    }
    
    .question-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .countdown-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .countdown-number {
        font-size: 1.75rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .card-title {
        font-size: 1.5rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 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,
.form-input:focus,
.language-select:focus,
.chat-input:focus,
.question-btn:focus,
.gender-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --glass-bg: rgba(255, 255, 255, 0.9);
        --glass-border: rgba(0, 0, 0, 0.3);
    }
}
