/* ═══════════════════════════════════════════════
   Playlist Page — CapPlayer Android TV Design
   ═══════════════════════════════════════════════ */

#playlist-dashboard {
    --gold: #E2B84B;
    --gold-soft: #D4A843;
    --gold-tint: rgba(226,184,75,0.06);
    --gold-border: rgba(226,184,75,0.4);
    --bg-deep: #06060E;
    --surface: rgba(255,255,255,0.04);
    --glass-bg: rgba(255,255,255,0.04);
    --glass-border: rgba(255,255,255,0.06);
    --text-primary: #F0EDE6;
    --text-secondary: rgba(240,237,230,0.5);
    --text-tertiary: rgba(240,237,230,0.28);
    --focus-color: #E2B84B;
    --green: #4CAF50;
    --red: #DC5050;
    --red-tint: rgba(220,80,80,0.1);

    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    font-family: 'Inter', -apple-system, 'Segoe UI', Arial, sans-serif;
    color: var(--text-primary);
    overflow: hidden;
}

/* Background */
#playlist-dashboard .pld-bg-image {
    position: absolute;
    inset: 0;
    background: url('../images/background_violet.png') center/cover no-repeat;
    z-index: 0;
}
#playlist-dashboard .pld-bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4,2,10,0.78);
    z-index: 1;
}

/* ─── Two-column layout: content left + QR right ─── */
.pld-left {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 28px 24px 40px 48px;
    z-index: 2;
}
.pld-right {
    width: 210px;
    min-width: 210px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 2;
    background: rgba(255,255,255,0.03);
    border-left: 1px solid var(--glass-border);
    padding: 20px;
}

/* ─── Header ─── */
.pld-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.pld-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}
.pld-btn-refresh {
    padding: 8px 18px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pld-btn-refresh.focused {
    background: rgba(226,184,75,0.08);
    border-color: var(--gold-border);
    color: var(--gold);
    transform: scale(1.05);
}
.pld-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ─── Add Playlist Button ─── */
.pld-add-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 2px dashed rgba(255,255,255,0.13);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 18px;
}
.pld-add-btn .pld-add-icon {
    font-size: 20px;
    color: var(--gold);
}
.pld-add-btn .pld-add-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
}
.pld-add-btn.focused {
    background: rgba(226,184,75,0.06);
    border-color: var(--gold);
    transform: scale(1.02);
}

/* ─── Active Playlist Card ─── */
.pld-active-card {
    border-radius: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 16px;
    margin-bottom: 20px;
}
.pld-active-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.pld-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}
.pld-active-dot.broken { background: var(--red); }
.pld-active-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.pld-active-label.broken { color: var(--red); }
.pld-active-name {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.pld-active-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(226,184,75,0.1);
    border: 1px solid rgba(226,184,75,0.3);
    color: var(--gold);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.pld-active-stats {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 6px;
}
.pld-active-stats.broken { color: var(--red); }
.pld-active-url {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}
.pld-active-expire {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

/* Active card action buttons */
.pld-active-actions {
    display: flex;
    gap: 8px;
}
.pld-action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: rgba(240,237,230,0.5);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
}
.pld-action-btn.focused {
    background: rgba(226,184,75,0.08);
    border-color: var(--gold-border);
    color: var(--gold);
    transform: scale(1.05);
}
.pld-action-btn.delete {
    color: var(--red);
    background: var(--red-tint);
    border-color: rgba(220,80,80,0.2);
}
.pld-action-btn.delete.focused {
    background: rgba(220,80,80,0.2);
    border-color: var(--red);
    color: #fff;
    transform: scale(1.05);
}

/* ─── Divider ─── */
.pld-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 0 16px;
}

/* ─── Other Playlists ─── */
.pld-other-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.pld-playlist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pld-playlist-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.07);
    cursor: pointer;
    transition: all 0.12s;
    gap: 12px;
}
.pld-playlist-item.focused {
    background: rgba(255,255,255,0.06);
    border-color: var(--gold-border);
    transform: scale(1.02);
}
.pld-playlist-item-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pld-playlist-item-btn {
    padding: 6px 18px;
    border-radius: 8px;
    background: transparent;
    border: 1.5px solid rgba(226,184,75,0.4);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.pld-playlist-item.focused .pld-playlist-item-btn {
    color: var(--gold);
    border-color: var(--gold);
}
.pld-playlist-item-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.12s;
    flex-shrink: 0;
}
.pld-playlist-item.focused .pld-playlist-item-circle {
    border-color: var(--gold);
    color: var(--gold);
}

/* ─── Empty state ─── */
.pld-empty {
    text-align: center;
    padding: 40px 0;
}
.pld-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.pld-empty-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

/* ─── QR Panel (right) ─── */
.pld-qr-box {
    width: 140px;
    height: 140px;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    border: 2px solid transparent;
    cursor: pointer;
}
.pld-qr-box.focused {
    border-color: #E2B84B;
    box-shadow: 0 0 16px rgba(226,184,75,0.35);
    transform: scale(1.06);
}
.pld-qr-box canvas,
.pld-qr-box img {
    width: 100%;
    height: 100%;
}
.pld-qr-text {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-align: center;
    line-height: 1.4;
}
.pld-qr-device {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    font-weight: 700;
}

/* ─── QR Zoom Modal ─── */
.pld-qr-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pldQrFadeIn 0.2s ease-out;
}
@keyframes pldQrFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.pld-qr-modal {
    position: relative;
    background: rgba(15,15,26,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226,184,75,0.2);
    border-radius: 20px;
    padding: 36px 44px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.pld-qr-modal-box {
    width: 260px;
    height: 260px;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pld-qr-modal-box canvas,
.pld-qr-modal-box img {
    width: 100%;
    height: 100%;
}
.pld-qr-modal-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pld-qr-modal-mac,
.pld-qr-modal-key {
    font-size: 14px;
    font-weight: 700;
    color: rgba(240,237,230,0.7);
    font-family: 'Inter', monospace;
}
.pld-qr-modal-hint {
    font-size: 11px;
    color: rgba(240,237,230,0.3);
    margin-top: 4px;
}

/* ─── Refresh button loading state ─── */
.pld-btn-refresh.pld-btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ─── Other playlist sub-focus (Activer / Supprimer) ─── */
.pld-playlist-item-btn.sub-focused {
    background: rgba(226,184,75,0.15);
    border-color: #E2B84B;
    color: #E2B84B;
    transform: scale(1.08);
    box-shadow: 0 0 8px rgba(226,184,75,0.25);
}
.pld-playlist-item-circle.sub-focused {
    background: rgba(220,80,80,0.15);
    border-color: #DC5050;
    color: #DC5050;
    transform: scale(1.12);
    box-shadow: 0 0 8px rgba(220,80,80,0.25);
}

/* ─── Info Modal ─── */
.pld-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}
.pld-modal {
    width: 520px;
    max-height: 80vh;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pld-modal-title {
    padding: 18px 22px 14px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pld-modal-body {
    padding: 16px 22px;
    overflow-y: auto;
    flex: 1;
}
.pld-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pld-info-row:last-child {
    border-bottom: none;
}
.pld-info-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}
.pld-info-value {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-align: right;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pld-modal-actions {
    padding: 14px 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.pld-modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
    color: #fff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
}
.pld-modal-btn.focused {
    background: rgba(226,184,75,0.12);
    border-color: #E2B84B;
    color: #E2B84B;
}
.pld-modal-btn-danger.focused {
    background: rgba(255,68,68,0.15);
    border-color: #FF4444;
    color: #FF4444;
}

/* ─── Override playlist edit page for beta testers ─── */
#playlist-edit-page.pld-styled {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
#playlist-edit-page.pld-styled::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/background_violet.png') center/cover no-repeat;
    z-index: 0;
}
#playlist-edit-page.pld-styled::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(4,2,10,0.82);
    z-index: 1;
}
#playlist-edit-page.pld-styled #playlist-edit-page-container {
    position: relative;
    z-index: 2;
    width: 500px;
    left: auto;
    top: auto;
    transform: none;
    background: rgba(26,26,46,0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px 28px;
    font-family: 'Inter', sans-serif;
}
#playlist-edit-page.pld-styled .playlist-edit-item-wrapper {
    font-size: 14px;
    color: rgba(240,237,230,0.5);
    margin-top: 14px;
}
#playlist-edit-page.pld-styled .playlist-edit-item-wrapper label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(240,237,230,0.5);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#playlist-edit-page.pld-styled .playlist-edit-item {
    font-size: 15px;
    font-weight: 500;
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    color: #F0EDE6;
    padding: 10px 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
#playlist-edit-page.pld-styled .playlist-edit-item.active {
    border-color: #E2B84B;
    background: rgba(226,184,75,0.04);
}
#playlist-edit-page.pld-styled .playlist-edit-item::placeholder {
    color: rgba(240,237,230,0.25);
}
#playlist-edit-page.pld-styled #playlist-edit-btns-container {
    margin-top: 22px;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
#playlist-edit-page.pld-styled .playlist-edit-btn {
    min-width: 120px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #F0EDE6;
    cursor: pointer;
    transition: all 0.12s;
}
#playlist-edit-page.pld-styled .playlist-edit-btn.active {
    background: rgba(226,184,75,0.12);
    border-color: #E2B84B;
    color: #E2B84B;
}
#playlist-edit-page.pld-styled #playlist-edit-error-message {
    font-size: 13px;
    color: #FF4444;
    margin-top: 8px;
    font-weight: 600;
    background: rgba(255,68,68,0.08);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,68,68,0.15);
}

/* ─── PIN Modal ─── */
.pld-pin-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pldPinFadeIn 0.2s ease-out;
}
@keyframes pldPinFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.pld-pin-modal {
    position: relative;
    background: rgba(15,15,26,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 28px 36px;
    text-align: center;
    color: #F0EDE6;
    font-family: 'Inter', sans-serif;
    min-width: 280px;
}
.pld-pin-lock {
    font-size: 32px;
    color: #E2B84B;
    margin-bottom: 10px;
}
.pld-pin-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}
.pld-pin-error {
    font-size: 12px;
    color: #FF4444;
    font-weight: 600;
    min-height: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
.pld-pin-error.visible {
    opacity: 1;
}
.pld-pin-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 14px 0 20px;
}
.pld-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.15s;
}
.pld-pin-dot.filled {
    background: #E2B84B;
    border-color: #E2B84B;
    box-shadow: 0 0 8px rgba(226,184,75,0.4);
}
.pld-pin-dots.shake {
    animation: pldPinShake 0.4s ease-in-out;
}
@keyframes pldPinShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
.pld-pin-numpad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    gap: 8px;
    justify-content: center;
}
.pld-pin-key {
    width: 56px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #F0EDE6;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.1s;
}
.pld-pin-key.focused {
    background: rgba(226,184,75,0.15);
    border-color: #E2B84B;
    color: #E2B84B;
    transform: scale(1.08);
}
.pld-pin-key-empty {
    background: transparent;
    border: none;
    cursor: default;
}
.pld-pin-key-del {
    font-size: 16px;
    color: rgba(240,237,230,0.6);
}
.pld-pin-key-del.focused {
    color: #FF4444;
    border-color: #FF4444;
    background: rgba(255,68,68,0.1);
}

/* ─── QR Modal close button ─── */
.pld-qr-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}
.pld-qr-modal-close i {
    font-size: 13px;
    color: rgba(240,237,230,0.5);
}
.pld-qr-modal-close:hover {
    background: rgba(226,184,75,0.15);
    border-color: #E2B84B;
}
.pld-qr-modal-close:hover i {
    color: #E2B84B;
}

/* ─── PIN Modal close button + hint ─── */
.pld-pin-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}
.pld-pin-modal-close i {
    font-size: 12px;
    color: rgba(240,237,230,0.5);
}
.pld-pin-modal-close:hover {
    background: rgba(226,184,75,0.15);
    border-color: #E2B84B;
}
.pld-pin-modal-close:hover i {
    color: #E2B84B;
}
.pld-pin-hint {
    font-size: 10px;
    color: rgba(240,237,230,0.25);
    margin-top: 14px;
}

/* ─── Info / Confirm Modal header with close button ─── */
.pld-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pld-modal-header .pld-modal-title {
    padding: 0;
    border-bottom: none;
    flex: 1;
}
.pld-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    margin-left: 12px;
}
.pld-modal-close i {
    font-size: 13px;
    color: rgba(240,237,230,0.5);
}
.pld-modal-close:hover {
    background: rgba(226,184,75,0.15);
    border-color: #E2B84B;
}
.pld-modal-close:hover i {
    color: #E2B84B;
}
