/* =====================================================
   FORTUNE TELLER - DISTINCTIVE CELESTIAL THEME
   Breaking the "GPT Coder" aesthetic
   ===================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

/* =====================================================
   DESIGN TOKENS
   ===================================================== */
:root {
    /* Primary Palette - Warm Celestial */
    --color-base: #0a0e17;
    --color-surface: #121a2b;
    --color-surface-elevated: #1a2438;
    --color-accent-gold: #d4a574;
    --color-accent-gold-dim: rgba(212, 165, 116, 0.15);
    --color-accent-rose: #c9a0a0;
    --color-accent-blue: #7ba3c9;
    
    /* Text Colors */
    --text-primary: #e8e4df;
    --text-secondary: #9a9590;
    --text-muted: #5c5856;
    --text-accent: var(--color-accent-gold);
    
    /* Glassmorphism */
    --glass-bg: rgba(26, 36, 56, 0.7);
    --glass-border: rgba(212, 165, 116, 0.15);
    --glass-glow: rgba(212, 165, 116, 0.08);
    
    /* Shadows */
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(212, 165, 116, 0.1);
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    
    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Animated Star Field Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 60% 50%, rgba(212,165,116,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 40%, rgba(255,255,255,0.25) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 90% 60%, rgba(212,165,116,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 15% 80%, rgba(255,255,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 25% 50%, rgba(255,255,255,0.15) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 25%, rgba(255,255,255,0.2) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
    animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Subtle gradient overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(212,165,116,0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
}

/* =====================================================
   HEADER
   ===================================================== */
header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    border-radius: 50%;
    background: var(--color-accent-gold-dim);
    border: 1px solid var(--glass-border);
}

.logo svg {
    width: 32px;
    height: 32px;
    stroke: var(--color-accent-gold);
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

header h1 span {
    color: var(--text-accent);
}

.subtitle {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* =====================================================
   SECTIONS & CARDS
   ===================================================== */
main {
    min-height: 60vh;
}

section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: var(--space-lg);
}

h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.description {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    font-size: 0.95rem;
}

/* =====================================================
   FORM ELEMENTS
   ===================================================== */
form {
    max-width: 480px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(10, 14, 23, 0.6);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

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

input:focus,
select:focus {
    outline: none;
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 0 3px var(--color-accent-gold-dim);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a9590' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 1rem 2rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: var(--space-md);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent-gold) 0%, #b8956a 100%);
    color: var(--color-base);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition-smooth);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 165, 116, 0.3);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--color-accent-gold-dim);
    border-color: var(--color-accent-gold);
}

/* =====================================================
   LOADING STATES
   ===================================================== */
.loading-container {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
}

/* Celestial Orb Loader */
.celestial-loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
}

.celestial-loader .orb {
    position: absolute;
    inset: 15px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--color-accent-gold), #8b6914);
    box-shadow: 
        0 0 30px rgba(212, 165, 116, 0.4),
        inset 0 0 20px rgba(0,0,0,0.3);
    animation: pulse 2s ease-in-out infinite;
}

.celestial-loader .orbit {
    position: absolute;
    inset: 0;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    animation: spin 3s linear infinite;
}

.celestial-loader .orbit::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--color-accent-rose);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-accent-rose);
}

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

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

.loading-message {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--text-secondary);
    min-height: 2em;
}

/* Legacy spinner (hidden, keeping for fallback) */
.spinner {
    display: none;
}

/* =====================================================
   READING CARDS
   ===================================================== */
#readings-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.reading-card {
    background: var(--color-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: var(--space-md);
    transition: var(--transition-smooth);
    opacity: 0;
    transform: translateY(20px);
}

.reading-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.reading-card:hover {
    border-color: rgba(212, 165, 116, 0.3);
    box-shadow: var(--shadow-glow);
}

.reading-card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.reading-card h3 .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-accent-gold-dim);
}

.reading-card h3 .icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-accent-gold);
    fill: none;
    stroke-width: 1.5;
}

.reading-content {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 0.95rem;
}

/* Skeleton Loading State */
.reading-card.loading .reading-content {
    background: linear-gradient(90deg, 
        var(--color-surface-elevated) 25%, 
        rgba(212,165,116,0.05) 50%, 
        var(--color-surface-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    min-height: 80px;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Synthesis Card - Special Styling */
.synthesis-card {
    background: linear-gradient(135deg, rgba(212,165,116,0.08) 0%, rgba(26,36,56,0.9) 100%);
    border: 1px solid rgba(212, 165, 116, 0.25);
}

.synthesis-card h3 {
    color: var(--color-accent-gold);
}

.synthesis-card h3 .icon {
    background: rgba(212, 165, 116, 0.2);
}

/* =====================================================
   FOOTER
   ===================================================== */
footer {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--glass-border);
    margin-top: var(--space-xl);
}

/* =====================================================
   ERROR STATES
   ===================================================== */
.error-message {
    background: rgba(180, 80, 80, 0.1);
    border: 1px solid rgba(180, 80, 80, 0.3);
    color: #d4a0a0;
    padding: var(--space-sm);
    border-radius: 8px;
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 640px) {
    .container {
        padding: var(--space-md) var(--space-sm);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    section {
        padding: var(--space-md);
        border-radius: 12px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .celestial-loader {
        width: 60px;
        height: 60px;
    }
}
