/* ─── Accent color (override for playlist) ─────────────── */
:root {
  --accent-teal: #00aacb;
}

/* ─── Audio Playlist Section ────────────────────────────── */

.playlist-section {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.playlist-header h3 {
    font-size: 0.95rem;
    color: var(--accent-gold);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.playlist-header .section-icon {
    font-size: 1.1rem;
}

.playlist-header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-teal);
    text-decoration: none;
    background: rgba(0, 170, 203, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    transition: background 0.2s, transform 0.1s;
}

.playlist-header-btn:hover {
    background: rgba(0, 170, 203, 0.2);
}

.playlist-header-btn:active {
    transform: scale(0.95);
}

/* Collapse toggle button */
.playlist-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: color 0.2s, background 0.2s;
}
.playlist-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}
.playlist-toggle-btn .toggle-icon {
    transition: transform 0.25s;
    display: block;
}

/* Collapsed state */
.playlist-collapsed .playlist-card {
    display: none;
}

.playlist-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Track Card ───────────────────────────────────────── */

.playlist-card {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.3s;
}

.playlist-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Track Row (art + info + controls) */
.playlist-track-row {
    display: flex;
    align-items: center;
    gap: 12px;
    direction: ltr;
}

.playlist-album-art {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.playlist-album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-art-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    font-size: 1.3rem;
}

.playlist-track-info {
    flex: 1;
    min-width: 0;
    direction: rtl;
}

.playlist-track-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-track-artist {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.playlist-track-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.playlist-prev-btn, .playlist-next-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.playlist-prev-btn:hover, .playlist-next-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.playlist-prev-btn:active, .playlist-next-btn:active {
    transform: scale(0.9);
}

.playlist-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent-gold);
    color: #1a2c38;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(251, 139, 36, 0.3);
}

.playlist-play-btn:active {
    transform: scale(0.9);
}

/* Progress Bar */
.playlist-progress-wrapper {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: -4px;
}

.playlist-progress-fill {
    height: 100%;
    background: var(--accent-gold);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s linear;
}

/* ─── Compact Settings Bar ─────────────────────────────── */

.playlist-settings {
    display: block;
}

.settings-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    direction: rtl;
    flex-wrap: nowrap;
    overflow: hidden;
}

.setting-icon-inline {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.autoplay-label-inline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dependency dropdowns container */
.dep-selects {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Dropdowns ────────────────────────────────────────── */

.glass-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 6px;
    font-size: 0.78rem;
    color: var(--text-primary);
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    direction: rtl;
    background-repeat: no-repeat;
    background-position: left 6px center;
}

.glass-select:focus {
    outline: none;
    border-color: var(--accent-teal);
    background: rgba(255, 255, 255, 0.1);
}

.glass-select option {
    background: #1a2c38;
    color: var(--text-primary);
}

/* ─── Autoplay Status ──────────────────────────────────── */

.playlist-autoplay-status {
    font-size: 0.72rem;
    color: var(--accent-teal);
    opacity: 0.9;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-autoplay-status:empty {
    display: none;
}

/* ─── Mini Prev/Next Track Buttons ────────────────────── */

.playlist-track-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.playlist-prev-btn,
.playlist-next-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.playlist-prev-btn:hover,
.playlist-next-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.playlist-prev-btn:active,
.playlist-next-btn:active {
    transform: scale(0.88);
}

/* ─── Toggle Switch (shared) ───────────────────────────── */

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch.toggle-sm {
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-teal);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch.toggle-sm input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* ─── Multi-state Segmented Control (Loop Setting) ─────── */

.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control input[type="radio"]:checked + label {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.loop-setting {
    display: flex;
    align-items: center;
}

/* ─── Choice Chips ───────────────────────────── */
.autoplay-choice-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}

.autoplay-choice-chip input[type="checkbox"] {
    display: none;
}

.autoplay-choice-chip.active {
    background: rgba(0, 170, 203, 0.15);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}


/* ══════════════════════════════════════════════════════════════
   MCP — Main-page cPlayer-inspired mini player + dropdown
   ══════════════════════════════════════════════════════════════ */

/* ── Section shell ─────────────────────────────────────── */
.playlist-section {
    padding: 14px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

/* ── Section header ────────────────────────────────────── */
.playlist-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.playlist-section-title {
    font-size: 0.92rem;
    color: var(--accent-gold, #D5AD6D);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.playlist-section-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

/* ── Icon buttons (list + advanced player link) ─────────── */
.mcp-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--accent-teal, #00aacb);
    text-decoration: none;
    background: rgba(0, 170, 203, 0.08);
    border: 1px solid rgba(0, 170, 203, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    line-height: 1;
    white-space: nowrap;
}

.mcp-icon-btn:hover {
    background: rgba(0, 170, 203, 0.16);
    border-color: rgba(0, 170, 203, 0.3);
}

.mcp-icon-btn:active { transform: scale(0.95); }

/* Active / pressed state — cplayer list button "selected" feel */
.mcp-list-btn[aria-pressed="true"],
.mcp-list-btn.active {
    background: rgba(0, 170, 203, 0.18);
    border-color: var(--accent-teal, #00aacb);
    color: var(--accent-teal, #00aacb);
}

/* ── Mini-player mainbody ──────────────────────────────── */
.mcp-mainbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════════
   MCP Dropdown — cplayer cp-drop-down-menu × dark glass skin
   Slides from height:0 → auto below the mainbody card
   ══════════════════════════════════════════════════════════════ */

.mcp-dropdown {
    /* cplayer: height: 0, overflow: hidden, transition height */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    direction: rtl;

    background: linear-gradient(
        180deg,
        #1a3c46 0% 0%,
        hsla(216, 32%, 5%, 0.99) 100%
    );
    backdrop-filter: blur(28px) saturate(1.7);
    -webkit-backdrop-filter: blur(28px) saturate(1.7);

    border-top: 1px solid rgba(255, 255, 255, 0.
04);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;

    /* cplayer uses box-shadow(1) — we use a subtle glow */
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 170, 203, 0.06) inset;

    transition:
        max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.28s ease;
}

.mcp-dropdown.open {
    max-height: 500px;
    opacity: 1;
    pointer-events: auto;
}

/* ── Info row (cplayer cp-audio-info — title · artist) ─── */
.mcp-dd-info-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 8px 14px 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.038);
    min-width: 0;
    overflow: hidden;
}

/* Title: bold, full opacity */
.mcp-dd-title {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--text-primary, #eee);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 60px;
    max-width: 190px;
    letter-spacing: 0.01em;
}

/* Separator dot */
.mcp-dd-dot {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}

/* Artist: gold, dimmed (cplayer: opacity 0.6) */
.mcp-dd-artist {
    font-size: 0.71rem;
    color: var(--gold, #D5AD6D);
    opacity: 0.65;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    flex: 1;
    min-width: 0;
}

/* Track count badge */
.mcp-dd-count {
    flex-shrink: 0;
    margin-right: auto;      /* push to far end in RTL */
    margin-left: 0;
    font-size: 0.62rem;
    color: var(--accent-teal, #00aacb);
    opacity: 0.55;
    background: rgba(0, 170, 203, 0.09);
    border-radius: 10px;
    padding: 1px 6px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* ── Playlist <ul> — cplayer .cp-playlist ──────────────── */
.mcp-playlist {
    list-style: none;
    margin: 0;
    padding: 3px 0 2px;
    overflow-y: auto;
    max-height: 240px;
    scroll-behavior: smooth;
}

/* Thin gold scrollbar (cplayer-inspired) */
.mcp-playlist::-webkit-scrollbar { width: 2px; }
.mcp-playlist::-webkit-scrollbar-track { background: transparent; }
.mcp-playlist::-webkit-scrollbar-thumb {
    background: rgba(213, 173, 109, 0.3);
    border-radius: 2px;
}

/* ── Track row — mirrors cplayer's li in .cp-playlist ───── */
.mcp-track-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.024);
    direction: rtl;
    position: relative;
    /* Left accent line — hidden until active */
    border-right: 2px solid transparent;  /* RTL: right = visual-left */
    transition:
        background 0.18s ease,
        border-right-color 0.18s ease;
}

.mcp-track-item:last-child { border-bottom: none; }

.mcp-track-item:hover {
    background: rgba(255, 255, 255, 0.028);
}

/* Active: gold gradient + teal right-border (RTL accent bar) */
.mcp-track-item.active {
    background: linear-gradient(
        270deg,          /* RTL: accent on right side */
        rgba(213, 173, 109, 0.08) 0%,
        transparent 100%
    );
    border-right-color: var(--accent-teal, #00aacb);
}

/* ── Play triangle (cplayer .cp-play-icon in li) ────────── */
.mcp-play-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-teal, #00aacb);
    opacity: 0;
    transition: opacity 0.18s;
}

.mcp-track-item.active .mcp-play-icon {
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(0, 170, 203, 0.7));
}

/* Index number shown when row is NOT active */
.mcp-track-index {
    flex-shrink: 0;
    width: 16px;
    font-size: 0.63rem;
    color: var(--text-secondary, #888);
    opacity: 0.3;
    text-align: center;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    transition: opacity 0.18s;
}

.mcp-track-item.active .mcp-track-index { opacity: 0; }

/* Two-liners: title + artist (cplayer two-line li) */
.mcp-track-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mcp-track-name {
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--text-primary, #eee);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.18s;
}

/* cp-playlist-artist: opacity 0.46 */
.mcp-track-artist {
    font-size: 0.66rem;
    color: var(--text-secondary, #aaa);
    opacity: 0.48;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mcp-track-item.active .mcp-track-name {
    color: var(--gold, #D5AD6D);
    font-weight: 600;
}

.mcp-track-item.active .mcp-track-artist {
    opacity: 0.72;
    color: rgba(213, 173, 109, 0.8);
}

/* Duration */
.mcp-track-duration {
    flex-shrink: 0;
    font-size: 0.63rem;
    color: var(--text-secondary, #888);
    opacity: 0.4;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    min-width: 28px;
    text-align: left;
}

/* Delete ghost button */
.mcp-track-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-secondary, #aaa);
    opacity: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.14s, background 0.14s, color 0.14s;
}

.mcp-track-item:hover .mcp-track-delete { opacity: 0.35; }

.mcp-track-delete:hover {
    opacity: 1 !important;
    background: rgba(255, 60, 60, 0.15);
    color: #ff6060;
}

/* ── Add-track form ─────────────────────────────────────── */
.mcp-add-form {
    padding: 8px 14px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.038);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.mcp-add-hint {
    font-size: 0.65rem;
    color: var(--text-secondary, #888);
    opacity: 0.55;
    margin: 0;
    line-height: 1.4;
    direction: rtl;
}

.mcp-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* URL full-width, title + artist split 50/50 */
.mcp-add-row input[type="url"]  { flex: 1 0 100%; }
.mcp-add-row input[type="text"] { flex: 1 1 calc(50% - 4px); }

.mcp-add-row input {
    background: rgba(255, 255, 255, 0.042);
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.72rem;
    color: var(--text-primary, #eee);
    font-family: 'Vazirmatn', sans-serif;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.mcp-add-row input:focus {
    border-color: rgba(0, 170, 203, 0.38);
    background: rgba(0, 170, 203, 0.045);
}

.mcp-add-row input::placeholder {
    color: var(--text-secondary, #888);
    opacity: 0.38;
    font-size: 0.68rem;
}

.mcp-add-submit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid rgba(213, 173, 109, 0.18);
    color: var(--gold, #D5AD6D);
    opacity: 0.7;
    border-radius: 8px;
    padding: 5px 13px;
    font-size: 0.71rem;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    align-self: flex-start;
    letter-spacing: 0.02em;
}

.mcp-add-submit:hover {
    background: rgba(213, 173, 109, 0.1);
    opacity: 1;
}

.mcp-add-submit:active { transform: scale(0.94); }
