/* Theme System for Pips Puzzle */

/* Default Theme (existing colors) */
:root {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Halloween Theme */
[data-theme="halloween"] {
    --bg-primary: #1a0f1f;
    --bg-secondary: #2d1b3d;
    --text-primary: #ff8c42;
    --text-secondary: #d4a574;
    --accent-primary: #ff6b35;
    --accent-hover: #ff8c42;
    --border-color: #4a2c4d;
    --shadow: rgba(255, 108, 53, 0.3);

    /* Halloween specific colors */
    --halloween-orange: #ff6b35;
    --halloween-purple: #6b2d5c;
    --halloween-green: #7cb342;
    --halloween-black: #1a0f1f;
}

/* Apply theme colors to body */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Halloween background effects */
[data-theme="halloween"] body {
    background: linear-gradient(135deg, #1a0f1f 0%, #2d1b3d 50%, #1a0f1f 100%);
    background-attachment: fixed;
    position: relative;
}

[data-theme="halloween"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 108, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(107, 45, 92, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Logo Section with Theme Switcher */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme Switcher Button Styles */
.theme-toggle {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    position: relative;
    animation: pumpkinPulse 2s ease-in-out infinite;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color);
    transform: scale(1.1);
    animation: none;
}

.theme-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    display: block;
    animation: pumpkinBounce 2s ease-in-out infinite;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg) scale(1.1);
    animation: none;
}

/* Pumpkin pulse animation */
@keyframes pumpkinPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 108, 53, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 108, 53, 0);
    }
}

/* Pumpkin bounce animation */
@keyframes pumpkinBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-5deg);
    }
    75% {
        transform: translateY(-3px) rotate(5deg);
    }
}

/* Tooltip hint */
.theme-toggle::after {
    content: 'Try Halloween Theme! 🎃';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: linear-gradient(135deg, #ff6b35 0%, #6b2d5c 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-weight: 600;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #ff6b35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.theme-toggle:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(4px);
}

.theme-toggle:hover::before {
    opacity: 1;
}

/* Hide tooltip after first interaction */
.theme-toggle.used::after,
.theme-toggle.used::before {
    display: none;
}

/* Stop animations after button is used */
.theme-toggle.used {
    animation: none;
}

.theme-toggle.used .theme-icon {
    animation: none;
}

/* Theme Notification */
.theme-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    animation: slideInRight 0.4s ease-out;
}

.theme-notification-content {
    background: linear-gradient(135deg, #ff6b35 0%, #6b2d5c 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    position: relative;
}

.theme-notification-icon {
    font-size: 2rem;
    animation: spin 0.6s ease-out;
}

.theme-notification-text {
    flex: 1;
}

.theme-notification-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}

.theme-notification-text p {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.9;
}

.theme-notification-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
    line-height: 1;
}

.theme-notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-notification.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

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

/* Mobile responsive notification */
@media (max-width: 768px) {
    .theme-notification {
        right: 10px;
        left: 10px;
        top: 70px;
    }

    .theme-notification-content {
        max-width: 100%;
    }
}

[data-theme="halloween"] .theme-toggle {
    background: rgba(107, 45, 92, 0.3);
    border-color: var(--halloween-orange);
}

[data-theme="halloween"] .theme-toggle:hover {
    background: var(--halloween-purple);
    box-shadow: 0 0 20px rgba(255, 108, 53, 0.5);
    transform: scale(1.15) rotate(15deg);
}

/* Halloween decorative elements */
[data-theme="halloween"] .pumpkin-decoration {
    position: fixed;
    font-size: 2rem;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* Card/Container styles */
.game-container,
.content,
[class*="container"] {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="halloween"] .game-container,
[data-theme="halloween"] .content {
    box-shadow: 0 4px 20px var(--shadow);
    border: 2px solid var(--border-color);
}

/* Header styles */
[data-theme="halloween"] .main-header {
    background: var(--halloween-black);
    border-bottom: 2px solid var(--halloween-orange);
}

[data-theme="halloween"] .site-title {
    color: var(--halloween-orange);
    text-shadow: 0 0 10px rgba(255, 108, 53, 0.5);
}

[data-theme="halloween"] .nav-link {
    color: var(--text-secondary);
}

[data-theme="halloween"] .nav-link:hover {
    color: var(--halloween-orange);
    background: rgba(255, 108, 53, 0.1);
}

/* Button styles */
[data-theme="halloween"] button,
[data-theme="halloween"] .btn {
    background: var(--halloween-purple);
    color: var(--halloween-orange);
    border-color: var(--halloween-orange);
}

[data-theme="halloween"] button:hover,
[data-theme="halloween"] .btn:hover {
    background: var(--halloween-orange);
    color: var(--halloween-black);
}

/* Game board cells */
[data-theme="halloween"] .cell {
    border-color: var(--halloween-orange);
}

[data-theme="halloween"] .domino {
    background: var(--halloween-purple);
    border-color: var(--halloween-orange);
    box-shadow: 0 2px 8px var(--shadow);
}

/* Spooky text effects */
[data-theme="halloween"] h1,
[data-theme="halloween"] h2,
[data-theme="halloween"] h3 {
    color: var(--halloween-orange);
}

/* Toast/notification styles */
[data-theme="halloween"] .toast,
[data-theme="halloween"] .notification {
    background: var(--halloween-black);
    border: 2px solid var(--halloween-orange);
    color: var(--halloween-orange);
}

/* Floating animations for Halloween elements */
[data-theme="halloween"] .floating-ghost {
    position: fixed;
    font-size: 3rem;
    opacity: 0.2;
    pointer-events: none;
    animation: ghostFloat 10s ease-in-out infinite;
}

@keyframes ghostFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.2;
    }
    25% {
        transform: translate(20px, -30px) scale(1.1);
        opacity: 0.3;
    }
    50% {
        transform: translate(-10px, -20px) scale(0.9);
        opacity: 0.15;
    }
    75% {
        transform: translate(-30px, -40px) scale(1.05);
        opacity: 0.25;
    }
}

/* Dropdown menu styles */
[data-theme="halloween"] .dropdown-menu {
    background: var(--halloween-black);
    border: 2px solid var(--halloween-orange);
}

[data-theme="halloween"] .dropdown-link {
    color: var(--text-secondary);
}

[data-theme="halloween"] .dropdown-link:hover {
    background: var(--halloween-purple);
    color: var(--halloween-orange);
}

/* Form elements */
[data-theme="halloween"] input,
[data-theme="halloween"] select,
[data-theme="halloween"] textarea {
    background: var(--halloween-black);
    color: var(--halloween-orange);
    border-color: var(--halloween-orange);
}

[data-theme="halloween"] input:focus,
[data-theme="halloween"] select:focus,
[data-theme="halloween"] textarea:focus {
    outline: none;
    border-color: var(--halloween-orange);
    box-shadow: 0 0 10px rgba(255, 108, 53, 0.3);
}
