/* ============================================================
   Musikaa Player v1.0.0 — player.css
   Todas as cores via CSS custom properties (geradas pelo PHP)
   ============================================================ */

/* ---- WRAPPER GERAL ---- */
.mkp-wrapper {
    display: flex;
    width: 100%;
    background: var(--mkp-list-bg, #111);
    border-radius: var(--mkp-list-radius, 12px);
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: relative;
}

/* ============================================================
   LAYOUTS
   ============================================================ */

/* Side: player esquerda, lista direita */
.mkp-layout-side {
    flex-direction: row;
}
.mkp-layout-side .mkp-player-area { flex: 1; min-width: 0; }
.mkp-layout-side .mkp-list-area   { width: var(--mkp-list-width, 300px); flex-shrink: 0; border-left: 1px solid var(--mkp-list-border, #1e1e1e); }

/* Bottom: player em cima, lista embaixo */
.mkp-layout-bottom {
    flex-direction: column;
}
.mkp-layout-bottom .mkp-list-area { border-top: 1px solid var(--mkp-list-border, #1e1e1e); max-height: 280px; }

/* Top: lista em cima, player embaixo */
.mkp-layout-top {
    flex-direction: column-reverse;
}
.mkp-layout-top .mkp-list-area { border-bottom: 1px solid var(--mkp-list-border, #1e1e1e); max-height: 280px; }

/* Cinema: player grande, lista compacta horizontal */
.mkp-layout-cinema {
    flex-direction: column;
}
.mkp-layout-cinema .mkp-list-area {
    border-top: 1px solid var(--mkp-list-border, #1e1e1e);
    max-height: 120px;
}
.mkp-layout-cinema .mkp-list-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    gap: 8px;
}
.mkp-layout-cinema .mkp-item {
    flex-direction: column;
    min-width: 120px;
    max-width: 120px;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 6px;
    border-radius: 6px;
}
.mkp-layout-cinema .mkp-item--active {
    border-bottom-color: var(--mkp-list-accent, #e63946);
}
.mkp-layout-cinema .mkp-item-thumb {
    width: 100%;
    height: 60px;
    margin-bottom: 4px;
}
.mkp-layout-cinema .mkp-item-info { flex-direction: column; }
.mkp-layout-cinema .mkp-item-num  { display: none; }

/* Player only (sem lista) */
.mkp-layout-player .mkp-list-area { display: none; }

/* ============================================================
   ÁREA DO PLAYER
   ============================================================ */
.mkp-player-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    background: var(--mkp-player-bg, #000);
}

.mkp-player-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--mkp-player-radius, 0px);
    overflow: hidden;
}

/* Ratio box — mantém proporção */
.mkp-ratio-box {
    position: relative;
    width: 100%;
    padding-top: var(--mkp-ratio-pt, 56.25%);
    background: #000;
    overflow: hidden;
}

.mkp-ratio-box iframe,
.mkp-ratio-box video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Placeholder antes do primeiro vídeo */
.mkp-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #050505;
    cursor: pointer;
    transition: background 0.2s;
}
.mkp-placeholder:hover { background: #0a0a0a; }
.mkp-placeholder svg   { opacity: 0.6; }

/* ============================================================
   CONTROLES CUSTOMIZADOS
   ============================================================ */
.mkp-controls {
    background: var(--mkp-controls-bg, rgba(0,0,0,0.75));
    padding: 6px 12px 8px;
}

.mkp-ctrl-bar { display: flex; flex-direction: column; gap: 4px; }

/* Progresso */
.mkp-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mkp-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}
.mkp-progress:hover { height: 6px; margin-top: -1px; }

.mkp-progress-fill {
    height: 100%;
    background: var(--mkp-player-accent, #e63946);
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
    transition: width 0.3s linear;
}

.mkp-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--mkp-player-accent, #e63946);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.mkp-progress:hover .mkp-progress-thumb { opacity: 1; }

.mkp-time {
    display: flex;
    gap: 3px;
    font-size: 11px;
    color: var(--mkp-player-text, #fff);
    opacity: 0.7;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Linha de botões */
.mkp-ctrl-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mkp-ctrl-spacer { flex: 1; }

.mkp-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--mkp-player-text, #fff);
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.mkp-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

.mkp-btn-play {
    width: 32px;
    height: 32px;
    background: var(--mkp-player-accent, #e63946);
    border-radius: 50%;
    opacity: 1;
}
.mkp-btn-play:hover { filter: brightness(1.15); background: var(--mkp-player-accent, #e63946); }

/* Volume */
.mkp-volume-wrap { display: flex; align-items: center; gap: 4px; }

.mkp-volume-slider {
    width: 70px;
    height: 4px;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}
.mkp-volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--mkp-player-text, #fff);
}

/* Speed */
.mkp-speed-wrap { position: relative; }
.mkp-btn-speed  { font-size: 11px; font-weight: 700; min-width: 28px; color: var(--mkp-player-text, #fff); }
.mkp-speed-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: hidden;
    z-index: 10;
    min-width: 60px;
}
.mkp-speed-opt {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #ccc;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    text-align: center;
}
.mkp-speed-opt:hover    { background: rgba(255,255,255,0.08); color: #fff; }
.mkp-speed-active       { color: var(--mkp-player-accent, #e63946); font-weight: 700; }

/* Now playing */
.mkp-now-playing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--mkp-list-bg, #111);
    border-top: 1px solid var(--mkp-list-border, #1e1e1e);
    min-height: 44px;
}
.mkp-np-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mkp-list-accent, #e63946);
    flex-shrink: 0;
}
.mkp-np-title {
    font-size: 13px;
    color: var(--mkp-list-text, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   LISTA
   ============================================================ */
.mkp-list-area {
    display: flex;
    flex-direction: column;
    background: var(--mkp-list-bg, #111);
    overflow: hidden;
}

.mkp-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--mkp-list-border, #1e1e1e);
    flex-shrink: 0;
}
.mkp-list-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--mkp-list-text, #fff);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.mkp-list-count { font-size: 11px; color: var(--mkp-list-text-sub, #aaa); }

.mkp-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a var(--mkp-list-bg, #111);
}
.mkp-list-scroll::-webkit-scrollbar       { width: 4px; }
.mkp-list-scroll::-webkit-scrollbar-track { background: var(--mkp-list-bg, #111); }
.mkp-list-scroll::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

/* Item */
.mkp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px 7px 10px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s;
}
.mkp-item:hover       { background: rgba(255,255,255,0.04); }
.mkp-item--active     { background: var(--mkp-list-active, #161616); border-left-color: var(--mkp-list-accent, #e63946); }

.mkp-item-thumb {
    width: var(--mkp-thumb-w, 56px);
    height: var(--mkp-thumb-h, 36px);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: #1e1e1e;
}
.mkp-item-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.mkp-item-thumb-ph  {
    width:100%; height:100%;
    display:flex; align-items:center; justify-content:center;
    color: #444;
}
.mkp-item-overlay {
    position:absolute; inset:0;
    display:flex; align-items:center; justify-content:center;
    background:rgba(0,0,0,0.5);
    opacity:0; transition:opacity 0.12s;
}
.mkp-item:hover .mkp-item-overlay,
.mkp-item--active .mkp-item-overlay { opacity:1; }

.mkp-item-info {
    flex:1; min-width:0;
    display:flex; align-items:flex-start; gap:8px;
}
.mkp-item-num {
    font-size:10px; color: var(--mkp-list-text-sub,#555);
    flex-shrink:0; line-height:1.4; margin-top:2px;
    font-variant-numeric:tabular-nums;
}
.mkp-item--active .mkp-item-num { color: var(--mkp-list-accent,#e63946); }

.mkp-item-meta { display:flex; flex-direction:column; gap:2px; min-width:0; }
.mkp-item-title {
    font-size:12px; font-weight:500;
    color: var(--mkp-list-text-sub,#aaa);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    transition:color 0.12s;
}
.mkp-item--active .mkp-item-title,
.mkp-item:hover   .mkp-item-title { color: var(--mkp-list-text,#fff); }

.mkp-item-sub {
    font-size:10px; color: var(--mkp-list-text-sub,#555);
    display:flex; align-items:center; gap:4px; opacity:0.7;
}

.mkp-empty { padding:12px; color: var(--mkp-list-text-sub,#888); font-size:13px; }

/* ============================================================
   BARRA PERSISTENTE
   ============================================================ */
.mkp-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--mkp-bar-height, 72px);
    background: var(--mkp-bar-bg, #0f0f0f);
    border-top: 1px solid rgba(255,255,255,0.07);
    z-index: 99999;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Mini vídeo */
.mkp-bar-video {
    width: var(--mkp-bar-video-w, 120px);
    height: calc(var(--mkp-bar-height, 72px) - 8px);
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    display: none;
}
.mkp-bar-iframe-wrap { width:100%; height:100%; }
.mkp-bar-toggle-video {
    position:absolute; top:4px; right:4px;
    background:rgba(0,0,0,0.6); border:none;
    border-radius:3px; color:#fff; cursor:pointer;
    padding:3px; display:flex;
}

/* Thumbnail */
.mkp-bar-thumb {
    width: 46px; height: 46px;
    border-radius: 6px; overflow: hidden;
    flex-shrink: 0; background: #1e1e1e;
    display: flex; align-items: center; justify-content: center;
}
.mkp-bar-thumb-ph { display:flex; align-items:center; justify-content:center; width:100%; height:100%; }

/* Info */
.mkp-bar-info { flex:1; min-width:0; }
.mkp-bar-title {
    display:block; font-size:13px; font-weight:600;
    color: var(--mkp-bar-text,#fff);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.mkp-bar-sub {
    display:block; font-size:11px;
    color: var(--mkp-bar-text-sub,#888);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    margin-top:2px;
}

/* Controles */
.mkp-bar-controls { display:flex; align-items:center; gap:6px; flex-shrink:0; }

.mkp-bar-btn {
    background:none; border:none; cursor:pointer;
    color: var(--mkp-bar-text-sub,#888);
    padding:6px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    transition:color 0.15s, background 0.15s;
}
.mkp-bar-btn:hover { color: var(--mkp-bar-text,#fff); background:rgba(255,255,255,0.08); }

.mkp-bar-btn-play {
    width:36px; height:36px;
    background: var(--mkp-bar-accent,#e63946);
    color:#fff; border-radius:50%; opacity:1;
}
.mkp-bar-btn-play:hover { filter:brightness(1.15); background: var(--mkp-bar-accent,#e63946); color:#fff; }

/* Progress */
.mkp-bar-progress-wrap { flex:1; max-width:280px; min-width:60px; }
.mkp-bar-progress {
    width:100%; height:3px;
    background:rgba(255,255,255,0.15);
    border-radius:2px; cursor:pointer; position:relative;
}
.mkp-bar-progress-fill {
    height:100%; background: var(--mkp-bar-accent,#e63946);
    border-radius:2px; width:0%;
    transition:width 0.5s linear; pointer-events:none;
}

/* Volume */
.mkp-bar-volume { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.mkp-bar-volume svg { color: var(--mkp-bar-text-sub,#888); }
.mkp-bar-volume-slider {
    width:70px; height:3px;
    appearance:none; background:rgba(255,255,255,0.15);
    border-radius:2px; cursor:pointer; outline:none;
}
.mkp-bar-volume-slider::-webkit-slider-thumb {
    appearance:none; width:10px; height:10px;
    border-radius:50%; background: var(--mkp-bar-text,#fff);
}

.mkp-bar-close { opacity:0.4; }
.mkp-bar-close:hover { opacity:1; }

/* SPA progress bar */
#mkp-spa-progress {
    position:fixed; top:0; left:0;
    height:2px; background: var(--mkp-bar-accent,#e63946);
    width:0%; z-index:99999;
    transition:width 0.3s ease, opacity 0.3s;
    opacity:0;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width:768px) {
    .mkp-layout-side   { flex-direction:column; }
    .mkp-layout-side .mkp-list-area {
        width:100%; border-left:none;
        border-top:1px solid var(--mkp-list-border,#1e1e1e);
        max-height:240px;
    }
    .mkp-bar-progress-wrap { display:none; }
    .mkp-bar-volume        { display:none; }
    .mkp-bar-btn-speed     { display:none; }
}

@media (max-width:480px) {
    .mkp-layout-side .mkp-list-area,
    .mkp-layout-bottom .mkp-list-area { max-height:200px; }
    .mkp-volume-wrap { display:none; }
}
