/* ============================================================
   Crates — multi-list wishlist UI
   Palette: dark #0a0b14 / #12142a / #1d1f35, borders #3a3d5c /
   #2a2d44, purple #a884ff, red #f6002d / #d91d3f, cyan #22d3ee /
   #88ebe9, text #f3effb.
   Scoped under `body` so it does not clobber admin/other skins.
   ============================================================ */

/* ---- Navbar crate icon (mirrors .navbar-cart) ---- */
body .navbar-crate {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #a884ff;
    font-size: 1.1rem;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    background: rgba(168, 132, 255, 0.08);
    border: 1px solid rgba(168, 132, 255, 0.22);
    flex-shrink: 0;
}

body .navbar-crate:hover {
    background: rgba(168, 132, 255, 0.22);
    color: #ffffff;
    border-color: rgba(168, 132, 255, 0.5);
}

body .crate-count.is-empty { display: none; }

/* ---- Save-to-crate button (overlay circle variant) ---- */
body .crate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    padding: 0;
    border: 2px solid rgba(168, 132, 255, 0.35);
    border-radius: 50%;
    background: rgba(8, 6, 17, 0.72);
    color: #c4b5fd;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

body .crate-btn:hover {
    transform: scale(1.08);
    color: #ffffff;
    border-color: rgba(168, 132, 255, 0.6);
    box-shadow: 0 0 18px rgba(168, 132, 255, 0.35);
}

body .crate-btn.in-crate {
    background: linear-gradient(135deg, #a884ff, #f6002d);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
    box-shadow: 0 0 22px rgba(168, 132, 255, 0.45);
}

/* Storefront art-overlay context: tracks.css pins the shared
   :is(.play-trigger,.view-link,.crate-btn) circle with !important,
   so these overrides need matching specificity + !important. */
body .rh-storefront .catalog-grid .track-card .art-overlay .crate-btn {
    background: rgba(8, 6, 17, 0.72) !important;
    border: 2px solid rgba(168, 132, 255, 0.35) !important;
    color: #c4b5fd !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(168, 132, 255, 0.28) !important;
}

body .rh-storefront .catalog-grid .track-card .art-overlay .crate-btn:hover {
    border-color: rgba(168, 132, 255, 0.65) !important;
    color: #ffffff !important;
}

body .rh-storefront .catalog-grid .track-card .art-overlay .crate-btn.in-crate {
    background: linear-gradient(135deg, #a884ff, #f6002d) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 22px rgba(168, 132, 255, 0.45) !important;
}

/* ---- Inline pill variant (with text label) ---- */
body .crate-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid rgba(168, 132, 255, 0.35);
    border-radius: 999px;
    background: transparent;
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
}

body .crate-btn-inline:hover {
    border-color: #a884ff;
    background: rgba(168, 132, 255, 0.1);
    color: #ffffff;
}

body .crate-btn-inline.in-crate {
    background: linear-gradient(135deg, #a884ff, #f6002d);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(168, 132, 255, 0.35);
}

/* ---- Popover ---- */
body .crate-popover {
    position: fixed;
    z-index: 10002; /* above navbar drawer */
    display: flex;
    flex-direction: column;
    width: min(300px, calc(100vw - 24px));
    max-height: 320px;
    background: #12142a;
    border: 1px solid #3a3d5c;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    color: #f3effb;
    overflow: hidden;
}

body .crate-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #2a2d44;
}

body .crate-popover-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a884ff;
}

body .crate-popover-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8f8fb0;
    font-size: 13px;
    cursor: pointer;
}

body .crate-popover-close:hover {
    background: rgba(246, 0, 45, 0.16);
    color: #ffffff;
}

body .crate-popover-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px;
    scrollbar-color: rgba(168, 132, 255, 0.5) transparent;
}

body .crate-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

body .crate-opt:hover { background: rgba(168, 132, 255, 0.08); }

body .crate-opt input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #a884ff;
    cursor: pointer;
}

body .crate-opt-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #f3effb;
}

body .crate-opt-count {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(168, 132, 255, 0.14);
    color: #c4b5fd;
    font-size: 11px;
    text-align: center;
}

body .crate-popover-empty,
body .crate-popover-loading {
    padding: 14px 12px;
    font-size: 12px;
    color: #8f8fb0;
    text-align: center;
}

body .crate-popover-divider {
    height: 1px;
    background: #2a2d44;
}

/* ---- Inline "new crate" row ---- */
body .crate-new-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}

body .crate-new-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #3a3d5c;
    border-radius: 9px;
    background: #0a0b14;
    color: #f3effb;
    font-size: 13px;
}

body .crate-new-input:focus {
    outline: none;
    border-color: #a884ff;
    box-shadow: 0 0 0 3px rgba(168, 132, 255, 0.18);
}

body .crate-new-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, #a884ff, #f6002d);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

body .crate-new-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

body .crate-popover-foot {
    padding: 8px 12px;
    border-top: 1px solid #2a2d44;
}

body .crate-manage-link {
    font-size: 12px;
    font-weight: 600;
    color: #22d3ee;
    text-decoration: none;
}

body .crate-manage-link:hover {
    color: #88ebe9;
    text-decoration: underline;
}

/* ---- Bottom-sheet variant (<=600px, JS toggles .crate-sheet) ---- */
body .crate-popover.crate-sheet {
    position: fixed;
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-width: none;
    max-height: 62vh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ---- Toast ---- */
body .cr-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10003;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 10px;
    background: rgba(168, 132, 255, 0.15);
    border: 1px solid rgba(168, 132, 255, 0.4);
    color: #c4b5fd;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

body .cr-toast i { color: #a884ff; }
body .cr-toast a {
    color: #22d3ee;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
body .cr-toast a:hover { color: #88ebe9; text-decoration: underline; }

/* ---- Small screens: shrink overlay circles to 44px ---- */
@media (max-width: 600px) {
    .rh-storefront .catalog-grid .track-card .art-overlay :is(.play-trigger, .view-link, .crate-btn),
    body .crate-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex: 0 0 44px !important;
    }
}

/* ---- List-row inline variant: match sibling .track-icon-btn sizing ---- */
body .crate-btn.track-icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
}
body .rh-storefront .crate-btn.track-icon-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    border: 1px solid rgba(217, 29, 63, .35);
    border-radius: 4px;
    background: rgba(217, 29, 63, .12);
    color: #efbac8;
    box-shadow: none;
}
body .rh-storefront .crate-btn.track-icon-btn:hover {
    background: rgba(217, 29, 63, .2);
    border-color: rgba(217, 29, 63, .6);
}
body .rh-storefront .crate-btn.track-icon-btn.in-crate {
    background: linear-gradient(135deg, #a884ff, #f6002d);
    border-color: rgba(255, 255, 255, .45);
    color: #ffffff;
}
