/* OPENTCG Global Design Tokens & Custom Utilities */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;800;900&family=JetBrains+Mono:wght@700;800&display=swap');

:root {
    --bg-dark: #09090b;
    --bg-panel: #18181b;
    --primary-red: #ef4444;
    --primary-red-hover: #dc2626;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: 'Outfit', sans-serif;
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(24, 24, 27, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #09090b;
}
::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #ef4444;
}

/* Text & Button Effects */
.text-glow-red {
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.8), 0 0 40px rgba(239, 68, 68, 0.4) !important;
}

.badge-glow {
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* ================================================================
   OPENTCG 2.0 — Marketplace & intelligence visual system
   ================================================================ */
:root {
    --tm-bg: #070708;
    --tm-surface: #101012;
    --tm-surface-2: #17171a;
    --tm-surface-3: #202024;
    --tm-red: #f0444d;
    --tm-red-strong: #dc2733;
    --tm-red-soft: rgba(240, 68, 77, .12);
    --tm-green: #31d08b;
    --tm-amber: #f6b94a;
    --tm-blue: #5b8cff;
    --tm-text: #f7f7f8;
    --tm-muted: #9999a3;
    --tm-line: rgba(255, 255, 255, .085);
    --tm-radius: 18px;
    --tm-shadow: 0 22px 70px rgba(0, 0, 0, .42);
}

html { scroll-behavior: smooth; }

body {
    background:
        radial-gradient(circle at 12% -10%, rgba(240, 68, 77, .08), transparent 28rem),
        radial-gradient(circle at 90% 12%, rgba(91, 140, 255, .055), transparent 30rem),
        var(--tm-bg);
    color: var(--tm-text);
    min-width: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 1;
    z-index: -1;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 38px 38px;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 5%, #000 18%, transparent 82%);
    mask-image: radial-gradient(ellipse 85% 75% at 50% 5%, #000 18%, transparent 82%);
}

/* Buyer-facing pages stay product-first; operational analytics live in seller/admin. */
.tm-page-home main > section:nth-of-type(2),
.tm-page-comprar main > section:first-of-type {
    display: none;
}

body > header {
    background: rgba(7, 7, 8, .82) !important;
    border-color: var(--tm-line) !important;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
}

body > header > div {
    min-width: 0;
}

body > main {
    max-width: 1440px !important;
}

.glass-panel,
.tcg-card {
    background: linear-gradient(145deg, rgba(25,25,29,.92), rgba(13,13,15,.96)) !important;
    border: 1px solid var(--tm-line) !important;
    box-shadow: 0 16px 50px rgba(0,0,0,.25);
}

.tcg-card {
    overflow: hidden;
    transform: translateZ(0);
    transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.tcg-card:hover {
    transform: translateY(-6px);
    border-color: rgba(240, 68, 77, .42) !important;
    box-shadow: 0 28px 70px rgba(0,0,0,.44), 0 0 0 1px rgba(240,68,77,.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--tm-red), var(--tm-red-strong)) !important;
    box-shadow: 0 10px 30px rgba(240,68,77,.24);
    font-weight: 800;
    letter-spacing: -.01em;
}

.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

input, select, textarea {
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(240,68,77,.72) !important;
    box-shadow: 0 0 0 4px rgba(240,68,77,.10) !important;
}

/* Shared app shell */
.tm-market-pulse {
    position: sticky;
    top: 64px;
    z-index: 35;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--tm-line);
    background: rgba(11,11,13,.88);
    backdrop-filter: blur(18px);
}

.tm-market-pulse__inner {
    width: min(100%, 1440px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--tm-line);
}

.tm-pulse-item {
    min-width: 0;
    padding: 9px 16px;
    background: rgba(11,11,13,.96);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.tm-pulse-label { color: var(--tm-muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.tm-pulse-value { color: #fff; font: 800 11px/1.2 'JetBrains Mono', monospace; white-space: nowrap; }
.tm-pulse-trend { color: var(--tm-green); font-size: 9px; font-weight: 800; }

.tm-mobile-menu-btn {
    display: none;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tm-line);
    border-radius: 12px;
    color: #fff;
    background: var(--tm-surface-2);
}

.tm-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    transition: .22s ease;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(8px);
}

.tm-mobile-drawer.is-open { visibility: visible; opacity: 1; }
.tm-mobile-drawer__panel {
    width: min(88vw, 360px);
    height: 100%;
    padding: 22px;
    background: #0e0e10;
    border-right: 1px solid var(--tm-line);
    transform: translateX(-100%);
    transition: transform .26s ease;
    box-shadow: 30px 0 80px rgba(0,0,0,.5);
}
.tm-mobile-drawer.is-open .tm-mobile-drawer__panel { transform: translateX(0); }
.tm-mobile-drawer__nav { display: grid; gap: 8px; margin-top: 28px; }
.tm-mobile-drawer__nav a {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 13px;
    color: #d7d7dc; font-size: 13px; font-weight: 800; border: 1px solid transparent;
}
.tm-mobile-drawer__nav a:hover, .tm-mobile-drawer__nav a.is-current { color: #fff; background: var(--tm-red-soft); border-color: rgba(240,68,77,.22); }

/* Data-rich sections */
.tm-insights {
    margin: 12px 0 42px;
    display: grid;
    gap: 16px;
}

.tm-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.tm-eyebrow { color: var(--tm-red); font-size: 10px; line-height: 1; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.tm-section-title { margin-top: 8px; color: #fff; font: 800 clamp(22px,3vw,34px)/1.05 'Outfit', sans-serif; letter-spacing: -.035em; }
.tm-section-copy { max-width: 620px; color: var(--tm-muted); font-size: 12px; line-height: 1.65; }

.tm-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.tm-kpi {
    position: relative; overflow: hidden; min-height: 128px; padding: 18px;
    border-radius: var(--tm-radius); border: 1px solid var(--tm-line);
    background: linear-gradient(145deg, rgba(25,25,29,.94), rgba(12,12,14,.98));
}
.tm-kpi::after { content:""; position:absolute; width:100px; height:100px; right:-45px; bottom:-55px; border-radius:50%; background:var(--tm-red-soft); filter:blur(6px); }
.tm-kpi-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tm-kpi-icon { width:32px; height:32px; border-radius:10px; display:grid; place-items:center; color:var(--tm-red); background:var(--tm-red-soft); border:1px solid rgba(240,68,77,.18); }
.tm-kpi-delta { font-size:9px; color:var(--tm-green); font-weight:900; }
.tm-kpi-value { display:block; margin-top:15px; color:#fff; font:800 clamp(20px,2vw,28px)/1 'JetBrains Mono',monospace; letter-spacing:-.05em; }
.tm-kpi-label { display:block; margin-top:7px; color:var(--tm-muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; }

.tm-analytics-grid { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(280px,.8fr); gap:14px; }
.tm-panel { border:1px solid var(--tm-line); border-radius:var(--tm-radius); background:linear-gradient(145deg,rgba(22,22,25,.96),rgba(10,10,12,.98)); padding:20px; min-width:0; }
.tm-panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; }
.tm-panel-title { color:#fff; font-size:13px; font-weight:900; }
.tm-panel-note { color:var(--tm-muted); font-size:9px; font-weight:700; }

.tm-bars { height:180px; display:flex; align-items:flex-end; gap:10px; padding-top:18px; border-bottom:1px solid var(--tm-line); background:repeating-linear-gradient(to bottom, transparent 0, transparent 44px, rgba(255,255,255,.045) 45px); }
.tm-bar-wrap { flex:1; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:8px; min-width:0; }
.tm-bar { width:min(100%,34px); min-height:5px; border-radius:7px 7px 2px 2px; background:linear-gradient(to top,var(--tm-red-strong),#ff6971); box-shadow:0 -8px 24px rgba(240,68,77,.14); transition:height .5s ease; }
.tm-bar-label { color:#777781; font-size:8px; font-weight:800; text-transform:uppercase; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }

.tm-distribution { display:grid; gap:14px; }
.tm-dist-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; }
.tm-dist-name { color:#d7d7dc; font-size:10px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tm-dist-value { color:#fff; font:800 10px 'JetBrains Mono',monospace; }
.tm-dist-track { grid-column:1/-1; height:6px; overflow:hidden; border-radius:99px; background:#242428; }
.tm-dist-fill { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--tm-red-strong),var(--tm-red)); }

.tm-process-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:0 0 42px; }
.tm-process-card { position:relative; min-height:150px; padding:20px; overflow:hidden; border:1px solid var(--tm-line); border-radius:var(--tm-radius); background:rgba(17,17,19,.88); }
.tm-process-number { position:absolute; right:13px; top:5px; font:900 58px 'Outfit',sans-serif; color:rgba(255,255,255,.035); }
.tm-process-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; color:#fff; background:var(--tm-red); box-shadow:0 10px 25px rgba(240,68,77,.2); }
.tm-process-card h3 { margin-top:18px; font-size:14px; font-weight:900; color:#fff; }
.tm-process-card p { margin-top:7px; color:var(--tm-muted); font-size:11px; line-height:1.55; }

.tm-faq { margin: 12px 0 42px; display:grid; grid-template-columns:minmax(230px,.55fr) minmax(0,1fr); gap:24px; }
.tm-faq-list { display:grid; gap:8px; }
.tm-faq details { border:1px solid var(--tm-line); border-radius:14px; background:rgba(18,18,21,.9); padding:0 16px; }
.tm-faq summary { list-style:none; cursor:pointer; padding:15px 0; color:#f1f1f3; font-size:12px; font-weight:850; display:flex; justify-content:space-between; gap:12px; }
.tm-faq summary::after { content:"+"; color:var(--tm-red); font-size:18px; line-height:12px; }
.tm-faq details[open] summary::after { content:"–"; }
.tm-faq details p { padding:0 0 16px; color:var(--tm-muted); font-size:11px; line-height:1.65; }

/* Existing sections refined */
#listingsGrid, #sellersDirectoryGrid, #sellerInventoryGrid { align-items:stretch; }
#listingsGrid .tcg-card, #sellerInventoryGrid .tcg-card { border-radius:18px !important; }
.tcg-card-img-wrapper { background:radial-gradient(circle at 50% 30%,#222229,#09090a) !important; }
.tcg-card-img { transition:transform .35s ease,opacity .25s ease; }
.tcg-card:hover .tcg-card-img { transform:scale(1.035); }

table { border-collapse:separate !important; border-spacing:0; }
thead th { color:#a4a4ad !important; background:#151518 !important; }
tbody tr { transition:background .18s ease; }
tbody tr:hover { background:rgba(240,68,77,.035) !important; }

.tm-scroll-table { overflow-x:auto; border-radius:16px; border:1px solid var(--tm-line); scrollbar-gutter:stable; width:100%; max-width:100%; min-width:0; }
.tm-scroll-table table { min-width:720px; }

.tm-empty { padding:48px 24px; text-align:center; color:var(--tm-muted); border:1px dashed rgba(255,255,255,.12); border-radius:18px; background:rgba(255,255,255,.018); }

@media (max-width: 1023px) {
    .tm-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tm-analytics-grid { grid-template-columns:1fr; }
    .tm-market-pulse__inner { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tm-pulse-item:nth-child(n+3) { display:none; }
}

@media (max-width: 767px) {
    body { overflow-x:hidden; }
    body > header > div { height:60px !important; padding-left:14px !important; padding-right:14px !important; gap:8px !important; }
    body > header a span.text-xl, body > header a span.font-bold.text-xl { font-size:16px !important; }
    body > header nav { display:none !important; }
    body > header #dolarBlueRateDisplay { display:none !important; }
    body > header #unauthButtons #openRegisterBtn { display:none !important; }
    body > header #unauthButtons { flex:0 0 auto; gap:5px !important; }
    body > header #unauthButtons #openLoginBtn { padding:8px 10px !important; }
    body > header .flex.items-center.gap-2\.5 { min-width:0; gap:5px !important; }
    body > header #openMessagesBtn, body > header #openOrdersHeaderBtn, body > header #openCartBtn { width:36px !important; height:36px !important; flex:0 0 36px; }
    .tm-page-producto > header > div > .flex.items-center.gap-2\.5 > a,
    .tm-page-producto > header #unauthButtons { display:none !important; }
    .tm-page-producto > header #cartDrawerBtn { width:36px !important; height:36px !important; flex:0 0 36px; }
    .tm-page-admin > header > div > div:last-child { display:none !important; }
    .tm-page-admin > header > div > div:first-child > span { display:none !important; }
    main > *, main section, main article { min-width:0; }
    .tm-mobile-menu-btn { display:flex; }
    .tm-market-pulse { top:60px; max-width: 100vw; overflow-x: hidden; }
    .tm-pulse-item { padding:5px 8px; gap:4px; justify-content:center; text-align:center; flex-wrap:nowrap; overflow:hidden; }
    .tm-pulse-label { font-size:7.5px; letter-spacing:0.02em; }
    .tm-pulse-value { font-size:9.5px; line-height:1.2; }
    body > main { padding:14px 10px 28px !important; max-width: 100vw !important; overflow-x: hidden !important; }
    body > main > section:first-child { border-radius:18px !important; padding:20px 14px !important; }
    body > main > section:first-child h1 { font-size:clamp(24px,7.5vw,34px) !important; }
    #searchInput { padding-left:40px !important; padding-right:12px !important; font-size:12.5px !important; }
    #searchForm button[type="submit"] { display:none !important; }
    .tm-section-head { align-items:flex-start; flex-direction:column; }
    .tm-section-copy { font-size:11px; }
    .tm-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .tm-kpi { min-height:112px; padding:14px; }
    .tm-kpi-value { font-size:18px; }
    .tm-process-grid { grid-template-columns:1fr; }
    .tm-process-card { min-height:130px; }
    .tm-faq { grid-template-columns:1fr; }
    .tm-bars { height:150px; gap:5px; }
    .tm-bar-label { font-size:7px; }
    
    /* 2 CARDS PER ROW ON MOBILE PHONES WITH COMPACT STYLING */
    #listingsGrid, #sellersDirectoryGrid { 
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; 
        gap: 8px !important; 
        width: 100% !important;
        max-width: 100% !important;
    }
    #sellerInventoryGrid { grid-template-columns: 1fr !important; }
    
    #listingsGrid .tcg-card, #sellersDirectoryGrid .tcg-card { 
        border-radius: 14px !important; 
    }
    #listingsGrid .tcg-card .p-5, #sellerInventoryGrid .tcg-card .p-5 { 
        padding: 8px !important; 
    }
    #listingsGrid .tcg-card h3 { 
        font-size: 11px !important; 
        line-height: 1.2 !important; 
        margin-bottom: 2px !important; 
    }
    #listingsGrid .tcg-card p { 
        font-size: 9px !important; 
        margin-bottom: 4px !important; 
    }
    #listingsGrid .tcg-card .text-2xl { 
        font-size: 13px !important; 
        line-height: 1.1 !important; 
    }
    #listingsGrid .tcg-card .text-\[11px\] { 
        font-size: 9px !important; 
    }
    #listingsGrid .tcg-card .btn-add-cart { 
        padding: 6px 4px !important; 
        font-size: 10px !important; 
        border-radius: 8px !important; 
        gap: 3px !important;
    }
    #listingsGrid .tcg-card .btn-camera-lightbox { 
        width: 26px !important; 
        height: 26px !important; 
        font-size: 11px !important; 
    }
    #listingsGrid .tcg-card .views-badge-item { 
        font-size: 8.5px !important; 
        padding: 2px 4px !important; 
    }
    .tm-scroll-table { margin-left:-1px; margin-right:-1px; }
}

@media (max-width: 360px) {
    #listingsGrid, #sellersDirectoryGrid { 
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; 
        gap: 6px !important; 
    }
    #listingsGrid .tcg-card .p-5 { 
        padding: 6px !important; 
    }
}
