/* ==========================================
   Lucky Lotto CSS - Premium Dark Theme
   ========================================== */

/* 1. Global Reset & Variables */
:root {
    --bg-primary: #080b11;
    --bg-secondary: rgba(17, 24, 39, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Gradient Brand Colors */
    --accent-start: #6366f1; /* Indigo */
    --accent-end: #a855f7;   /* Purple */
    --cyan-glow: #06b6d4;
    
    /* Lotto Ball Color Palettes (Premium interpretation of traditional colors) */
    --ball-yellow-start: #fbbf24;
    --ball-yellow-end: #d97706;
    --ball-blue-start: #60a5fa;
    --ball-blue-end: #2563eb;
    --ball-red-start: #f87171;
    --ball-red-end: #dc2626;
    --ball-grey-start: #9ca3af;
    --ball-grey-end: #4b5563;
    --ball-green-start: #34d399;
    --ball-green-end: #059669;
    --ball-bonus-start: #f472b6; /* Pink-ish for premium bonus look */
    --ball-bonus-end: #db2777;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    background-color: var(--bg-primary);
    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;
    padding: 2rem 1rem;
}

/* 2. Background Orbs decoration */
.background-decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--accent-start) 0%, transparent 70%);
    top: -10%;
    right: -10%;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-end) 0%, transparent 70%);
    bottom: -15%;
    left: -10%;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(40px, -60px) scale(1.1);
    }
    100% {
        transform: translate(-30px, 40px) scale(0.95);
    }
}

/* 3. Layout Structure */
.app-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
}

/* 4. Header Styles */
.app-header {
    text-align: center;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    margin-bottom: 1.2rem;
    backdrop-filter: blur(10px);
}

.logo-icon {
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--text-primary);
}

.app-header h1 {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #ffffff, #d1d5db, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 5. Card Components & Glassmorphism */
.glass-panel {
    background-color: var(--bg-secondary);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: var(--transition-smooth);
}

.settings-card {
    padding: 2rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setting-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    width: 100%;
}

/* Game Count Selector (Segmented Control) */
.game-count-selector {
    display: flex;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.btn-count {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    width: 40px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.btn-count.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Custom Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .4s;
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 6. Buttons Styling */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 1.1rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition-bounce);
    box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -5px rgba(124, 58, 237, 0.6);
    filter: brightness(1.1);
}

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* 7. Results Display Area */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results-placeholder {
    padding: 3rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.placeholder-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.results-placeholder p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.games-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Game Row Structure */
.game-row {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-start);
    min-width: 60px;
}

.balls-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-grow: 1;
}

/* 8. Lotto Balls Styling & Animations */
.lotto-ball {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(0, 0, 0, 0.5);
    user-select: none;
    transform: scale(0) rotate(-180deg);
    animation: popAndSpin 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popAndSpin {
    to {
        transform: scale(1) rotate(0deg);
    }
}

/* Ball Colors mapping to values */
.ball-yellow {
    background: radial-gradient(circle at 35% 35%, var(--ball-yellow-start) 0%, var(--ball-yellow-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(217, 119, 6, 0.3);
}

.ball-blue {
    background: radial-gradient(circle at 35% 35%, var(--ball-blue-start) 0%, var(--ball-blue-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(37, 99, 235, 0.3);
}

.ball-red {
    background: radial-gradient(circle at 35% 35%, var(--ball-red-start) 0%, var(--ball-red-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(220, 38, 38, 0.3);
}

.ball-grey {
    background: radial-gradient(circle at 35% 35%, var(--ball-grey-start) 0%, var(--ball-grey-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(75, 85, 99, 0.3);
}

.ball-green {
    background: radial-gradient(circle at 35% 35%, var(--ball-green-start) 0%, var(--ball-green-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(5, 150, 105, 0.3);
}

/* Bonus Elements Styling */
.bonus-divider {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 0.25rem;
    animation: fadeIn 0.4s ease-in forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.ball-bonus {
    background: radial-gradient(circle at 35% 35%, var(--ball-bonus-start) 0%, var(--ball-bonus-end) 80%);
    box-shadow: 
        inset -3px -3px 8px rgba(0, 0, 0, 0.4),
        inset 3px 3px 8px rgba(255, 255, 255, 0.3),
        0 6px 15px -4px rgba(219, 39, 119, 0.4),
        0 0 10px rgba(219, 39, 119, 0.2);
    position: relative;
}

/* Small tag for Bonus Ball */
.ball-bonus::after {
    content: "보너스";
    position: absolute;
    top: -14px;
    font-size: 0.6rem;
    font-weight: 700;
    background: var(--ball-bonus-end);
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: -0.05em;
    pointer-events: none;
}

/* 9. Utility / Action buttons wrapper */
.utility-area {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-in forwards;
}

.hidden {
    display: none !important;
}

/* 10. Toast Notification */
.toast-msg {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 0.8rem 1.6rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

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

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

/* 11. Footer */
.app-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* 12. Responsive Adjustments */
@media (max-width: 540px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .settings-card {
        padding: 1.5rem;
    }
    
    .game-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .balls-wrapper {
        justify-content: flex-start;
        width: 100%;
        gap: 0.5rem;
    }

    .lotto-ball {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .game-count-selector {
        width: 100%;
        max-width: 150px;
    }
    
    .btn-count {
        flex-grow: 1;
    }
}
