/* ============================================================
   Metal Rock y Pop en Vinilo — hoja de estilos única
   Mobile-first, sin frameworks
   ============================================================ */
:root {
    --bg: #0e0e12;
    --panel: #17171f;
    --panel-2: #1f1f2a;
    --border: #2a2a38;
    --text: #ece9e4;
    --muted: #9a97a3;
    --accent: #e63946;
    --metal: #e63946;
    --rock: #f77f00;
    --pop: #00b4d8;
    --green: #25d366;
    --yape: #742284;
    --radius: 12px;
    --shadow: 0 4px 16px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(14, 14, 18, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header .inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 16px;
}
.logo {
    font-weight: 900; font-size: 17px; letter-spacing: .5px;
    white-space: nowrap;
}
.logo .m { color: var(--metal); }
.logo .r { color: var(--rock); }
.logo .p { color: var(--pop); }
.cart-link {
    position: relative; display: flex; align-items: center;
    padding: 7px 10px; border-radius: 8px; color: var(--text);
}
.cart-link:hover { background: var(--panel-2); }
.cart-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.search-toggle {
    display: flex; align-items: center;
    padding: 7px 10px; border-radius: 8px;
    background: none; border: 0; color: var(--text); cursor: pointer;
}
.search-toggle:hover { background: var(--panel-2); }
.search-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; }
.header-search {
    display: none; gap: 8px;
    max-width: 1200px; margin: 0 auto; padding: 0 16px 10px;
}
.header-search.open { display: flex; }
.header-search input {
    flex: 1; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.header-search button {
    background: var(--accent); color: #fff; border: 0;
    font-weight: 700; font-size: 13.5px;
    padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
.header-search button:hover { filter: brightness(1.15); }

/* Dropdown de búsqueda instantánea */
.header-search { position: relative; }
.search-suggest {
    display: none;
    position: absolute; top: 100%; left: 16px; right: 16px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    max-height: 60vh; overflow-y: auto;
    z-index: 150;
}
.search-suggest.open { display: block; }
.ss-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.ss-item:hover, .ss-item.sel { background: var(--panel-2); }
.ss-item.ss-sold { opacity: .5; cursor: default; }
.ss-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ss-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-text mark { background: none; color: var(--accent); font-weight: 800; }
.ss-price { color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
.ss-all {
    display: block; text-align: center;
    padding: 11px; font-weight: 700; font-size: 13.5px; color: var(--accent);
}
.ss-all:hover, .ss-all.sel { background: var(--panel-2); }
.ss-empty { padding: 14px; color: var(--muted); font-size: 14px; text-align: center; }
.cart-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 800;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}
.cart-badge:empty, .cart-badge[data-n="0"] { display: none; }
.header-tagline {
    color: var(--muted); font-size: 12.5px; font-weight: 600;
    font-style: italic; white-space: nowrap; margin-left: auto;
}
@media (max-width: 900px) {
    .header-tagline { display: none; }
    .search-toggle { margin-left: auto; }
}

/* ---------- Layout ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ---------- Sección de género (home) ---------- */
.genre-section { margin: 26px 0 38px; }
.genre-head {
    display: flex; align-items: baseline; gap: 12px;
    border-left: 5px solid var(--gcolor, var(--accent));
    padding-left: 12px; margin-bottom: 14px;
}
.genre-head h2 {
    margin: 0; font-size: clamp(22px, 4vw, 30px);
    font-weight: 900; text-transform: uppercase; letter-spacing: 1px;
    color: var(--gcolor, var(--accent));
}
.genre-head .count { color: var(--muted); font-size: 14px; }
.genre-head .see-all {
    margin-left: auto; font-weight: 700; font-size: 14px;
    color: var(--gcolor, var(--accent)); white-space: nowrap;
}
.genre-head .see-all:hover { text-decoration: underline; }
.featured-row {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}

/* ---------- Tarjeta de disco ---------- */
.disc-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .15s, border-color .15s;
}
.disc-card:hover { transform: translateY(-3px); border-color: #3d3d52; }
.disc-cover { position: relative; aspect-ratio: 1; background: var(--panel-2); }
.disc-cover img { width: 100%; height: 100%; object-fit: cover; }
.sold-overlay {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    background: rgba(230, 57, 70, .93); color: #fff;
    font-weight: 900; font-size: 20px; letter-spacing: 2px;
    width: 88%; text-align: center;
    padding: 6px 0; border-radius: 5px; pointer-events: none;
}
.discount-overlay {
    position: absolute; top: 8px; left: 8px;
    background: #22c55e; color: #06220f;
    font-weight: 900; font-size: 12px;
    padding: 3px 8px; border-radius: 5px; pointer-events: none;
}
.notes-tag {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(255, 193, 7, .95); color: #201a00;
    font-weight: 700; font-size: 10px;
    padding: 2px 7px; border-radius: 4px; pointer-events: none;
    max-width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.disc-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.disc-artist { font-weight: 800; font-size: 15px; line-height: 1.25; }
.disc-title { color: var(--muted); font-size: 13.5px; line-height: 1.3; }
.disc-meta { color: #6f6c7a; font-size: 12px; margin-top: 2px; }
.disc-bottom {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-top: auto; padding-top: 10px;
}
.disc-price { font-weight: 900; font-size: 17px; white-space: nowrap; }
.price-old {
    color: var(--muted); text-decoration: line-through;
    font-weight: 500; font-size: 12.5px; margin-right: 6px;
}
.price-new { color: #4ade80; }
.btn-add {
    background: var(--accent); color: #fff; border: 0;
    font-weight: 800; font-size: 13px;
    padding: 8px 12px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: filter .15s;
    white-space: nowrap;
}
.btn-add:hover { filter: brightness(1.15); }
.btn-add.in-cart { background: #2f3d2f; color: #7ce08a; cursor: default; }
.btn-add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.disc-sold-label { color: var(--muted); font-size: 13px; font-weight: 700; }

/* ---------- Barra de catálogo ---------- */
.catalog-bar {
    position: sticky; top: 49px; z-index: 50;
    background: rgba(14, 14, 18, .95); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}
.catalog-bar .inner {
    max-width: 1200px; margin: 0 auto; padding: 0 16px;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.catalog-bar input[type=search], .catalog-bar select {
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 10px; font-size: 14px;
}
.catalog-bar input[type=search] { flex: 1; min-width: 130px; }
.catalog-bar input[type=search]::placeholder { color: #6f6c7a; }
.alpha-nav { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 0 2px; width: 100%; }
.alpha-nav a {
    min-width: 26px; text-align: center; padding: 3px 7px;
    border-radius: 6px; background: var(--panel-2);
    font-weight: 700; font-size: 12.5px; color: var(--muted);
}
.alpha-nav a:hover { color: var(--text); background: var(--border); }

/* ---------- Grid del catálogo ---------- */
.catalog-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px; margin-top: 16px;
}
.letter-sep {
    grid-column: 1 / -1;
    font-size: 22px; font-weight: 900;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    padding: 14px 2px 4px; margin-top: 6px;
    scroll-margin-top: 130px;
}
.empty-msg { color: var(--muted); text-align: center; padding: 40px 0; grid-column: 1 / -1; }

/* ---------- Carrito ---------- */
.cart-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.cart-item {
    display: grid; grid-template-columns: 72px 1fr auto; gap: 12px;
    align-items: center;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px;
}
.cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.cart-item .ci-artist { font-weight: 800; font-size: 14.5px; }
.cart-item .ci-title { color: var(--muted); font-size: 13px; }
.cart-item .ci-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-item .ci-price { font-weight: 900; }
.btn-remove {
    background: none; border: 0; color: var(--muted);
    font-size: 12.5px; cursor: pointer; padding: 2px 4px;
}
.btn-remove:hover { color: var(--accent); }
.cart-total {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--panel-2); border-radius: var(--radius);
    padding: 14px 18px; font-size: 18px; font-weight: 900;
}
.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 30px; }
.checkout-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.checkout-card h3 { margin: 0; font-size: 17px; }
.checkout-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.btn-big {
    display: inline-flex; align-items: center; gap: 10px;
    border: 0; border-radius: 10px; cursor: pointer;
    font-weight: 800; font-size: 15px; padding: 12px 20px; color: #fff;
    margin-top: auto;
}
.btn-wsp { background: var(--green); color: #062b12; }
.btn-yape { background: var(--yape); }
.btn-big:hover { filter: brightness(1.12); }
.btn-big svg { width: 20px; height: 20px; }
.yape-info {
    background: var(--panel-2); border-radius: 8px; padding: 10px 14px;
    font-size: 14px; width: 100%;
}
.yape-info strong { font-size: 17px; letter-spacing: 1px; }
.yape-qr { width: 180px; border-radius: 10px; }

/* ---------- Botón flotante WhatsApp ---------- */
.wsp-float {
    position: fixed; bottom: 18px; right: 18px; z-index: 90;
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--green); box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
}
.wsp-float:hover { transform: scale(1.08); }
.wsp-float svg { width: 28px; height: 28px; fill: #fff; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted); font-size: 13px;
    text-align: center; padding: 26px 16px 80px; margin-top: 40px;
}

/* ---------- Página de disco ---------- */
.disco-back { margin: 18px 0 6px; }
.disco-back a { color: var(--muted); font-weight: 700; font-size: 14px; }
.disco-back a:hover { color: var(--text); }
.disco-main {
    display: grid; grid-template-columns: minmax(260px, 440px) 1fr;
    gap: 28px; align-items: start; margin-bottom: 10px;
}
.disco-cover-big {
    position: relative; aspect-ratio: 1;
    background: var(--panel-2); border-radius: var(--radius); overflow: hidden;
}
.disco-cover-big img { width: 100%; height: 100%; object-fit: cover; }
.disco-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.disco-thumbs img {
    width: 64px; height: 64px; object-fit: cover; border-radius: 8px;
    cursor: pointer; border: 2px solid transparent; opacity: .75;
}
.disco-thumbs img.active, .disco-thumbs img:hover { border-color: var(--gcolor, var(--accent)); opacity: 1; }
.disco-info h1 { margin: 10px 0 0; font-size: 30px; line-height: 1.15; }
.disco-info h2 { margin: 2px 0 10px; font-size: 20px; font-weight: 600; color: var(--muted); }
.badge-genero {
    display: inline-block; padding: 3px 11px; border-radius: 20px;
    font-size: 12px; font-weight: 800; letter-spacing: .5px;
    background: color-mix(in srgb, var(--gcolor, var(--accent)) 18%, transparent);
    color: var(--gcolor, var(--accent));
}
.disco-meta { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.disco-notas {
    display: inline-block; background: rgba(255, 193, 7, .12); color: #ffd54f;
    font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 6px; margin: 0 0 14px;
}
.disco-buy { display: flex; align-items: center; gap: 16px; margin: 6px 0 16px; }
.disco-desc {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    font-size: 14.5px; color: var(--text); margin-bottom: 16px;
}
.disco-links { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ext {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px;
    font-weight: 700; font-size: 13.5px;
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
}
.btn-ext:hover { filter: brightness(1.2); }
.btn-spotify { background: #14351f; border-color: #1db954; color: #1db954; }
.btn-historico { cursor: pointer; }

/* ---------- Modal: histórico de precios de Discogs ---------- */
.modal-historico {
    width: min(680px, 92vw); max-height: 85vh; padding: 0;
    background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.modal-historico::backdrop { background: rgba(0, 0, 0, .65); }
.modal-historico-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-historico-head h3 { margin: 0 0 4px; font-size: 17px; }
.modal-historico-sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.modal-close {
    background: none; border: 0; color: var(--muted); font-size: 16px;
    cursor: pointer; line-height: 1; padding: 4px;
}
.modal-close:hover { color: var(--text); }

.modal-historico-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    padding: 16px 20px;
}
.modal-historico-stats div { text-align: center; }
.modal-historico-stats span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.modal-historico-stats b { display: block; font-size: 16px; margin-top: 2px; }

.modal-historico-chart-wrap { overflow-x: auto; margin: 0 20px 16px; }
.modal-historico-chart { display: block; }
.chart-grid { stroke: var(--border); stroke-dasharray: 3 3; }
.chart-axis-label { fill: var(--muted); font-size: 10px; }
.chart-fecha-label { fill: var(--muted); font-size: 9.5px; }
.chart-linea { fill: none; stroke: var(--pop); stroke-width: 2; }
.chart-punto { fill: var(--pop); stroke: var(--panel); stroke-width: 1.5; }
.chart-punto:hover { fill: var(--text); }

.modal-historico-tabla-wrap { max-height: 300px; overflow-y: auto; padding: 0 20px; }
.modal-historico-tabla { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.modal-historico-tabla th {
    position: sticky; top: 0; background: var(--panel);
    text-align: left; padding: 6px 8px; color: var(--muted); font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.modal-historico-tabla td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.modal-historico-tabla tr.fila-comentario td {
    padding: 0 8px 8px; border-bottom: 1px solid var(--border);
    color: var(--muted); font-size: 11.5px; font-style: italic;
}
.modal-historico-nota {
    margin: 0; padding: 12px 20px 18px; font-size: 11.5px; color: var(--muted);
}
.modal-historico-nota a { color: var(--accent); font-weight: 600; }

.disco-section { margin: 30px 0; }
.disco-section h3 { font-size: 19px; margin: 0 0 14px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.video-grid iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); }
.spotify-embed { width: 100%; max-width: 640px; height: 650px; border: 0; border-radius: var(--radius); }
@media (max-width: 768px) { .spotify-embed { height: 450px; } }

/* Carrusel horizontal (todo el stock de una banda, cards 20% más chicas) */
.disc-carousel {
    display: flex; gap: 11px;
    overflow-x: auto; padding-bottom: 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.disc-carousel .disc-card { flex: 0 0 187px; scroll-snap-align: start; }
.disc-carousel .disc-artist { font-size: 13px; }
.disc-carousel .disc-title { font-size: 12px; }
.disc-carousel .disc-price { font-size: 14.5px; }
.disc-carousel .btn-add { padding: 7px 9px; font-size: 12px; }
.disc-carousel::-webkit-scrollbar { height: 8px; }
.disc-carousel::-webkit-scrollbar-track { background: var(--panel); border-radius: 4px; }
.disc-carousel::-webkit-scrollbar-thumb { background: var(--panel-2); border-radius: 4px; }
.disc-carousel::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 84px; right: 18px; z-index: 200;
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 16px; font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow);
    opacity: 0; transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .featured-row { gap: 8px; grid-template-columns: repeat(3, 1fr); }
    .featured-row .disc-card:nth-child(4) { display: none; }
    .featured-row .btn-add-label { display: none; }
    .featured-row .btn-add { padding: 8px; }
    .disc-info { padding: 9px 10px 11px; }
    .disc-artist { font-size: 13px; }
    .disc-title { font-size: 12px; }
    .disc-price { font-size: 14.5px; }
    .btn-add { padding: 7px 9px; font-size: 12px; }
    .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .logo { font-size: 14px; }
    .checkout-grid { grid-template-columns: 1fr; }
    .cart-item { grid-template-columns: 60px 1fr auto; }
    .cart-item img { width: 60px; height: 60px; }
    .disco-main { grid-template-columns: 1fr; gap: 18px; }
    .disco-info h1 { font-size: 24px; }
    .disco-info h2 { font-size: 17px; }
    .disc-carousel .disc-card { flex: 0 0 135px; }
}
