/* Morse Code Translator Custom Styles */

/* Loading Overlay Flexbox Fix */
#loadingOverlay.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Range Slider Customization */

input[type="range"]::-webkit-slider-track {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #3b82f6;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-track {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    background: #3b82f6;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* Visual Flasher Animations */
#visualFlasher {
    transition: all 0.1s ease;
}

#visualFlasher.flash-dot {
    background-color: #fbbf24 !important;
    box-shadow: 0 0 20px #fbbf24;
    transform: scale(1.05);
}

#visualFlasher.flash-dash {
    background-color: #f59e0b !important;
    box-shadow: 0 0 25px #f59e0b;
    transform: scale(1.1);
}

#visualFlasher.flash-off {
    background-color: #e5e7eb !important;
    box-shadow: none;
    transform: scale(1);
}

/* Message Animations */
.message {
    animation: slideIn 0.3s ease-out;
    border-left-width: 4px;
}

.message.success {
    background-color: #f0fdf4;
    border-left-color: #16a34a;
    color: #15803d;
}

.message.error {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    color: #dc2626;
}

.message.warning {
    background-color: #fffbeb;
    border-left-color: #d97706;
    color: #d97706;
}

.message.info {
    background-color: #eff6ff;
    border-left-color: #2563eb;
    color: #2563eb;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Learning Cards */
.learning-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

.learning-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.learning-card.active {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.learning-card .character {
    font-size: 2rem;
    font-weight: bold;
    color: #1f2937;
}

.learning-card .morse {
    font-family: "Courier New", monospace;
    font-size: 1.5rem;
    color: #3b82f6;
    font-weight: bold;
}

/* Practice Mode */
.practice-item {
    transition: all 0.3s ease;
    opacity: 0.6;
}

.practice-item.active {
    opacity: 1;
    transform: scale(1.02);
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.practice-item.correct {
    border-color: #16a34a;
    background-color: #f0fdf4;
}

.practice-item.incorrect {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.practice-progress {
    transition: width 0.3s ease;
}

/* Audio Progress Bar */
.audio-progress {
    position: relative;
    background-color: #e5e7eb;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.audio-progress-bar {
    background-color: #3b82f6;
    height: 100%;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* Copy Button Animation */
.copy-success {
    color: #16a34a !important;
    animation: copyPulse 0.3s ease;
}

@keyframes copyPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive Text Sizing */
@media (max-width: 640px) {
    .learning-card .character {
        font-size: 1.5rem;
    }

    .learning-card .morse {
        font-size: 1.2rem;
    }

    #visualFlasher {
        width: 100px;
        height: 100px;
    }
}

/* Button Loading States */
.button-loading {
    position: relative;
    color: transparent !important;
}

.button-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Validation Indicators */
.validation-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.validation-indicator.valid {
    background-color: #16a34a;
    color: white;
}

.validation-indicator.invalid {
    background-color: #dc2626;
    color: white;
}

/* Statistics Cards */
.stats-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}

.stats-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e293b;
}

.stats-label {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Morse Code Display Enhancement */
.morse-display {
    font-family: "Courier New", monospace;
    letter-spacing: 0.1em;
    line-height: 1.6;
}

.morse-dot {
    color: #3b82f6;
}

.morse-dash {
    color: #1d4ed8;
}

.morse-separator {
    color: #6b7280;
}

/* Reference Table Styling */
.reference-table {
    font-family: "Courier New", monospace;
}

.reference-table .character {
    font-weight: bold;
    color: #1f2937;
}

.reference-table .morse-code {
    color: #3b82f6;
    font-weight: bold;
}

/* SOS Button Special Styling */
#quickSOS {
    position: relative;
    overflow: hidden;
}

#quickSOS:hover {
    animation: sosFlash 0.5s ease-in-out infinite alternate;
}

@keyframes sosFlash {
    0% {
        box-shadow: 0 0 5px #dc2626;
    }
    100% {
        box-shadow: 0 0 20px #dc2626;
    }
}

/* Tooltip Styling */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .quick-actions {
        flex-direction: column;
        gap: 8px;
    }

    .quick-actions button {
        width: 100%;
    }

    .audio-controls {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    #quickSOS,
    #quickClear,
    #quickSwap,
    #learningMode,
    #practiceMode,
    .audio-controls,
    #visualFlasher {
        display: none !important;
    }

    .reference-table {
        break-inside: avoid;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .visual-flasher {
        border: 2px solid currentColor;
    }

    .learning-card,
    .practice-item {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    #visualFlasher {
        transition: background-color 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.learning-card:focus-visible,
.practice-item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Dark Mode Support (Future-proofing) */
@media (prefers-color-scheme: dark) {
    /* Note: Currently using light theme only as requested,
       but this section is ready for future dark mode implementation */
}
