/* /assets/app.css */
:root{
  --bg:#070a12;
  --card:#0c1222;
  --card2:#0a1020;
  --text:#e7ecff;
  --muted:#a9b2d6;
  --line:rgba(255,255,255,.08);
  --brand:#6d8bff;
  --ok:#34d399;
  --bad:#fb7185;
  --warn:#fbbf24;
  --radius:18px;
  --shadow: 0 20px 50px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(900px 500px at 20% 10%, rgba(109,139,255,.18), transparent 55%),
              radial-gradient(800px 500px at 80% 20%, rgba(52,211,153,.12), transparent 55%),
              var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

a{color:inherit;text-decoration:none}
.container{max-width:1120px;margin:0 auto;padding:20px}

.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 18px;border:1px solid var(--line);border-radius:var(--radius);
  background: rgba(12,18,34,.7); backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  position: sticky; top: 12px; z-index: 10;
}

.brand{display:flex;gap:10px;align-items:center;font-weight:800;letter-spacing:.2px}
.badge{
  font-size:12px;color:var(--muted);
  border:1px solid var(--line); padding:6px 10px;border-radius:999px;
  background: rgba(255,255,255,.03);
}

.nav{
  display:flex;gap:10px;align-items:center;flex-wrap:wrap;
}
.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
}
.btn.primary{
  background: linear-gradient(135deg, rgba(109,139,255,.95), rgba(109,139,255,.35));
  border-color: rgba(109,139,255,.35);
}
.btn.danger{
  background: linear-gradient(135deg, rgba(251,113,133,.95), rgba(251,113,133,.25));
  border-color: rgba(251,113,133,.35);
}
.btn:disabled{opacity:.5;cursor:not-allowed}

.grid{
  display:grid;grid-template-columns: 1.2fr .8fr; gap:16px; margin-top:16px;
}
@media(max-width:980px){ .grid{grid-template-columns:1fr} }

.card{
  background: rgba(12,18,34,.72);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding:16px 16px 10px 16px;
  border-bottom:1px solid var(--line);
  display:flex;align-items:flex-start;justify-content:space-between;gap:10px;
}
.card .hd h2{margin:0;font-size:18px}
.card .hd p{margin:6px 0 0 0;color:var(--muted);font-size:13px}
.card .bd{padding:16px}

.tabs{display:flex;gap:8px;flex-wrap:wrap}
.tab{
  padding:8px 10px;border-radius:999px;border:1px solid var(--line);
  background: rgba(255,255,255,.03); color:var(--muted); font-weight:800; cursor:pointer;
}
.tab.active{color:var(--text); border-color: rgba(109,139,255,.35);}

.products{
  display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px;
}
@media(max-width:720px){ .products{grid-template-columns:1fr} }

.pcard{
  background: rgba(10,16,32,.75);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
}
.pcard .img{height:140px;background: rgba(255,255,255,.02);display:flex;align-items:center;justify-content:center}
.pcard .img img{max-height:100%;max-width:100%;object-fit:contain}
.pcard .body{padding:12px}
.pcard h3{margin:0 0 6px 0;font-size:16px}
.muted{color:var(--muted);font-size:13px}
.meta{display:grid;grid-template-columns:1fr 1fr; gap:10px; margin-top:10px}
.meta b{display:block;margin-top:4px}
.row{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-top:12px}

.kpis{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.kpi{padding:12px;border:1px solid var(--line);border-radius:16px;background: rgba(255,255,255,.02)}
.kpi .big{font-size:20px;font-weight:900;margin-top:6px}

.table{
  width:100%; border-collapse: collapse; font-size:13px;
}
.table th,.table td{
  border-bottom:1px solid var(--line);
  padding:10px 8px;text-align:left; vertical-align: top;
}
.table th{color:var(--muted);font-weight:900}

.field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.field label{font-size:12px;color:var(--muted);font-weight:800}
.field input,.field textarea, .field select{
  padding:10px 12px; border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  outline:none;
}
.field textarea{min-height:90px;resize:vertical}

.modal{
  position:fixed; inset:0;
  display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.55);
  z-index: 50;
}
.modal .box{
  width:min(520px,92vw);
  border-radius: 18px;
  border:1px solid var(--line);
  background: rgba(12,18,34,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal .box .hd{padding:14px 14px;border-bottom:1px solid var(--line)}
.modal .box .bd{padding:14px}

#toast{
  position:fixed;left:50%;bottom:18px;transform:translateX(-50%);
  padding:12px 14px;border-radius:999px;border:1px solid var(--line);
  background: rgba(12,18,34,.92);
  display:none;
  font-weight:800;
  box-shadow: var(--shadow);
  z-index: 60;
}
#toast.show{display:block}
#toast[data-type="success"]{border-color: rgba(52,211,153,.35)}
#toast[data-type="error"]{border-color: rgba(251,113,133,.35)}
#toast[data-type="warn"]{border-color: rgba(251,191,36,.35)}

#loadingOverlay{
  position:fixed; inset:0; display:none;
  background: rgba(0,0,0,.6);
  align-items:center; justify-content:center;
  z-index: 70;
}
.loaderBox{
  width:min(420px,90vw);
  padding:18px;
  border-radius: 18px;
  border:1px solid var(--line);
  background: rgba(12,18,34,.92);
  box-shadow: var(--shadow);
}
.loaderBar{
  height:8px;border-radius:999px;background: rgba(255,255,255,.08);
  overflow:hidden;margin-top:10px;
}
.loaderBar > div{
  height:100%;width:45%;
  background: linear-gradient(90deg, rgba(109,139,255,.25), rgba(109,139,255,.95));
  animation: move 1.1s linear infinite;
}
@keyframes move{
  0%{transform:translateX(-120%)}
  100%{transform:translateX(260%)}
}

.authWrap{
  min-height:100vh;
  display:flex;align-items:center;justify-content:center;
  padding:20px;
}
.authCard{
  width:min(460px,92vw);
  border-radius: 22px;
  border:1px solid var(--line);
  background: rgba(12,18,34,.78);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding:18px;
}
.authCard h1{margin:0 0 6px 0}
.authCard .sub{margin:0 0 16px 0;color:var(--muted)}
.hr{height:1px;background:var(--line);margin:14px 0}
.small{font-size:13px;color:var(--muted)}

/* ===== Modal ===== */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:999;
}
.modalCard{
  width:min(520px, 100%);
  background:#0b1220;
  border:1px solid rgba(255,255,255,.08);
  border-radius:18px;
  box-shadow:0 20px 80px rgba(0,0,0,.4);
  overflow:hidden;
}
.modalHd{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.modalBd{ padding:16px; }
.modal .field{ margin-bottom:12px; }
.modal input{
  width:100%;
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.1);
  background:rgba(255,255,255,.04);
  color:#fff;
}

#loadingOverlay{
  position: fixed;
  inset: 0;
  z-index: 20000;
}

/* =========================
   PRO MEDIA MODAL (ML vibes)
   ========================= */

.modalCard{
  width: min(980px, 100%); /* más ancho pro */
}

/* layout 2 columnas dentro del modal */
.mMediaGrid{
  display:grid;
  grid-template-columns: 1.3fr .9fr;
  gap:14px;
  margin-bottom:12px;
}

@media(max-width:900px){
  .modalCard{ width:min(720px, 100%); }
  .mMediaGrid{ grid-template-columns: 1fr; }
}

/* panel imagen grande */
.mHero{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  border-radius:16px;
  overflow:hidden;
  height: 340px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}

.mHero img{
  width:100%;
  height:100%;
  object-fit: contain;
}

/* badge tipo video/galería */
.mChip{
  position:absolute;
  top:10px;
  left:10px;
  font-size:12px;
  color:var(--muted);
  border:1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.35);
  padding:6px 10px;
  border-radius:999px;
  backdrop-filter: blur(8px);
}

/* thumbs */
.mThumbs{
  display:flex;
  gap:10px;
  overflow:auto;
  padding:10px 2px 2px 2px;
}

.mThumb{
  min-width:92px;
  height:64px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  cursor:pointer;
  opacity:.85;
  transition: transform .12s ease, opacity .12s ease, border-color .12s ease;
}

.mThumb:hover{
  transform: translateY(-2px);
  opacity:1;
}

.mThumb.active{
  opacity:1;
  border-color: rgba(109,139,255,.55);
}

.mThumb img{
  width:100%;
  height:100%;
  object-fit: cover;
}

/* video box */
.mVideoBox{
  border:1px solid rgba(255,255,255,.08);
  border-radius:16px;
  overflow:hidden;
  background: rgba(255,255,255,.02);
}

.mVideoBox iframe{
  width:100%;
  height: 340px;
  border:0;
}

@media(max-width:900px){
  .mHero{ height: 280px; }
  .mVideoBox iframe{ height: 260px; }
}


/* =========================================================
   RESPONSIVE GLOBAL (sin cambiar estética)
   ========================================================= */

/* Mejor tipografía/espaciado en pantallas chicas */
@media (max-width: 980px){
  .container{ padding:14px; }
  .card .hd{ flex-direction:column; align-items:flex-start; }
  .tabs{ width:100%; }
}

/* TOPBAR: que no explote en mobile */
@media (max-width: 720px){
  .topbar{
    position: sticky;
    top: 10px;
    padding:12px 12px;
    gap:10px;
    flex-direction:column;
    align-items:flex-start;
  }
  .nav{
    width:100%;
    display:flex;
    gap:8px;
    flex-wrap:wrap;
  }
  .nav .btn{
    flex: 1 1 auto;          /* botones se acomodan */
    padding:10px 10px;
    text-align:center;
    white-space:nowrap;
  }
  .brand{
    width:100%;
    justify-content:space-between;
  }
}

/* Grid principal: 2 columnas -> 1 columna */
@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
}

/* =========================================================
   MARKETPLACE (cards + thumbs + imagen)
   ========================================================= */

/* Cards en 1 columna en mobile */
@media (max-width: 720px){
  .products{ grid-template-columns: 1fr; }
}

/* Imagen del producto: evita deformación y “saltos” */
.pcard .img{
  position:relative;
}
.pcard .img img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

/* Ajustes en mobile: más alto para que se vea bien */
@media (max-width: 720px){
  .pcard .img{ height: 190px; } /* antes 140: en móvil se ve mini */
  .pcard .body{ padding:12px; }
  .meta{ grid-template-columns: 1fr 1fr; gap:10px; }
}

/* Thumbnails (si tu JS los renderiza): que no tapen todo */
@media (max-width: 720px){
  .pcard [data-thumbs]{
    left:10px !important;
    right:10px !important;
    bottom:10px !important;
    padding:8px !important;
    gap:8px !important;
  }
  .pcard [data-thumbs] button{
    width:54px !important;
    height:40px !important;
  }
}

/* =========================================================
   MODAL (invertir): full-width en mobile + scroll interno
   ========================================================= */

@media (max-width: 720px){
  .modal{ padding:12px; }
  .modalCard{
    width: 100%;
    max-height: 88vh;
    overflow:auto;
    border-radius: 16px;
  }
  .modalHd{
    position: sticky;
    top: 0;
    z-index: 1;
    background: #0b1220;
  }
  .modalBd{ padding:14px; }
}

/* =========================================================
   TABLAS (Admin / Users / Movimientos / Retiros)
   - Solución universal: wrapper scrolleable
   ========================================================= */

.table{
  width:100%;
}

/* Truco: hacer la tabla scrolleable sin tocar HTML */
@media (max-width: 980px){
  .table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }
  .table thead, .table tbody, .table tr{
    display:table;
    width:100%;
    table-layout:auto;
  }
}

/* =========================================================
   KPIs / Sidebar: orden y respiración en mobile
   ========================================================= */

@media (max-width: 720px){
  .kpis{ grid-template-columns: 1fr; }
  .kpi .big{ font-size:18px; }
}
