/* Custom animations and styles for RF Band Explorer */

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.6);
    }
}

@keyframes frequency-wave {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes correct-answer {
    0% {
        transform: scale(1);
        background-color: hsl(var(--su));
    }
    50% {
        transform: scale(1.05);
        background-color: hsl(var(--su));
    }
    100% {
        transform: scale(1);
        background-color: hsl(var(--su));
    }
}

@keyframes incorrect-answer {
    0% {
        transform: translateX(0);
        background-color: hsl(var(--er));
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
        background-color: hsl(var(--er));
    }
}

@keyframes level-up {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
    }
    50% {
        transform: scale(1.2) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Spectrum visualizer styles */
.spectrum-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    height: 200px;
}

#spectrumCanvas {
    height: 100%;
    width: 100%;
    border: 2px solid hsl(var(--bc) / 0.2);
    display: block;
    background: #f0f0f0;
}

/* Question animation styles */
.question-content {
    transition: all 0.3s ease-in-out;
}

.answer-btn {
    transition: all 0.2s ease-in-out;
}

.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.answer-btn.correct {
    animation: correct-answer 0.6s ease-in-out;
}

.answer-btn.incorrect {
    animation: incorrect-answer 0.6s ease-in-out;
}

/* Progress bar enhancements */
.progress {
    transition: value 0.3s ease-in-out;
}

/* Spectrum band highlight effect */
.band-highlight {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    animation: pulse-glow 2s infinite;
    pointer-events: none;
}

/* Frequency wave animation */
.frequency-wave {
    position: absolute;
    top: 50%;
    width: 4px;
    height: 60%;
    background: linear-gradient(to bottom, transparent, #fff, transparent);
    transform: translateY(-50%);
    animation: frequency-wave 3s linear infinite;
    pointer-events: none;
}

/* Toast notification styles */
.toast {
    z-index: 1000;
}

.toast .alert {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Level up effect */
.level-up-effect {
    animation: level-up 1s ease-in-out;
}

/* Score increment animation */
.score-increment {
    position: relative;
}

.score-increment::after {
    content: '+' attr(data-increment);
    position: absolute;
    top: -20px;
    right: 0;
    color: hsl(var(--su));
    font-weight: bold;
    animation: scoreFloat 1s ease-out forwards;
    pointer-events: none;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-horizontal {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-value {
        font-size: 1rem !important;
    }
    
    #spectrumCanvas {
        height: 150px;
    }
}

/* Dark theme specific adjustments */
[data-theme="dark"] .spectrum-container {
    border: 2px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #spectrumCanvas {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Light theme specific adjustments */
[data-theme="light"] .spectrum-container {
    border: 2px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] #spectrumCanvas {
    border-color: rgba(0, 0, 0, 0.2);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.answer-btn:focus {
    outline: 2px solid hsl(var(--pf));
    outline-offset: 2px;
}

/* Tab styles */
.tabs {
    margin-bottom: 1.5rem;
}

.tab {
    transition: all 0.2s ease;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-active {
    background: hsl(var(--p));
    color: hsl(var(--pc));
}

/* Spectrum hover effects */
#spectrumCanvas {
    cursor: crosshair;
    transition: all 0.2s ease;
}

#spectrumCanvas:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Application items with icons */
.applications .flex {
    transition: all 0.2s ease;
}

.applications .flex:hover {
    background: hsl(var(--b3));
    transform: translateX(2px);
}

.applications .text-lg {
    filter: grayscale(0.3);
    transition: filter 0.2s ease;
}

.applications .flex:hover .text-lg {
    filter: grayscale(0);
    transform: scale(1.1);
}

/* Print styles */
@media print {
    .navbar,
    .toast,
    .modal,
    #settingsBtn,
    .tabs,
    #bandTooltip {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
    }
}