/* ============================================
   COMMON STYLES (Dùng chung cho tất cả themes)
   ============================================ */

body {
    font-family: 'Inter', sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Tab Active (giống nhau cho cả 2 theme) */
.tab-active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 
        0 4px 16px rgba(99, 102, 241, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-active:hover {
    box-shadow: 
        0 6px 20px rgba(99, 102, 241, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Buttons */
button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
button:active {
    transform: scale(0.95);
}

/* Input fields base styles */
input[type="text"],
input[type="number"],
input[type="range"],
select,
textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accent gradient */
.accent-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.accent-gradient:hover {
    box-shadow: 
        0 8px 24px rgba(99, 102, 241, 0.4),
        0 0 16px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}


/* Smooth scroll */
* {
    scroll-behavior: smooth;
}

/* Control buttons */
.control-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.control-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.control-btn:active {
    transform: scale(1.05);
}

/* Theme toggle icon */
#themeToggleIcon {
    cursor: pointer;
    transition: transform 0.3s ease;
}
#themeToggleIcon:hover {
    transform: scale(1.1) rotate(15deg);
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Waveform Visualization */
.waveform {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3px;
    height: 48px;
    width: 100%;
}

.wave-bar {
    flex: 1;
    min-width: 1.5px;
    max-width: 2.5px;
    min-height: 4px;
    background: linear-gradient(to top, #6366f1, #8b5cf6, #a855f7);
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.05s);
    box-shadow: 0 0 4px rgba(99, 102, 241, 0.3);
}

@keyframes wave {
    0%, 100% {
        height: 20%;
        opacity: 0.6;
    }
    50% {
        height: 100%;
        opacity: 1;
    }
}

/* Randomize wave heights for more natural look */
.wave-bar:nth-child(odd) {
    animation-duration: 1s;
}

.wave-bar:nth-child(even) {
    animation-duration: 1.4s;
}

.wave-bar:nth-child(3n) {
    animation-duration: 0.8s;
}

/* Light theme waveform */
[data-theme="light"] .wave-bar {
    background: linear-gradient(to top, #4f46e5, #7c3aed, #9333ea);
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
}

/* 2. Smooth Fade-in for Tab Content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.3s ease-out;
}

/* 3. Pulse Animation for Loading Buttons */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.button-loading {
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
    position: relative;
}

.button-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 4. Slide-in Animation for Cards */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

/* Stagger animation delays for multiple cards */
.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card:nth-child(4) {
    animation-delay: 0.4s;
}

.card:nth-child(5) {
    animation-delay: 0.5s;
}

/* Glass card also gets animation */
.glass-card {
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.glass-card:nth-of-type(1) {
    animation-delay: 0.1s;
}

.glass-card:nth-of-type(2) {
    animation-delay: 0.2s;
}

.glass-card:nth-of-type(3) {
    animation-delay: 0.3s;
}

.glass-card:nth-of-type(4) {
    animation-delay: 0.4s;
}

.glass-card:nth-of-type(5) {
    animation-delay: 0.5s;
}

/* Vinyl record spinning animation */
#albumArtThumb.vinyl-spinning {
    animation: vinylSpin 10s linear infinite !important;
    transform-origin: center center !important;
}

@keyframes vinylSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
