/* THEME SYSTEM - Hạ Linh Kids */

/* DEFAULT THEME */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --theme-color-1: #667eea;
    --theme-color-2: #764ba2;
    --theme-color-3: #f093fb;
    --theme-name: 'default';
}

/* GIÁNG SINH THEME */
body[data-theme="christmas"] {
    --primary-gradient: linear-gradient(135deg, #c41e3a 0%, #228b22 50%, #ffd700 100%);
    --theme-color-1: #c41e3a;
    --theme-color-2: #228b22;
    --theme-color-3: #ffd700;
    --theme-name: 'christmas';
}

body[data-theme="christmas"]::before {
    background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
}

/* Tuyết rơi cho Giáng sinh */
body[data-theme="christmas"]::after {
    content: '';
    position: fixed;
    top: -10px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 160px 30px, white, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: snowfall 10s linear infinite;
    z-index: 1;
    opacity: 0.6;
}

@keyframes snowfall {
    0% { transform: translateY(-100px); }
    100% { transform: translateY(100vh); }
}

body[data-theme="christmas"] .game-box {
    border-color: rgba(255,215,0,0.4);
    position: relative;
    overflow: hidden;
}

body[data-theme="christmas"] .game-box::before {
    content: '🎄';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 30px;
    opacity: 0.2;
    animation: twinkle 2s ease-in-out infinite alternate;
}

body[data-theme="christmas"] .game-box:hover {
    border-color: rgba(255,215,0,0.8);
    box-shadow: 0 20px 40px rgba(196,30,58,0.3);
}

@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(1); }
    100% { opacity: 0.6; transform: scale(1.1); }
}

/* TẾT THEME */
body[data-theme="tet"] {
    --primary-gradient: linear-gradient(135deg, #dc143c 0%, #ffd700 50%, #ff1493 100%);
    --theme-color-1: #dc143c;
    --theme-color-2: #ffd700;
    --theme-color-3: #ff1493;
    --theme-name: 'tet';
}

body[data-theme="tet"]::before {
    background: radial-gradient(circle, rgba(255,215,0,0.2) 0%, transparent 70%);
}

/* Pháo hoa cho Tết */
body[data-theme="tet"]::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        radial-gradient(circle at 20% 20%, #ffd700 2px, transparent 2px),
        radial-gradient(circle at 80% 30%, #ff1493 1px, transparent 1px),
        radial-gradient(circle at 40% 60%, #dc143c 2px, transparent 2px),
        radial-gradient(circle at 70% 80%, #ffd700 1px, transparent 1px),
        radial-gradient(circle at 30% 90%, #ff1493 2px, transparent 2px);
    background-size: 100px 100px, 150px 150px, 120px 120px, 80px 80px, 200px 200px;
    animation: fireworks 3s ease-in-out infinite;
    z-index: 1;
    opacity: 0.4;
}

@keyframes fireworks {
    0% { 
        transform: scale(0.5);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.6;
    }
    100% { 
        transform: scale(2);
        opacity: 0;
    }
}

body[data-theme="tet"] .game-box {
    border-color: rgba(255,215,0,0.5);
    position: relative;
}

body[data-theme="tet"] .game-box::before {
    content: '🧧';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 25px;
    opacity: 0.3;
    animation: bounce 1.5s ease-in-out infinite;
}

body[data-theme="tet"] .game-box:hover {
    border-color: rgba(255,215,0,0.9);
    box-shadow: 0 20px 40px rgba(220,20,60,0.3);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

/* TRUNG THU THEME */
body[data-theme="mid-autumn"] {
    --primary-gradient: linear-gradient(135deg, #4169e1 0%, #ffd700 50%, #ff8c00 100%);
    --theme-color-1: #4169e1;
    --theme-color-2: #ffd700;
    --theme-color-3: #ff8c00;
    --theme-name: 'mid-autumn';
}

body[data-theme="mid-autumn"]::before {
    background: radial-gradient(circle, rgba(255,140,0,0.15) 0%, transparent 70%);
}

/* Mặt trăng tròn cho Trung Thu */
body[data-theme="mid-autumn"]::after {
    content: '';
    position: fixed;
    top: 50px;
    right: 100px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #ffd700 40%, #ffeb3b 60%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: moonlight 8s ease-in-out infinite;
    z-index: 1;
    opacity: 0.7;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
}

/* Thêm các ngôi sao nhỏ */
body[data-theme="mid-autumn"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        radial-gradient(1px 1px at 100px 50px, #ffd700, transparent),
        radial-gradient(1px 1px at 300px 100px, #ffeb3b, transparent),
        radial-gradient(1px 1px at 500px 150px, #ffd700, transparent),
        radial-gradient(1px 1px at 200px 200px, #ffeb3b, transparent),
        radial-gradient(1px 1px at 400px 250px, #ffd700, transparent);
    background-repeat: no-repeat;
    animation: twinkleStars 4s ease-in-out infinite;
    z-index: 1;
    opacity: 0.8;
}

@keyframes moonlight {
    0%, 100% { 
        transform: translateY(0px);
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    }
    50% { 
        transform: translateY(-20px);
        box-shadow: 0 0 80px rgba(255, 215, 0, 0.8);
    }
}

@keyframes twinkleStars {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

body[data-theme="mid-autumn"] .game-box {
    border-color: rgba(255,215,0,0.4);
    position: relative;
}

body[data-theme="mid-autumn"] .game-box::before {
    content: '🏮';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 28px;
    opacity: 0.25;
    animation: lantern 3s ease-in-out infinite;
}

body[data-theme="mid-autumn"] .game-box:hover {
    border-color: rgba(255,215,0,0.8);
    box-shadow: 0 20px 40px rgba(255,140,0,0.3);
}

@keyframes lantern {
    0%, 100% { transform: rotate(-3deg) scale(1); opacity: 0.25; }
    50% { transform: rotate(3deg) scale(1.05); opacity: 0.4; }
}

/* THEME SELECTOR STYLES */
.theme-selector {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
    min-width: 60px;
}

.theme-selector:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.theme-selector.collapsed:hover {
    transform: translateY(-2px) scale(1.05);
}

.theme-selector.collapsed {
    width: 60px;
    height: 60px;
    padding: 8px;
    cursor: pointer;
}

.theme-selector.collapsed .theme-content {
    display: none;
}

.theme-selector.collapsed .theme-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-selector.collapsed .theme-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.theme-toggle {
    display: none;
}

.theme-content {
    display: block;
}

.theme-selector h3 {
    font-size: 12px;
    color: #2d3748;
    margin: 0 0 8px 0;
    text-align: center;
    font-weight: 700;
}

.theme-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 8px;
}

.theme-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-option:hover {
    transform: scale(1.1);
    border-color: rgba(0,0,0,0.2);
}

.theme-option.active {
    border-color: #2d3748;
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.music-toggle {
    width: 100%;
    background: rgba(45, 55, 72, 0.1);
    border: 1px solid rgba(45, 55, 72, 0.2);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2d3748;
    font-weight: 600;
}

.music-toggle:hover {
    background: rgba(45, 55, 72, 0.2);
    transform: translateY(-1px);
}

.music-toggle.playing {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #059669;
}

.theme-option[data-theme="default"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.theme-option[data-theme="christmas"] {
    background: linear-gradient(135deg, #c41e3a 0%, #228b22 50%, #ffd700 100%);
}

.theme-option[data-theme="tet"] {
    background: linear-gradient(135deg, #dc143c 0%, #ffd700 50%, #ff1493 100%);
}

.theme-option[data-theme="mid-autumn"] {
    background: linear-gradient(135deg, #4169e1 0%, #ffd700 50%, #ff8c00 100%);
}

/* Theme icons */
.theme-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.theme-option[data-theme="default"]::after {
    content: '🎮';
}

.theme-option[data-theme="christmas"]::after {
    content: '🎄';
}

.theme-option[data-theme="tet"]::after {
    content: '🧧';
}

.theme-option[data-theme="mid-autumn"]::after {
    content: '🥮';
}

/* Close button for expanded theme selector */
.theme-close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
}

.theme-close:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff0000;
    transform: scale(1.1);
}

.theme-selector.collapsed .theme-close {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .theme-selector {
        bottom: 90px; /* Tăng từ 10px lên 90px để tránh bottom nav */
        left: 10px;
        padding: 8px;
    }
    
    .theme-selector.collapsed {
        width: 50px;
        height: 50px;
    }
    
    .theme-option {
        width: 28px;
        height: 28px;
    }
    
    .theme-option::after {
        font-size: 12px;
    }
    
    .music-toggle {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .theme-close {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* Apply theme colors to body background */
body {
    background: var(--primary-gradient) !important;
}