/* ============================================================
   JMGame.es - Retro Gaming Theme
   ============================================================ */

:root {
    --bg:         #0a0a12;
    --bg-card:    #13131f;
    --bg-card-h:  #1c1c2e;
    --primary:    #ffd700;
    --primary-d:  #cc9900;
    --accent:     #ff4444;
    --wallapop:   #13c1ac;
    --wallapop-d: #0fa090;
    --text:       #e2e2f0;
    --text-muted: #7070a0;
    --border:     #2a2a42;
    --border-h:   #ffd70044;
    --green:      #39ff14;
    --radius:     8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* CRT scanlines overlay */
.scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    background: linear-gradient(180deg, #050510 0%, #0a0a18 100%);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 4px 30px rgba(255, 215, 0, 0.15);
    padding: 24px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(18px, 3vw, 28px);
    color: var(--primary);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3);
    letter-spacing: -1px;
    line-height: 1.2;
}

.logo-es {
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

.logo-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-stat {
    text-align: center;
}

.stat-n {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 22px;
    color: var(--green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.stat-l {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-about {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-about:hover { background: var(--primary); color: #000; }

.btn-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--wallapop);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-profile:hover {
    background: var(--wallapop-d);
    transform: translateY(-1px);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    background: #0d0d1a;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.filter-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 0 0 260px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrap input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 9px 12px 9px 40px;
    font-family: 'Exo 2', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.search-wrap input::placeholder { color: var(--text-muted); }

.cat-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: var(--radius);
    font-family: 'Exo 2', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cat-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.cat-n {
    font-size: 11px;
    background: rgba(0,0,0,0.2);
    padding: 1px 5px;
    border-radius: 10px;
}

.cat-btn.active .cat-n {
    background: rgba(0,0,0,0.25);
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */
main {
    padding: 32px 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

/* ============================================================
   PRODUCT CARD
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.12);
}

.card--sold {
    opacity: 0.6;
}

.card--sold:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

/* Card image */
.card-img {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #0d0d1a;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.card:hover .card-img img {
    transform: scale(1.04);
}

.img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text-muted);
}

/* Badges */
.badge-sold {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
    letter-spacing: 2px;
}

.badge-cond {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.cond-new {
    background: var(--green);
    color: #000;
}

.cond-used {
    background: #444;
    color: var(--text);
}

/* Card body */
.card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.card-cat {
    font-size: 11px;
    color: var(--wallapop);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.card-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.card-price {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    color: var(--primary);
    text-shadow: 0 0 8px rgba(255,215,0,0.4);
}

.btn-wallapop {
    background: var(--wallapop);
    color: #fff;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-wallapop:hover {
    background: var(--wallapop-d);
}

.tag-sold {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================
   CARRUSEL
   ============================================================ */
.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.card:hover .carousel-slide img { transform: scale(1.04); }

.car-prev, .car-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .car-prev,
.card:hover .car-next { opacity: 1; }

.car-prev { left: 6px; }
.car-next { right: 6px; }
.car-prev:hover, .car-next:hover { background: rgba(0,0,0,0.85); }

.car-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.car-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: background 0.2s;
}

.car-dot.active { background: var(--primary); }

/* ============================================================
   SORT SELECT
   ============================================================ */
.sort-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-family: 'Exo 2', sans-serif;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-left: auto;
}
.sort-select:focus { border-color: var(--primary); }
.sort-select option { background: var(--bg-card); }

/* ============================================================
   CARD LINK / CLICKABLE
   ============================================================ */
.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.card-title-link {
    text-decoration: none;
    color: inherit;
}
.card-title-link:hover .card-title { color: var(--primary); }

/* Featured card */
.card--featured {
    border-color: rgba(255,215,0,0.35);
    box-shadow: 0 0 0 1px rgba(255,215,0,0.12);
}

.badge-star {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 16px;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(255,215,0,0.6));
    z-index: 2;
}

/* ============================================================
   PRODUCT DETAIL PAGE
   ============================================================ */
.detail-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 40px 0 80px;
    align-items: start;
}

/* Galería */
.detail-carousel {
    position: relative;
    width: 100%;
    border-radius: 10px;
    background: #0d0d1a;
    border: 1px solid var(--border);
    overflow: hidden;
}

.detail-track {
    display: flex;
    transition: transform 0.3s ease;
}

.detail-slide {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d0d1a;
}

.detail-slide img {
    display: block;
    width: 100%;
    max-height: 380px;
    object-fit: contain;
}

.detail-prev, .detail-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.detail-prev { left: 12px; }
.detail-next { right: 12px; }
.detail-prev:hover, .detail-next:hover { background: rgba(0,0,0,0.9); }

.detail-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 7px;
    z-index: 10;
}

.detail-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: background 0.2s;
    cursor: pointer;
}
.detail-dot.active { background: var(--primary); }

.detail-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.detail-thumb {
    width: 70px;
    height: 55px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.6;
}
.detail-thumb:hover { opacity: 1; }
.detail-thumb.active { border-color: var(--primary); opacity: 1; }

.detail-no-img {
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    border-radius: 10px;
    background: #0d0d1a;
    border: 1px solid var(--border);
}

/* Info panel */
.detail-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.4);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    width: fit-content;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-cat {
    font-size: 12px;
    color: var(--wallapop);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.badge-cond-detail {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.detail-title {
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
}

.detail-price {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(18px, 3vw, 28px);
    color: var(--primary);
    text-shadow: 0 0 15px rgba(255,215,0,0.4);
}

.detail-desc {
    font-size: 15px;
    color: #c0c0d8;
    line-height: 1.8;
    background: #13131f;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
}

.btn-wallapop-big {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--wallapop);
    color: #fff;
    text-decoration: none;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    transition: background 0.2s, transform 0.1s;
}
.btn-wallapop-big:hover { background: var(--wallapop-d); transform: translateY(-2px); }

.detail-sold-badge {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
    padding: 16px 0;
}

.detail-extra {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
    margin-top: 8px;
}
.btn-back:hover { color: var(--primary); }

@media (max-width: 768px) {
    .detail-wrap { grid-template-columns: 1fr; gap: 24px; padding: 24px 0 60px; }
    .sort-select { margin-left: 0; width: 100%; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
    filter: grayscale(0.5);
}

.empty-state p {
    font-size: 16px;
    font-family: 'Press Start 2P', monospace;
    line-height: 1.8;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    background: #050510;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 40px;
}

footer a {
    color: var(--wallapop);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .header-right { width: 100%; justify-content: space-between; }
    .filter-inner { flex-direction: column; align-items: stretch; }
    .search-wrap { flex: 1; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .card-body { padding: 10px; }
    .card-price { font-size: 11px; }
    .btn-wallapop { font-size: 11px; padding: 5px 9px; }
}

@media (max-width: 400px) {
    .logo-title { font-size: 16px; }
    .grid { grid-template-columns: 1fr 1fr; }
}
