/*********************************************************
 * GEM Teeth Selector – Stylesheet (ordenado)
 * - Mantiene las MISMAS clases que ya usas
 * - Modal más ancho
 * - Cada cuadrante = 1 fila de 8 dientes
 * - Tiles compactos y responsive
 **********************************************************/

/* =========================
   Variables de marca
   ========================= */
:root{
  --gts-accent1: #a733bb;          /* rgb(167, 51, 187) */
  --gts-accent2: #7d4ac7;          /* rgb(125, 74, 199) */
  --gts-panel:   #ffffff;
  --gts-bg:      #f8fafc;
  --gts-text:    #111827;
  --gts-muted:   #6b7280;
  --gts-border:  #e5e7eb;
  --gts-border-strong:#cbd5e1;

  /* focus ring violeta suave */
  --gts-ring: 0 0 0 2px rgba(167,51,187,.18), 0 8px 24px rgba(125,74,199,.22);
}

/* =========================
   Backdrop & contenedor modal (custom)
   ========================= */
.gts-backdrop{
  position:fixed; inset:0; display:none;
  background:rgba(17,24,39,.55);
  align-items:center; justify-content:center;
  padding:16px; z-index:9999;
}
.gts-backdrop.gts-show{ display:flex; }

.gts-modal{
  background:var(--gts-panel);
  width:min(1150px,100%); max-height:90vh;
  display:flex; flex-direction:column;
  border-radius:16px; overflow:hidden;
  box-shadow:0 25px 60px rgba(0,0,0,.25);
}
.gts-header,.gts-footer{
  padding:14px 16px; background:var(--gts-panel);
  border-bottom:1px solid var(--gts-border);
}
.gts-footer{
  border-top:1px solid var(--gts-border);
  border-bottom:none; display:flex; gap:10px; justify-content:flex-end;
}
.gts-content{ padding:14px 16px; overflow:auto; }

@media (max-width:640px){
  .gts-modal{ width:100%; height:100vh; max-height:100vh; border-radius:0; }
  .gts-content{ padding-bottom:80px; }
}

/* =========================
   Grid de secciones / cuadrantes
   ========================= */
.gts-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:820px){ .gts-grid{ grid-template-columns:1fr; } }

.gts-arch{
  background:#f9fafb; padding:12px;
  border:1px solid var(--gts-border);
  border-radius:14px;
}
.gts-arch h3{
  font-size:14px; margin:0 0 10px; color:var(--gts-muted);
}
.gts-row{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(50px, 1fr));
  gap:5px;
}
@media (max-width:520px){
  .gts-row{ grid-template-columns:repeat(auto-fit, minmax(60px, 1fr)); gap:8px; }
}
.gts-tip{ font-size:12.5px; color:var(--gts-muted); margin-top:10px; }

/* =========================
   Botones del modal (estilo GEM)
   ========================= */
.gts-btn{
  appearance:none; border:none; border-radius:8px; margin-top:8px;
  padding:10px 18px; cursor:pointer; font-weight:500; color:#fff;
  background:linear-gradient(90deg, var(--gts-accent1) 0%, var(--gts-accent2) 100%);
  transition: box-shadow .2s ease, transform .06s ease, opacity .15s ease;
}
.gts-btn:hover{ box-shadow:0 6px 18px rgba(125,74,199,.35); transform: translateY(-1px); }
.gts-btn:active{ transform: translateY(0); }
.gts-btn.gts-ghost{ opacity:.92; }  /* alternativa secundaria */

/* =========================
   Tile del diente (genérico)
   ========================= */
.gts-tooth{
  position:relative; user-select:none; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:2px; text-align:center;

  /* visual */
  background:#fff; border:1px solid var(--gts-border); border-radius:14px;
  padding:8px 8px 10px;
  transition: transform .12s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease, filter .18s ease;
}
.gts-tooth:hover{ transform:translateY(-2px); border-color:var(--gts-border-strong); }
.gts-tooth:focus-visible{ outline:none; box-shadow:var(--gts-ring); }

.gts-icon{ width:28px; height:28px; display:flex; align-items:center; justify-content:center; }
.gts-icon img, .gts-icon svg{ width:100%; height:100%; object-fit:contain; }
.gts-num{ font-size:12px; color:#111827; opacity:.85; font-weight:600; }

/* Estado seleccionado */
.gts-tooth.gts-selected{
  background:linear-gradient(180deg,#fff,#f7f3fb);
  border-color: rgba(167,51,187,.55);
  box-shadow: 0 0 0 2px rgba(167,51,187,.18), 0 8px 24px rgba(125,74,199,.25);
  transform:translateY(-2px); filter:saturate(1.05);
}
.gts-tooth.gts-selected .gts-icon img{ transform:scale(1.04); transition:transform .15s ease; }
.gts-tooth.gts-selected::after{
  content:""; position:absolute; top:6px; right:6px; width:16px; height:16px; border-radius:999px;
  background:linear-gradient(90deg,var(--gts-accent1),var(--gts-accent2));
  box-shadow:0 2px 8px rgba(125,74,199,.35);
  -webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M9.5 16.2 5.8 12.5l-1.4 1.4 5.1 5.1L19.9 9.6l-1.4-1.4z"/></svg>') center/12px 12px no-repeat;
          mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M9.5 16.2 5.8 12.5l-1.4 1.4 5.1 5.1L19.9 9.6l-1.4-1.4z"/></svg>') center/12px 12px no-repeat;
}

/* =========================
   Botón inline gris (Forminator)
   ========================= */
.gts-inline-wrap{ margin-top:8px; }
.gts-inline-btn{
  appearance:none; background:#f3f4f6; color:#374151; border:1px solid #e5e7eb; border-radius:10px;
  padding:10px 14px; font-weight:600; line-height:1;
  display:inline-flex; align-items:center; gap:8px; cursor:pointer; box-shadow:none;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.gts-inline-btn:hover{ background:#e5e7eb; border-color:#d1d5db; transform:translateY(-1px); }
.gts-inline-btn:focus-visible{ outline:none; box-shadow:0 0 0 3px rgba(17,24,39,.06); }
.gts-inline-btn:active{ transform:translateY(0); }

/* =========================================================
   BLOQUE Bootstrap modal (.gem-teeth-modal) – Ensanchar modal
   y cuadrantes en 1 fila de 8 (compacto)
   ========================================================= */

/* Modal más ancho (BS5 + fallback genérico/BS4) */
.gem-teeth-modal .modal-dialog{
  /* Bootstrap 5 */
  --bs-modal-width: 1320px;                           /* ajustable 1320–1440 */
  max-width: min(1320px, calc(100vw - 64px));
  /* Fallback BS4/genérico */
  width: calc(100vw - 64px);
}
.gem-teeth-modal .modal-dialog.modal-xl,
.gem-teeth-modal .modal-dialog.modal-lg{
  --bs-modal-width: 1320px;
  max-width: min(1320px, calc(100vw - 64px));
}

/* Cuadrante: SIEMPRE 8 columnas (compacto) */
.gem-teeth-modal .gem-quadrant{
  display:grid !important;
  grid-template-columns:repeat(8, minmax(64px, 1fr)) !important; /* compacto */
  gap:10px; align-items:stretch;
  padding:10px 12px;   /* panel más ceñido */
}

/* Tile del diente dentro del modal (compactación adicional) */
.gem-teeth-modal .gem-tooth,
.gem-teeth-modal [data-tooth],
.gem-teeth-modal .tooth,
.gem-teeth-modal button[data-num]{
  box-sizing:border-box;
  width:100% !important; min-width:0 !important; margin:0 !important;

  padding:6px;               /* más compacto */
  aspect-ratio:0.9/1;        /* un poco más bajo que cuadrado */
  border-radius:10px;        /* menos redondeo */
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  gap:4px;

  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 1px 2px rgba(0,0,0,.04);
}

/* Encabezado y wrapper de cuadrante */
.gem-teeth-modal .gem-quadrant-wrap{ padding:8px 10px; }
.gem-teeth-modal .gem-quadrant-title{
  margin:0 0 8px; font-size:14px; font-weight:600;
}

/* Icono y número dentro del modal (compactos) */
.gem-teeth-modal .gem-tooth-ico{ width:20px; height:20px; background-size:contain; }
.gem-teeth-modal .gem-tooth-num{ font-size:13px; line-height:1; font-weight:600; }

/* =========================
   Responsive
   ========================= */
@media (max-width:1280px){
  .gem-teeth-modal .gem-quadrant{
    grid-template-columns:repeat(8, minmax(56px, 1fr)) !important;
    gap:8px;
  }
  .gem-teeth-modal .gem-tooth,
  .gem-teeth-modal [data-tooth],
  .gem-teeth-modal .tooth{
    padding:5px; aspect-ratio:0.85/1; border-radius:8px;
  }
  .gem-teeth-modal .gem-tooth-ico{ width:18px; height:18px; }
  .gem-teeth-modal .gem-tooth-num{ font-size:12px; }
}

@media (max-width:980px){
  /* Modal ocupa casi todo el ancho */
  .gem-teeth-modal .modal-dialog{
    --bs-modal-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
  }
  /* Mantenemos 8 por fila con scroll horizontal suave si no entra */
  .gem-teeth-modal .gem-quadrant{
    grid-template-columns:repeat(8, 56px) !important;
    gap:8px; overflow-x:auto; padding-bottom:6px;
  }
  .gem-teeth-modal .gem-quadrant::-webkit-scrollbar{ height:6px; }
  .gem-teeth-modal .gem-quadrant::-webkit-scrollbar-thumb{ border-radius:4px; }
}
