/* ============================================================ */
/*  LISTO CAR — Estilos del PANEL ADMIN (independientes)        */
/* ============================================================ */
:root{
  --dark:#0F1923;
  --dark-2:#162330;
  --dark-3:#1d2c3a;
  --orange:#F47B20;
  --orange-d:#d9650f;
  --white:#FFFFFF;
  --muted:#9fb0bf;
  --line:rgba(255,255,255,.10);
}
*{margin:0;padding:0;box-sizing:border-box}
body{
  font-family:'Montserrat',system-ui,sans-serif;
  background:var(--dark);
  color:var(--white);
  line-height:1.55;
  min-height:100vh;
}
h2,h3{font-family:'Saira Condensed','Montserrat',sans-serif;text-transform:uppercase;line-height:.95;letter-spacing:.01em}
a{color:inherit;text-decoration:none}
img{display:block;max-width:100%}
.orange{color:var(--orange)}
.wrap{width:min(1200px,92vw);margin:0 auto}

/* ---------- Botones ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.55em;
  font-family:'Saira Condensed',sans-serif;text-transform:uppercase;
  font-weight:700;font-size:1.05rem;letter-spacing:.03em;
  padding:.85em 1.6em;border-radius:999px;border:none;cursor:pointer;
  background:var(--orange);color:#fff;
  transition:transform .15s ease, box-shadow .2s ease, background .2s;
  box-shadow:0 8px 24px rgba(244,123,32,.35);
}
.btn:hover{transform:translateY(-2px);background:var(--orange-d);box-shadow:0 12px 30px rgba(244,123,32,.45)}

/* ---------- Barra superior ---------- */
.admin-top{position:sticky;top:0;background:var(--dark);border-bottom:1px solid var(--line);z-index:5}
.admin-top .wrap{display:flex;align-items:center;justify-content:space-between;height:70px;gap:1rem}
.admin-top .logo{display:flex;align-items:center;gap:.6rem}
.admin-top .logo img{height:38px;border-radius:8px}
.admin-top .logo .name{font-family:'Saira Condensed';font-weight:800;font-size:1.4rem}
.admin-top .tag{font-size:.75rem;color:var(--muted);letter-spacing:.18em;text-transform:uppercase;font-weight:700;margin-left:.6rem}
.top-actions{display:flex;align-items:center;gap:.8rem}
.link-btn{font-size:.85rem;color:var(--muted);font-weight:600;transition:color .2s}
.link-btn:hover{color:var(--orange)}

/* ---------- Campos de formulario ---------- */
.field{margin-bottom:1.1rem}
.field label{display:block;font-weight:600;font-size:.85rem;margin-bottom:.4rem;color:#cdd9e3}
.field input,.field textarea{
  width:100%;background:var(--dark);border:1px solid var(--line);border-radius:10px;
  padding:.8rem 1rem;color:#fff;font-family:inherit;font-size:.95rem;transition:border-color .2s;
}
.field input:focus,.field textarea:focus,.field select:focus{outline:none;border-color:var(--orange)}
.field textarea{resize:vertical;min-height:80px}
.field select{
  width:100%;background:var(--dark);border:1px solid var(--line);border-radius:10px;
  padding:.8rem 1rem;color:#fff;font-family:inherit;font-size:.95rem;transition:border-color .2s;
  cursor:pointer;
}
.field select option{background:var(--dark-2)}
.field-check{display:flex;align-items:center;gap:.7rem;margin-bottom:1.1rem;cursor:pointer}
.field-check input[type=checkbox]{width:18px;height:18px;accent-color:var(--orange);cursor:pointer;flex:none}
.field-check span{font-weight:600;font-size:.9rem;color:#cdd9e3}

/* ---------- Login ---------- */
.login-box{max-width:400px;margin:14vh auto;background:var(--dark-2);border:1px solid var(--line);border-radius:18px;padding:2.6rem}
.login-box .ico{width:64px;height:64px;margin:0 auto 1.3rem;border-radius:50%;display:grid;place-items:center;border:2px solid var(--orange)}
.login-box .ico svg{width:30px;height:30px;stroke:var(--orange);fill:none;stroke-width:2}
.login-box h2{text-align:center;font-size:1.9rem;font-weight:800;margin-bottom:.4rem}
.login-box p{text-align:center;color:var(--muted);font-size:.9rem;margin-bottom:1.8rem}
.login-err{color:#ff6b6b;font-size:.85rem;text-align:center;margin-top:.6rem;min-height:1.2em}

/* ---------- Dashboard ---------- */
.dash{padding:2.5rem 0 4rem}
.dash-grid{display:grid;grid-template-columns:380px 1fr;gap:2.2rem;align-items:start}
.panel{background:var(--dark-2);border:1px solid var(--line);border-radius:16px;padding:1.8rem}
.panel h3{font-size:1.4rem;font-weight:700;margin-bottom:1.3rem;display:flex;align-items:center;gap:.6rem}
.panel h3 .num{background:var(--orange);color:#fff;font-size:.85rem;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;font-family:'Montserrat';font-weight:700}

/* ---------- 3 fotos ---------- */
.photos-section{margin-bottom:1.1rem}
.photos-label{font-weight:600;font-size:.85rem;color:#cdd9e3;margin-bottom:.6rem}
.photos-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.7rem}
.photo-slot{display:flex;flex-direction:column;gap:.3rem}
.slot-label{font-size:.72rem;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.preview-img{width:100%;aspect-ratio:16/10;object-fit:cover;border-radius:8px;display:none}
.upload-zone{
  border:2px dashed var(--line);border-radius:8px;padding:.9rem .5rem;
  text-align:center;cursor:pointer;transition:.2s;
}
.upload-zone:hover{border-color:var(--orange);background:rgba(244,123,32,.05)}
.upload-zone svg{width:22px;height:22px;stroke:var(--muted);fill:none;stroke-width:2;margin-bottom:.3rem;display:block;margin-inline:auto}
.upload-label{display:block;color:var(--muted);font-size:.72rem;word-break:break-all}
.clear-photo-btn{
  background:none;border:1px solid var(--line);color:var(--muted);
  border-radius:6px;padding:.25rem;font-size:.72rem;cursor:pointer;
  transition:.2s;display:none;font-family:inherit;
}
.clear-photo-btn:hover{border-color:#ff6b6b;color:#ff6b6b}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:.9rem}
.msg{font-size:.85rem;margin-top:.5rem;min-height:1.2em}
.msg.ok{color:#3ddc84}.msg.err{color:#ff6b6b}.msg.info{color:var(--orange)}

/* ---------- Tabla ---------- */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.9rem}
th,td{text-align:left;padding:.85rem .8rem;border-bottom:1px solid var(--line);vertical-align:middle}
th{color:var(--muted);font-weight:600;text-transform:uppercase;font-size:.72rem;letter-spacing:.08em}
td .thumb{width:64px;height:42px;object-fit:cover;border-radius:6px;background:#0a121a}
td .nm{font-weight:700}
td .pr{color:var(--orange);font-weight:700;font-family:'Saira Condensed';font-size:1.1rem}
.row-actions{display:flex;gap:.5rem}
.icon-btn{width:34px;height:34px;border-radius:8px;border:1px solid var(--line);background:var(--dark);color:var(--muted);cursor:pointer;display:grid;place-items:center;transition:.2s}
.icon-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2}
.icon-btn.edit:hover{border-color:var(--orange);color:var(--orange)}
.icon-btn.del:hover{border-color:#ff6b6b;color:#ff6b6b}
.editing-banner{background:rgba(244,123,32,.12);border:1px solid rgba(244,123,32,.4);color:var(--orange);padding:.6rem 1rem;border-radius:10px;font-size:.85rem;margin-bottom:1rem;display:none;align-items:center;justify-content:space-between}
.editing-banner button{background:none;border:none;color:var(--orange);cursor:pointer;text-decoration:underline;font-size:.85rem}
.demo-flag{display:inline-block;background:rgba(159,176,191,.15);color:var(--muted);font-size:.65rem;padding:.15em .5em;border-radius:4px;margin-left:.4rem;text-transform:uppercase;letter-spacing:.05em;font-weight:700}

.fb-warn{background:rgba(244,123,32,.1);border:1px solid rgba(244,123,32,.35);border-radius:12px;padding:1rem 1.3rem;margin-bottom:2rem;color:#ffd9b8;font-size:.85rem;line-height:1.5}
.fb-warn b{color:var(--orange)}

/* ---------- Dropdown personalizado (genérico) ---------- */
.custom-select{ position:relative; }
.cs-trigger{
  width:100%; display:flex; align-items:center; gap:.7rem;
  background:var(--dark); border:1px solid var(--line); border-radius:10px;
  padding:.8rem 1rem; cursor:pointer; color:#fff; font-family:inherit; font-size:.95rem;
  transition:border-color .2s;
}
.cs-trigger:hover{ border-color:rgba(255,255,255,.25); }
.cs-trigger.active{ border-color:var(--orange); }
.cs-value{ flex:1; text-align:left; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cs-value.placeholder{ color:var(--muted); font-weight:400; }
.cs-chevron{ width:18px; height:18px; stroke:var(--muted); fill:none; stroke-width:2; flex-shrink:0; transition:transform .2s; }
.cs-trigger.active .cs-chevron{ transform:rotate(180deg); }

.cs-menu{
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:20;
  background:var(--dark-2); border:1px solid var(--line); border-radius:12px;
  padding:.4rem; max-height:260px; overflow-y:auto;
  box-shadow:0 16px 40px rgba(0,0,0,.5);
  display:none; flex-direction:column; gap:.1rem;
}
.cs-menu.open{ display:flex; }
.cs-menu::-webkit-scrollbar{ width:8px; }
.cs-menu::-webkit-scrollbar-thumb{ background:var(--dark-3); border-radius:8px; }
.cs-option{
  display:flex; align-items:center; gap:.6rem; width:100%;
  background:none; border:none; border-radius:8px; cursor:pointer;
  padding:.6rem .7rem; color:#fff; font-family:inherit; font-size:.92rem;
  text-align:left; transition:background .15s;
}
.cs-option span{ flex:1; font-weight:600; }
.cs-option:hover{ background:var(--dark-3); }
.cs-check{ width:18px; height:18px; stroke:var(--orange); fill:none; stroke-width:2.5; opacity:0; flex-shrink:0; }
.cs-option.selected{ background:rgba(244,123,32,.12); }
.cs-option.selected .cs-check{ opacity:1; }

/* ---------- Toggle switch (A/C) ---------- */
.field-toggle{
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  background:var(--dark); border:1px solid var(--line); border-radius:12px;
  padding:.85rem 1.1rem; margin-bottom:1.1rem; cursor:pointer;
}
.ft-text{ display:flex; align-items:center; gap:.6rem; font-weight:600; font-size:.92rem; color:#cdd9e3; }
.ft-ico{ width:18px; height:18px; stroke:var(--muted); fill:none; stroke-width:2; flex-shrink:0; transition:stroke .2s; }
.switch{ position:relative; flex-shrink:0; }
.switch input{ position:absolute; opacity:0; width:0; height:0; }
.switch-track{
  display:block; width:50px; height:28px; border-radius:999px;
  background:var(--dark-3); border:1px solid var(--line);
  transition:background .25s, border-color .25s;
}
.switch-thumb{
  position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%;
  background:#fff; transition:transform .25s; box-shadow:0 2px 6px rgba(0,0,0,.4);
}
.switch input:checked + .switch-track{ background:var(--orange); border-color:var(--orange); }
.switch input:checked + .switch-track .switch-thumb{ transform:translateX(22px); }
.field-toggle:has(input:checked) .ft-ico{ stroke:var(--orange); }
.field-toggle:has(input:checked) .ft-text{ color:#fff; }

/* ---------- Color Dropdown ---------- */
.color-select{ position:relative; }

/* Punto de color reutilizable */
.cdot{
  width:18px; height:18px; border-radius:50%; flex-shrink:0;
  border:1px solid rgba(255,255,255,.15);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.25);
}
.cdot.light{ border-color:rgba(255,255,255,.35); }
.cdot-rainbow{
  background:conic-gradient(#ff0000,#ff8000,#ffff00,#00cc00,#00ccff,#0044ff,#cc00ff,#ff0000);
  border-color:rgba(255,255,255,.3);
}

/* Botón disparador */
.color-select-trigger{
  width:100%; display:flex; align-items:center; gap:.7rem;
  background:var(--dark); border:1px solid var(--line); border-radius:10px;
  padding:.8rem 1rem; cursor:pointer; color:#fff; font-family:inherit; font-size:.95rem;
  transition:border-color .2s;
}
.color-select-trigger:hover{ border-color:rgba(255,255,255,.25); }
.color-select-trigger.active{ border-color:var(--orange); }
.color-trigger-content{ display:flex; align-items:center; gap:.6rem; flex:1; min-width:0; }
.color-trigger-name{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.color-trigger-placeholder{ color:var(--muted); }
.color-chevron{ width:18px; height:18px; stroke:var(--muted); fill:none; stroke-width:2; flex-shrink:0; transition:transform .2s; }
.color-select-trigger.active .color-chevron{ transform:rotate(180deg); }

/* Menú desplegable */
.color-menu{
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:20;
  background:var(--dark-2); border:1px solid var(--line); border-radius:12px;
  padding:.4rem; max-height:280px; overflow-y:auto;
  box-shadow:0 16px 40px rgba(0,0,0,.5);
  display:none; flex-direction:column; gap:.1rem;
}
.color-menu.open{ display:flex; }
.color-menu::-webkit-scrollbar{ width:8px; }
.color-menu::-webkit-scrollbar-thumb{ background:var(--dark-3); border-radius:8px; }

.color-option{
  display:flex; align-items:center; gap:.7rem; width:100%;
  background:none; border:none; border-radius:8px; cursor:pointer;
  padding:.6rem .7rem; color:#fff; font-family:inherit; font-size:.92rem;
  text-align:left; transition:background .15s;
}
.color-option:hover{ background:var(--dark-3); }
.color-option-name{ flex:1; font-weight:600; }
.color-check{ width:18px; height:18px; stroke:var(--orange); fill:none; stroke-width:2.5; opacity:0; flex-shrink:0; }
.color-option.selected{ background:rgba(244,123,32,.12); }
.color-option.selected .color-check{ opacity:1; }
.color-option-other{ border-top:1px solid var(--line); border-radius:0 0 8px 8px; margin-top:.2rem; }

/* Panel de color personalizado */
.color-custom-panel{
  display:none; align-items:center; gap:.7rem; flex-wrap:wrap;
  background:var(--dark); border:1px solid var(--line); border-radius:10px;
  padding:.7rem .8rem; margin-top:.5rem;
}
.color-custom-panel.open{ display:flex; }
.color-custom-pick{ position:relative; width:42px; height:42px; flex-shrink:0; cursor:pointer; }
.color-custom-pick input[type=color]{
  position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer;
}
.color-custom-swatch{
  display:block; width:42px; height:42px; border-radius:9px;
  border:1px solid rgba(255,255,255,.2); background:#888;
  box-shadow:inset 0 1px 3px rgba(0,0,0,.3);
}
.color-custom-hex{ font-family:monospace; font-size:.95rem; color:var(--orange); font-weight:700; letter-spacing:.05em; }
.color-custom-apply{ font-size:.85rem; padding:.55em 1.1em; margin-left:auto; box-shadow:none; }

/* ---------- Responsive ---------- */
@media(max-width:980px){
  .dash-grid{grid-template-columns:1fr}
}

@media(max-width:760px){
  .admin-top .tag{display:none}
  .form-row{grid-template-columns:1fr}
}

/* ===== Mobile-first (≤ 600px) ===== */
@media(max-width:600px){
  /* Top bar compacta */
  .admin-top .wrap{height:58px}
  .admin-top .logo img{height:30px}
  .admin-top .logo .name{font-size:1.2rem}
  .top-actions{gap:.5rem}
  .link-btn{font-size:.78rem}

  /* Login */
  .login-box{margin:6vh auto;padding:1.6rem}

  /* Wrap más amplio */
  .wrap{width:97vw}
  .panel{padding:1rem}
  .dash{padding:1.5rem 0 3rem}

  /* Inputs: 16px evita zoom en iOS */
  .field input,
  .field textarea,
  .field select{font-size:16px;padding:.75rem .85rem}
  .color-select-trigger{font-size:16px;padding:.85rem .9rem}
  .color-menu{max-height:50vh}
  .color-option{padding:.8rem .7rem;font-size:.95rem}
  .color-custom-apply{width:100%;margin-left:0}
  .cs-trigger{font-size:16px;padding:.85rem .9rem}
  .cs-menu{max-height:50vh}
  .cs-option{padding:.8rem .7rem;font-size:.95rem}
  .btn{font-size:1rem;padding:.9em 1.4em}

  /* Fotos: apilar verticalmente, más espacio para tocar */
  .photos-grid{grid-template-columns:1fr;gap:.9rem}
  .preview-img{aspect-ratio:16/10;width:100%;height:auto;border-radius:10px}
  .upload-zone{padding:1.2rem .5rem}
  .upload-zone svg{width:28px;height:28px;margin-bottom:.5rem}
  .upload-label{font-size:.8rem}
  .clear-photo-btn{padding:.4rem .6rem;font-size:.8rem}

  /* Tabla → Tarjetas */
  .table-wrap{overflow-x:unset}
  table thead{display:none}
  table,table tbody{display:block}
  table tr{
    display:grid;
    grid-template-columns:74px 1fr 76px;
    grid-template-rows:auto auto;
    align-items:center;
    column-gap:.65rem;
    background:var(--dark);
    border:1px solid var(--line);
    border-radius:12px;
    padding:.75rem;
    margin-bottom:.6rem;
  }
  table td{display:block;padding:0;border:none}
  table td:nth-child(1){grid-column:1;grid-row:1/3}
  table td:nth-child(2){grid-column:2;grid-row:1;padding-bottom:.15rem}
  table td:nth-child(3){display:none}
  table td:nth-child(4){grid-column:2;grid-row:2}
  table td:nth-child(5){grid-column:3;grid-row:1/3;display:flex;align-items:center}
  td .thumb{width:72px;height:54px;border-radius:8px}
  td .nm{font-size:.88rem}
  td .pr{font-size:1rem}
  .row-actions{flex-direction:column;gap:.4rem}
  .icon-btn{width:40px;height:40px}

  /* Banner de edición */
  .editing-banner{flex-direction:column;align-items:flex-start;gap:.4rem}

  /* Panel h3 */
  .panel h3{font-size:1.25rem}
}

@media(max-width:380px){
  .admin-top .wrap{flex-wrap:wrap;height:auto;padding:.6rem 0}
  .top-actions .link-btn:first-child{display:none}
}
