/* ── Kap Audio Player ───────────────────────────────────────────────────────
   Custom lightweight player styled to match Koran-Kareem theme.
   Colours: warm beige (#f8f3ec), orange accent (#c45c27), muted brown text.
   Supports RTL (Arabic) and is fully responsive.
──────────────────────────────────────────────────────────────────────────── */

.kap-player-box {
    background: #fff;
    border: 1px solid #dfd4c8;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(43, 18, 7, 0.09);
    overflow: hidden;
    font-size: 13px;
    line-height: 1.4;
    color: #3d2b1f;
    max-width: 100%;
}

/* ── control bar ── */
.kap-bar {
    background: #f8f3ec;
    border-bottom: 1px solid #ebe0d4;
    padding: 12px 14px 10px;
    -webkit-user-select: none;
    user-select: none;
}

/* track title + clock */
.kap-track-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    min-height: 18px;
}

.kap-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 13px;
    color: #3d2b1f;
}

.kap-clock {
    flex-shrink: 0;
    font-size: 12px;
    color: #7a6658;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* seek / progress bar */
.kap-seek-wrap {
    position: relative;
    height: 5px;
    background: #e2d4c4;
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 11px;
    overflow: hidden;
}

.kap-seek-wrap:hover { height: 7px; margin-bottom: 9px; }

.kap-seek-loaded,
.kap-seek-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    pointer-events: none;
    width: 0;
}

.kap-seek-loaded { background: #c9b5a0; }
.kap-seek-played { background: #c45c27; z-index: 1; }

/* RTL: seek grows from the right */
html[dir="rtl"] .kap-seek-loaded,
html[dir="rtl"] .kap-seek-played {
    left: auto;
    right: 0;
}

/* controls row */
.kap-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
}

.kap-btn {
    background: none;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #4a3427;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, color 0.14s;
    flex-shrink: 0;
}

.kap-btn:hover {
    background: rgba(196, 92, 39, 0.12);
    color: #c45c27;
}

.kap-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    pointer-events: none;
}

/* large play/pause button */
.kap-btn.kap-toggle {
    width: 40px;
    height: 40px;
    background: #c45c27;
    color: #fff;
}

.kap-btn.kap-toggle:hover { background: #a34219; color: #fff; }
.kap-btn.kap-toggle svg   { width: 22px; height: 22px; }

/* active state for loop / shuffle */
.kap-btn.kap-active           { color: #c45c27; }
.kap-btn.kap-active:hover     { background: rgba(196, 92, 39, 0.12); color: #c45c27; }

/* volume group: mute button + range slider */
.kap-vol-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: auto; /* push loop+shuffle to far right */
}

html[dir="rtl"] .kap-vol-group { margin-right: 0; margin-left: auto; }

.kap-volume {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2d4c4;
    border-radius: 2px;
    cursor: pointer;
    accent-color: #c45c27;
    flex-shrink: 0;
}

.kap-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c45c27;
    cursor: pointer;
}

.kap-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c45c27;
    border: none;
    cursor: pointer;
}

/* ── playlist ── */
.kap-list-wrap {
    max-height: 270px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #c9b5a0 #f5f0e8;
}

.kap-list-wrap::-webkit-scrollbar       { width: 5px; }
.kap-list-wrap::-webkit-scrollbar-track { background: #f5f0e8; }
.kap-list-wrap::-webkit-scrollbar-thumb { background: #c9b5a0; border-radius: 3px; }

.kap-playlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kap-playlist li {
    padding: 9px 14px;
    font-size: 13px;
    color: #3d2b1f;
    cursor: pointer;
    border-bottom: 1px solid #f3ede6;
    transition: background 0.1s;
    line-height: 1.5;
}

.kap-playlist li:last-child  { border-bottom: none; }
.kap-playlist li:hover       { background: #fdf5ee; }

.kap-playlist li.kap-active {
    background: #f0e4d8;
    color: #c45c27;
    font-weight: 600;
}

/* hide the inner <a> tags (whole li is clickable) */
.kap-playlist li a {
    pointer-events: none;
    color: inherit;
    text-decoration: none;
}

/* ── footer caption ── */
.kap-footer {
    text-align: center;
    font-size: 11px;
    color: #7a6658;
    padding: 5px 14px;
    background: #f8f3ec;
    border-top: 1px solid #ebe0d4;
}

/* ── responsive ── */
@media (max-width: 480px) {
    .kap-bar          { padding: 10px 10px 8px; }
    .kap-btn          { width: 28px; height: 28px; }
    .kap-btn.kap-toggle { width: 36px; height: 36px; }
    .kap-btn svg      { width: 16px; height: 16px; }
    .kap-btn.kap-toggle svg { width: 20px; height: 20px; }
    .kap-volume       { width: 44px; }
    .kap-title        { font-size: 12px; }
    .kap-list-wrap    { max-height: 200px; }
}
