/* ============================================
   LifeReceipt - Main Stylesheet
   Neo-Receipt 디자인 시스템
   ============================================ */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    /* Colors - Neon Theme (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    
    --accent-primary: #00ff88;
    --accent-secondary: #ff00aa;
    --accent-tertiary: #00aaff;
    
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #00ff88 0%, #00aaff 100%);
    --gradient-hero: linear-gradient(180deg, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    
    /* Receipt Colors */
    --receipt-bg: #fafafa;
    --receipt-text: #1a1a1a;
    --receipt-accent: #00aa66;
    --receipt-shadow: rgba(0, 255, 136, 0.3);
    
    /* Typography */
    --font-display: 'Noto Sans KR', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    
    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    --text-5xl: 3.5rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-primary);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Z-index */
    --z-base: 1;
    --z-dropdown: 100;
    --z-overlay: 500;
    --z-modal: 1000;
    --z-toast: 2000;
}

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

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

body {
    font-family: var(--font-display);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Background Effects
   ============================================ */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 255, 136, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Container & Layout
   ============================================ */
.container {
    position: relative;
    z-index: var(--z-base);
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-4);
    min-height: 100vh;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    text-align: center;
    padding: var(--space-12) 0 var(--space-8);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-2) var(--space-4);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
}

.logo-icon {
    font-size: var(--text-xl);
    animation: pulse 2s infinite;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.hero-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-4);
    letter-spacing: -0.02em;
}

@media (min-width: 640px) {
    .hero-title {
        font-size: var(--text-5xl);
    }
}

.gradient-text {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   Input Section
   ============================================ */
.input-section {
    margin-bottom: var(--space-8);
}

.input-wrapper {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.1);
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.label-icon {
    font-size: var(--text-base);
}

.day-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-display);
    font-size: var(--text-base);
    color: var(--text-primary);
    resize: none;
    line-height: 1.7;
}

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

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.char-count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ============================================
   Generate Button
   ============================================ */
.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: var(--gradient-2);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    color: #000;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.generate-btn:hover::before {
    transform: translateX(100%);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

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

.generate-btn.loading .btn-icon,
.generate-btn.loading .btn-text {
    opacity: 0;
}

.generate-btn.loading .btn-loader {
    display: block;
}

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Theme Selector
   ============================================ */
.theme-selector {
    position: fixed;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: var(--z-dropdown);
}

@media (max-width: 768px) {
    .theme-selector {
        position: fixed;
        right: 50%;
        transform: translateX(50%);
        top: auto;
        bottom: var(--space-20);
        flex-direction: row;
    }
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.theme-btn.locked {
    opacity: 0.5;
}

.theme-preview {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
}

.theme-preview.neon {
    background: linear-gradient(135deg, #00ff88, #00aaff);
}

.theme-preview.classic {
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
}

.theme-preview.gold {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.theme-preview.retro {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
}

.lock-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 10px;
    background: var(--bg-card);
    border-radius: 50%;
    padding: 2px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    position: relative;
    z-index: var(--z-base);
    text-align: center;
    padding: var(--space-8) var(--space-4);
    margin-top: var(--space-16);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-2);
}

.footer-links a {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-links span {
    color: var(--text-muted);
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
}

.printer {
    width: 100px;
    height: 80px;
    margin: 0 auto var(--space-4);
    position: relative;
}

.printer-body {
    width: 100%;
    height: 50px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    position: absolute;
    bottom: 0;
}

.printer-body::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 10px;
    background: rgba(0, 255, 136, 0.3);
    border-radius: 2px;
}

.paper {
    width: 70px;
    height: 0;
    background: #fafafa;
    position: absolute;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    animation: printPaper 1s ease-out infinite;
    border-radius: 2px 2px 0 0;
}

.loading-text {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    bottom: var(--space-8);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-primary);
    z-index: var(--z-toast);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

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

.toast.error {
    border-color: #ff4444;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

.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;
}

/* ============================================
   Animations (defined in animations.css)
   ============================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes printPaper {
    0% { height: 0; }
    50% { height: 60px; }
    100% { height: 0; }
}
