/* NOTADICTIONARY Audio Player & TTS Component */

.nad-audio-player {
    display: block;
    width: 100%;
    margin: 8px 0 16px 0;
    box-sizing: border-box;
    clear: both;
}

.nad-audio-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

[data-theme="dark"] .nad-audio-pill {
    background: #181c24;
    border-color: #2b3240;
}

.nad-audio-pill:hover {
    border-color: #cbd5e1;
}

[data-theme="dark"] .nad-audio-pill:hover {
    border-color: #3e485a;
}

/* Play/Pause Button */
.nad-audio-btn.nad-audio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2563eb;
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
    user-select: none;
}

.nad-audio-btn.nad-audio-toggle:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.nad-audio-btn.nad-audio-toggle:active {
    transform: translateY(0);
}

.nad-audio-pill.is-playing .nad-audio-btn.nad-audio-toggle {
    background: #dc2626;
}

.nad-audio-pill.is-playing .nad-audio-btn.nad-audio-toggle:hover {
    background: #b91c1c;
}

.nad-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nad-audio-title {
    font-size: 0.86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Spinner */
.nad-spin-svg {
    animation: nadSpinAnim 1s linear infinite;
}

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

/* Equalizer Visualizer */
.nad-audio-eq-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 14px;
    width: 16px;
    flex-shrink: 0;
}

.nad-audio-eq-bars .nad-bar {
    width: 2.5px;
    background: #94a3b8;
    height: 3px;
    border-radius: 1px;
    transition: height 0.2s ease;
}

.nad-audio-pill.is-playing .nad-audio-eq-bars .nad-bar {
    background: #2563eb;
    animation: nadBarBounce 0.7s ease-in-out infinite alternate;
}

.nad-audio-pill.is-playing .nad-audio-eq-bars .nad-bar:nth-child(1) { animation-delay: 0.05s; }
.nad-audio-pill.is-playing .nad-audio-eq-bars .nad-bar:nth-child(2) { animation-delay: 0.25s; }
.nad-audio-pill.is-playing .nad-audio-eq-bars .nad-bar:nth-child(3) { animation-delay: 0.15s; }
.nad-audio-pill.is-playing .nad-audio-eq-bars .nad-bar:nth-child(4) { animation-delay: 0.35s; }

@keyframes nadBarBounce {
    0% { height: 3px; }
    100% { height: 14px; }
}

/* Track and Progress Bar */
.nad-audio-track {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 80px;
}

.nad-audio-progress-bar {
    flex: 1;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

[data-theme="dark"] .nad-audio-progress-bar {
    background: #334155;
}

.nad-audio-progress-fill {
    width: 0%;
    height: 100%;
    background: #2563eb;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.nad-audio-time {
    font-size: 0.78rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
    min-width: 38px;
    text-align: right;
}

[data-theme="dark"] .nad-audio-time {
    color: #94a3b8;
}

/* Speed Button */
.nad-audio-speed-wrap {
    flex-shrink: 0;
}

.nad-audio-speed-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 6px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s ease;
}

[data-theme="dark"] .nad-audio-speed-btn {
    border-color: #475569;
    color: #cbd5e1;
}

.nad-audio-speed-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* Badge */
.nad-audio-lang-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
}

[data-theme="dark"] .nad-audio-lang-badge {
    background: #312e81;
    color: #c7d2fe;
}

/* Mobile responsiveness */
@media (max-width: 580px) {
    .nad-audio-pill {
        flex-wrap: wrap;
        padding: 8px 10px;
    }
    .nad-audio-title {
        max-width: 140px;
    }
    .nad-audio-track {
        order: 10;
        width: 100%;
        margin-top: 4px;
    }
}
