/* ── Infiny Playlist — Front CSS ─────────────────────────────────── */
/* Variables are injected per playlist via inline style on the wrapper */

.infiny-playlist-wrap *,
.infiny-playlist-wrap *::before,
.infiny-playlist-wrap *::after {
    box-sizing: border-box;
}

/* ── Wrapper ─────────────────────────────────────────────────────── */
.infiny-playlist-wrap {
    --ipl-primary:   #e63946;
    --ipl-secondary: #1d1d1d;
    --ipl-text:      #ffffff;
    --ipl-bg:        #121212;
    --ipl-radius:    10px;
    --ipl-track-bg:  color-mix(in srgb, var(--ipl-bg) 90%, white 10%);
    --ipl-muted:     color-mix(in srgb, var(--ipl-text) 50%, transparent 50%);
    --ipl-border:    color-mix(in srgb, var(--ipl-text) 10%, transparent 90%);
    --ipl-hover:     color-mix(in srgb, var(--ipl-primary) 10%, var(--ipl-track-bg) 90%);

    background: var(--ipl-bg);
    color: var(--ipl-text);
    border-radius: var(--ipl-radius);
    overflow: hidden;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    position: relative;
}

/* ── Header ──────────────────────────────────────────────────────── */
.infiny-playlist-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--ipl-border);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--ipl-primary) 15%, var(--ipl-bg) 85%) 0%,
        var(--ipl-bg) 100%);
}
.infiny-playlist-title {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--ipl-text);
}
.infiny-playlist-count {
    font-size: .8rem;
    color: var(--ipl-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── Track list ──────────────────────────────────────────────────── */
.infiny-track-list {
    padding: 8px 0;
}

.infiny-track {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--ipl-border);
    transition: background .18s ease;
    position: relative;
}
.infiny-track:last-child { border-bottom: none; }
.infiny-track:hover { background: var(--ipl-hover); }

/* ── Track number ─────────────────────────────────────────────────── */
.infiny-track-num {
    width: 24px;
    text-align: right;
    font-size: .8rem;
    color: var(--ipl-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.infiny-track:hover .infiny-track-num { color: var(--ipl-primary); }

/* ── Cover ───────────────────────────────────────────────────────── */
.infiny-track-cover {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--ipl-secondary);
}
.infiny-track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter .2s;
}
.infiny-track:hover .infiny-track-cover img {
    filter: brightness(.6);
}

.infiny-preview-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
    color: #fff;
    padding: 0;
}
.infiny-preview-btn svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}
.infiny-track:hover .infiny-preview-btn { opacity: 1; }

/* ── Info ─────────────────────────────────────────────────────────── */
.infiny-track-info {
    flex: 1;
    min-width: 0;
}
.infiny-track-title {
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ipl-text);
}
.infiny-track-artist {
    font-size: .8rem;
    color: var(--ipl-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.infiny-track-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}
.infiny-tag {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 7px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--ipl-primary) 20%, transparent 80%);
    color: var(--ipl-primary);
    border: 1px solid color-mix(in srgb, var(--ipl-primary) 40%, transparent 60%);
}

/* ── Meta (duration) ─────────────────────────────────────────────── */
.infiny-track-meta {
    flex-shrink: 0;
}
.infiny-track-duration {
    font-size: .8rem;
    color: var(--ipl-muted);
    font-variant-numeric: tabular-nums;
}

/* ── Actions ──────────────────────────────────────────────────────── */
.infiny-track-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Stream links */
.infiny-stream-links {
    display: flex;
    gap: 6px;
}
.infiny-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    opacity: .55;
    transition: opacity .18s, transform .18s, color .18s;
    color: var(--ipl-text);
}
.infiny-link:hover { opacity: 1; transform: scale(1.15); }
.infiny-link svg   { width: 16px; height: 16px; }
.infiny-link-yt:hover { color: #ff0000; }
.infiny-link-sp:hover { color: #1db954; }
.infiny-link-dz:hover { color: #00c7f2; }

/* Like button */
.infiny-like-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ipl-muted);
    font-size: .8rem;
    padding: 4px 6px;
    border-radius: 20px;
    transition: color .18s, background .18s, transform .15s;
    font-variant-numeric: tabular-nums;
}
.infiny-like-btn svg {
    width: 16px;
    height: 16px;
    transition: fill .18s, stroke .18s;
    stroke: currentColor;
}
.infiny-like-btn:hover {
    color: #e63946;
    background: color-mix(in srgb, #e63946 12%, transparent 88%);
}
.infiny-like-btn.liked {
    color: #e63946;
}
.infiny-like-btn.liked svg {
    fill: #e63946;
}
.infiny-like-btn.pop {
    animation: infiny-pop .25s ease;
}
@keyframes infiny-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ── Modal ────────────────────────────────────────────────────────── */
.infiny-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.infiny-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
}
.infiny-modal-box {
    position: relative;
    z-index: 1;
    background: #1a1a1a;
    border-radius: 14px;
    padding: 24px;
    width: min(600px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
    color: #fff;
    animation: infiny-modal-in .25s ease;
}
@keyframes infiny-modal-in {
    from { opacity:0; transform: scale(.94) translateY(12px); }
    to   { opacity:1; transform: scale(1)   translateY(0); }
}

.infiny-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255,255,255,.1);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s;
}
.infiny-modal-close:hover { background: rgba(255,255,255,.22); }

.infiny-modal-track-info {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.infiny-modal-cover {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.infiny-modal-title  { font-size: 1.05rem; font-weight: 700; }
.infiny-modal-artist { font-size: .85rem; color: rgba(255,255,255,.6); margin-top: 3px; }

.infiny-modal-embed {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.infiny-modal-embed iframe {
    width: 100%;
    border: none;
    display: block;
    border-radius: 8px;
}

/* ── Misc ─────────────────────────────────────────────────────────── */
.infiny-error,
.infiny-empty {
    padding: 16px;
    color: var(--ipl-muted, #888);
    font-style: italic;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .infiny-track { padding: 10px 12px; gap: 10px; }
    .infiny-track-cover { width: 40px; height: 40px; }
    .infiny-track-num   { display: none; }
    .infiny-stream-links { gap: 4px; }
    .infiny-link { width: 26px; height: 26px; }
}

/* ── Vote buttons (Top) ──────────────────────────────────────────── */
.infiny-vote-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.infiny-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    color: var(--ipl-muted, #888);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .16s, background .16s, transform .15s;
}
.infiny-vote-btn svg {
    width: 18px;
    height: 18px;
}
.infiny-vote-up:hover,
.infiny-vote-up.active {
    color: #2e7d32;
    background: rgba(46,125,50,.1);
}
.infiny-vote-down:hover,
.infiny-vote-down.active {
    color: #c62828;
    background: rgba(198,40,40,.1);
}
.infiny-vote-btn.pop {
    animation: infiny-pop .25s ease;
}
.infiny-vote-score {
    font-size: .82rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    color: var(--ipl-muted, #888);
    font-variant-numeric: tabular-nums;
}
.infiny-vote-score.positive { color: #2e7d32; }
.infiny-vote-score.negative { color: #c62828; }

/* ── Vote buttons — shared (playlist + top) ─────────────────────── */
.infiny-vote-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.infiny-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s, transform .12s;
    color: #bbb;
}
.infiny-vote-btn svg       { width: 16px; height: 16px; }
.infiny-vote-up:hover,
.infiny-vote-up.active     { color: #27ae60; background: rgba(39,174,96,.1); }
.infiny-vote-down:hover,
.infiny-vote-down.active   { color: #e74c3c; background: rgba(231,76,60,.1); }
.infiny-vote-btn.pop       { animation: infiny-pop .22s ease; }
.infiny-vote-score {
    font-size: .8rem; font-weight: 700;
    min-width: 24px; text-align: center;
    color: #bbb; font-variant-numeric: tabular-nums;
}
.infiny-vote-score.positive { color: #27ae60; }
.infiny-vote-score.negative { color: #e74c3c; }

/* ── Vote buttons — shared (playlist + top) ─────────────────────── */
.infiny-vote-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.infiny-vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
    color: #bbb;
}
.infiny-vote-btn svg       { width: 16px; height: 16px; }
.infiny-vote-up:hover,
.infiny-vote-up.active     { color: #27ae60; background: rgba(39,174,96,.1); }
.infiny-vote-down:hover,
.infiny-vote-down.active   { color: #e74c3c; background: rgba(231,76,60,.1); }
.infiny-vote-btn.pop       { animation: infiny-pop .22s ease; }
.infiny-vote-score {
    font-size: .8rem; font-weight: 700;
    min-width: 24px; text-align: center;
    color: #bbb; font-variant-numeric: tabular-nums;
}
.infiny-vote-score.positive { color: #27ae60; }
.infiny-vote-score.negative { color: #e74c3c; }

/* ═══════════════════════════════════════════════════════════════════
   TOP CLASSEMENT
   ═══════════════════════════════════════════════════════════════════ */
.infiny-top-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fff;
    width: 100%;
}

/* ── Single row ─────────────────────────────────────────────────── */
.itp-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #ececec;
    cursor: default;
    position: relative;
    background: #fff;
    transition: background .15s;
    min-height: 120px;
}
.itp-row:last-child  { border-bottom: none; }
.itp-row.itp-clickable { cursor: pointer; }

/* Top-3 accent */
.itp-row.top-1 { background: linear-gradient(90deg,#fffde7 0%,#fff 55%); }
.itp-row.top-2 { background: linear-gradient(90deg,#f5f5f5 0%,#fff 55%); }
.itp-row.top-3 { background: linear-gradient(90deg,#fff8f0 0%,#fff 55%); }
.itp-row.top-1:hover { background: linear-gradient(90deg,#fff9c4 0%,#f9f9f9 55%); }
.itp-row.top-2:hover { background: linear-gradient(90deg,#eeeeee 0%,#f9f9f9 55%); }
.itp-row.top-3:hover { background: linear-gradient(90deg,#fff3e0 0%,#f9f9f9 55%); }
.itp-row:not(.top-1):not(.top-2):not(.top-3):hover { background: #f9f9f9; }

/* Left accent */
.itp-row.top-1::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#ffd700; }
.itp-row.top-2::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#b0bec5; }
.itp-row.top-3::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:#cd8f52; }

/* ── Cover ──────────────────────────────────────────────────────── */
.itp-cover {
    width: 120px !important;
    min-width: 120px !important;
    min-height: 120px !important;
    position: relative !important;
    overflow: hidden !important;
    background: #111;
    flex-shrink: 0;
    align-self: stretch;
    padding: 0 !important;
    margin: 0 !important;
}
.itp-cover img {
    position: absolute;
    inset: 0;
    width: 100% !important;   /* override theme max-width rules */
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    transition: filter .2s, transform .3s;
}
.itp-row.itp-clickable:hover .itp-cover img,
.itp-row.itp-inline-trigger:hover .itp-cover img {
    filter: brightness(.6);
    transform: scale(1.06);
}

/* Rank badge */
.itp-rank {
    position: absolute;
    bottom: 5px; left: 6px;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.75);
    letter-spacing: -.03em;
    z-index: 1;
    pointer-events: none;
}
.itp-rank.rk-1 { color: #ffd700; font-size: 2rem; }
.itp-rank.rk-2 { color: #e0e0e0; font-size: 1.9rem; }
.itp-rank.rk-3 { color: #cd8f52; font-size: 1.85rem; }

/* Play overlay */
.itp-play-overlay {
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .2s;
    color: #fff; pointer-events: none; z-index: 2;
}
.itp-play-overlay svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.7)); }
.itp-row.itp-clickable:hover .itp-play-overlay,
.itp-row.itp-inline-trigger:hover .itp-play-overlay { opacity: 1; }

/* ── Vote column ────────────────────────────────────────────────── */
.itp-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 40px;
    min-width: 40px;
    flex-shrink: 0;
    padding: 0;
    border-right: 1px solid #f0f0f0;
}
.itp-vote-up,
.itp-vote-dn {
    background: none; border: none; cursor: pointer;
    padding: 4px 6px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: color .14s, background .14s;
    color: #d0d0d0; line-height: 1;
}
.itp-vote-up svg, .itp-vote-dn svg { width: 13px; height: 13px; display: block; }
.itp-vote-up:hover, .itp-vote-up.active { color: #27ae60; background: rgba(39,174,96,.08); }
.itp-vote-dn:hover, .itp-vote-dn.active { color: #e74c3c; background: rgba(231,76,60,.08); }
.itp-vote-up.pop, .itp-vote-dn.pop { animation: infiny-pop .2s ease; }

.itp-score {
    font-size: .68rem; font-weight: 800;
    color: #bbb; line-height: 1;
    min-width: 18px; text-align: center;
    font-variant-numeric: tabular-nums;
}
.itp-score.pos { color: #27ae60; }
.itp-score.neg { color: #e74c3c; }

/* ── Info ───────────────────────────────────────────────────────── */
.itp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 14px;
}
.itp-title {
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.itp-artist {
    font-size: .75rem;
    color: #888;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.itp-tags {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px;
}
.itp-tag {
    font-size: .6rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; padding: 2px 6px; border-radius: 20px;
    background: #f0f0f2; color: #999;
}

/* ── Actions ────────────────────────────────────────────────────── */
.itp-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    flex-shrink: 0;
}
.itp-link {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    color: #ccc; opacity: .6;
    transition: opacity .15s, color .15s, transform .15s;
    text-decoration: none;
}
.itp-link:hover       { opacity: 1; transform: scale(1.15); }
.itp-link svg         { width: 14px; height: 14px; }
.itp-link.yt:hover    { color: #ff0000; }
.itp-link.sp:hover    { color: #1db954; }
.itp-link.dz:hover    { color: #00c7f2; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .itp-cover        { width: 64px; min-width: 64px; }
    .itp-rank         { font-size: 1.4rem; bottom: 4px; left: 4px; }
    .itp-rank.rk-1    { font-size: 1.6rem; }
    .itp-votes        { width: 34px; min-width: 34px; }
    .itp-title        { font-size: .82rem; }
    .itp-artist       { font-size: .7rem; }
    .itp-actions      { padding: 0 8px; gap: 2px; }
    .itp-link         { width: 24px; height: 24px; }
}

/* ── Inline YouTube embed (Top mode) ────────────────────────────── */
.itp-inline-embed {
    display: none;
    width: 100%;
    background: #000;
    border-top: 1px solid #eee;
}
.itp-inline-embed.open {
    display: block;
}
.itp-inline-embed iframe {
    width: 100%;
    height: 0;
    display: block;
    transition: height .3s ease;
}
.itp-inline-embed.open iframe {
    height: 480px;
}
@media (max-width: 600px) {
    .itp-inline-embed.open iframe { height: 240px; }
}

/* ── Extra specificity to override Divi/theme img rules ─────────── */
.infiny-top-wrap .itp-cover,
.infiny-top-wrap .itp-cover * {
    box-sizing: border-box;
}
.infiny-top-wrap .itp-cover {
    width: 120px !important;
    min-width: 120px !important;
    min-height: 120px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: hidden !important;
    align-self: stretch !important;
}
.infiny-top-wrap .itp-cover img {
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}
.infiny-top-wrap .itp-row {
    min-height: 120px !important;
    align-items: stretch !important;
}
