:root{
  --primary:#007BFF;
  --primary-hover:#0056b3;
  --text:#333;
  --bg:url('assets/bg.jpeg'); /* fondo JPEG */
}

/* Reset: padding/border cuentan dentro del width */
*{ box-sizing: border-box; }

/* ====== BASE ====== */
body {
  margin:0;
  font-family: Arial, sans-serif;
  color: var(--text);
}

h2 { text-align:center; }

/* Botones base */
button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  margin-top: 10px;
  cursor: pointer;
  border-radius: 5px;
  width: 100%;
}
button:hover { background: var(--primary-hover); }

/* Inputs base */
input, select {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  margin-bottom: 10px;
  border:1px solid #ccc;
  border-radius:5px;
}

/* Tarjetas sencillas (opcional) */
.card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:16px;
}

/* Contenedor blanco usado en páginas internas (pequeño) */
.container {
  background: rgba(255,255,255,0.9);
  padding: 20px;
  border-radius: 10px;
  max-width: 500px;
  margin: 5% auto;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Tablas (estilo base) */
table { width:100%; border-collapse:collapse; background:#fff; }
table, th, td { border:1px solid #ccc; }
th, td { padding:8px; text-align:left; }
th { background:#f0f0f0; }

/* Paginación (estilo base) */
.pagination a{
  display:inline-block;
  margin-right:6px;
  padding:6px 10px;
  text-decoration:none;
  color:#333;
  border:1px solid #ccc;
  border-radius:6px;
}
.pagination a.active{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
}

/* Responsive general */
@media(max-width:600px){
  .container { width:90%; margin-top:20px; }
  table, th, td { font-size:12px; }
}

/* ====== TOPBAR (index/clientes/editar) ====== */
.topbar{
  display:flex; align-items:center; gap:12px;
  padding:10px 16px; background:#fff; border-bottom:1px solid #e5e7eb;
  position:sticky; top:0; z-index:10;
}
.topbar .logo{height:36px}
.topbar .spacer{flex:1}
.btn{
  display:inline-block; padding:10px 16px; border-radius:6px; text-decoration:none; color:#fff; background:var(--primary);
  border:1px solid transparent;
}
.btn:hover{background:var(--primary-hover)}
.btn.secondary{background:#fff; color:#333; border-color:#ccc}
.btn.danger{background:#e53935}

/* ====== NUEVO: CONTENEDOR ANCHO + TABLA RESPONSIVA ====== */
/* Contenedor ancho para páginas con listados (Clientes/Ventas) */
.container-wide{
  background:#fff;
  padding:16px;
  border-radius:10px;
  max-width:1200px;   /* más ancho para desktop */
  width:95%;
  margin:20px auto;
  box-shadow:0 0 10px rgba(0,0,0,0.1);
}

/* Envoltura con scroll horizontal suave en móvil */
.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table{
  width:100%;
  min-width:800px;    /* evita amontonamiento y permite scroll en móvil */
}

/* Botón primario reutilizable */
.btn-primary{
  display:inline-block;
  background:var(--primary);
  color:#fff;
  padding:10px 16px;
  border-radius:8px;
  text-decoration:none;
  border:1px solid transparent;
  cursor:pointer;
  width: 100%;
  text-align: center;
}
.btn-primary:hover{ background:var(--primary-hover); }

/* Panel plegable para “Añadir nuevo cliente” */
.collapsible{
  display:none;
  margin-top:12px;
}
.collapsible.show{
  display:block;
}

/* ====== LOGIN A PANTALLA COMPLETA ====== */
/* Fondo con imagen + oscurecido */
.login-hero{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  background: center/cover no-repeat fixed;
  background-image: var(--bg);
  position:relative;
}
.login-hero::before{
  content:""; position:absolute; inset:0; background:rgba(0,0,0,0.6);
}

/* Caja glass (centrada) */
.login-box{
  position:relative; z-index:1;
  width:min(92vw, 480px);
  padding:32px 24px;                 /* padding lateral uniforme */
  border-radius:14px;
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  border:1px solid rgba(255,255,255,0.22);
  color:#fff;
  text-align:center;
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  margin: 0 auto;
}

/* Títulos del login en blanco */
.login-box h1{
  font-size:26px; margin:0 0 6px 0; color:#fff;
}
.login-box p.subtitle{
  margin:0 0 18px 0; color:#f0f0f0;
}

/* --- CLAVE: el formulario ocupa 100%, centrado y con stretch --- */
.login-form{
  width:100%; max-width:100%;
  margin: 6px auto 0 auto;
  padding: 0;
  display:flex; flex-direction:column; gap:12px;
  align-items: stretch;
}
.login-form *{ min-width:0; }

/* Fuerza que inputs y botón tengan EXACTAMENTE el mismo ancho */
.login-form input[type="text"],
.login-form input[type="password"],
.login-form button{
  width:100% !important;
  max-width:100%;
  display:block;
  margin-left:0; margin-right:0;
  box-sizing:border-box;
}

/* Inputs del login (estilo) */
.login-form input[type="text"],
.login-form input[type="password"]{
  padding:12px 14px;
  border:none; border-radius:8px; font-size:16px;
  background: rgba(255,255,255,0.95); color:#333;
  -webkit-appearance:none; appearance:none;
}
.login-form input::placeholder{ color:#8a8a8a; }

/* Botón del login al 100% */
.login-form button{
  padding:12px 14px; border:none; border-radius:8px; font-size:16px; cursor:pointer;
  background:var(--primary); color:#fff;
}
.login-form button:hover{ background:var(--primary-hover); }

/* Error del login */
.login-box .error{ color:#ff6b6b; margin-top:6px; }

/* Responsive login */
@media (max-width:480px){
  .login-box{ width:min(94vw, 480px); padding:26px 18px; }
  .login-box h1{ font-size:22px; }
  .login-box p.subtitle{ font-size:14px; }
}

/* ====== CHOICES.JS (selects buscables) ====== */
.choices {
  width: 100%;
  margin-top: 5px;
  margin-bottom: 10px;
  font-size: 14px;
}

.choices__inner {
  min-height: 40px;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 6px 8px;
  background: #fff;
}

.is-open .choices__inner {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.12);
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  z-index: 9999; /* que no quede detrás de cards/topbar */
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  margin-top: 4px;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: #f0f0f0;
}

.choices__input {
  background: transparent;
  margin: 0;
  padding: 6px 8px;
}

.choices[data-type*='select-one'] .choices__button {
  display: none; /* no mostrar “x” (clear) en select-one */
}

/* Que los items no se corten raro en móviles */
.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  white-space: nowrap;
}

/* Integración con tus contenedores */
.container .choices,
.container-wide .choices {
  max-width: 100%;
}

@media (max-width: 600px) {
  .choices__inner { min-height: 38px; }
}

/* (Opcional) Mejorar el foco accesible */
.choices__inner:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ====== VENTAS: landing de acciones y subtabs ====== */
.actions-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  gap:16px;
  margin-top:12px;
}
.action-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:10px;
  box-shadow:0 1px 6px rgba(0,0,0,.06);
}
.action-card h3{ margin:0; }
.action-card p{ margin:0; color:#6b7280; }
.action-card .btn,
.action-card .btn-primary{ width:100%; text-align:center; }

/* Subtabs */
.subtabs{
  display:none;          /* se activa por JS */
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}
.subtabs .btn{
  background:#fff;
  color:#333;
  border:1px solid #d1d5db;
  border-radius:8px;
  padding:8px 12px;
  cursor:pointer;
  width:auto;            /* que no sean 100% como los <button> globales */
}
.subtabs .btn:hover{
  background:#f7f7f7;
}
.subtabs .btn.active{
  background:#111827;
  color:#fff;
  border-color:#111827;
}
#contenido{
  margin-top:12px;
  display:none;          /* se activa por JS */
}

/* ====== HELPERS usados en ventas_nueva ====== */
.two-col{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 820px){
  .two-col{ grid-template-columns: 1fr; }
}
.stack > *{ margin-bottom:6px; }
.inline{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.muted{ color:#6b7280; font-size:12px; }
.box{
  border:1px solid #e5e7eb;
  padding:8px;
  border-radius:8px;
  background:#fff;
}
.totals input[disabled],
.totals input[readonly]{ background:#f3f4f6; }

/* ====== VENTAS HISTORIAL (RESPONSIVO Y SIN ESTILOS INLINE) ====== */
/* Barra de filtros sticky */
.historial-wrap .filters{
  position: sticky; top: 58px; z-index: 5; /* ajusta si tu topbar es más alta */
  background:#fff; border:1px solid #e5e7eb; border-radius:10px;
  padding:12px; margin:10px 0;
  box-shadow:0 1px 6px rgba(0,0,0,.04);
}
.historial-wrap .filters-grid{
  display:grid; gap:10px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
@media (min-width:700px){
  .historial-wrap .filters-grid{ grid-template-columns: repeat(4, minmax(0,1fr)); }
}
.historial-wrap .filters .actions{
  display:flex; gap:8px; justify-content:flex-end; margin-top:4px;
}

/* Chips y badges */
.chip{
  display:inline-block; padding:4px 10px; border-radius:999px;
  border:1px solid #d1d5db; background:#f9fafb; font-weight:600; font-size:12px;
  text-decoration:none; color:#111827;
}
.chip:hover{ background:#f3f4f6; }

.badge{
  display:inline-block; padding:4px 10px; border-radius:999px; font-size:12px;
  border:1px solid #d1d5db; background:#f9fafb; color:#374151;
}
.badge.done{ background:#e8f5e9; color:#2e7d32; border-color:#c8e6c9; }

/* Card view para móvil (tabla -> tarjetas) */
@media (max-width:720px){
  /* Evita el min-width del wrapper en móvil para este bloque */
  .historial-wrap .table-wrap table{ min-width:0; }

  .historial-wrap .table-wrap table,
  .historial-wrap .table-wrap thead,
  .historial-wrap .table-wrap tbody,
  .historial-wrap .table-wrap th,
  .historial-wrap .table-wrap td,
  .historial-wrap .table-wrap tr { display:block; }

  .historial-wrap .table-wrap thead{ display:none; }

  .historial-wrap .table-wrap tr{
    border:1px solid #e5e7eb; border-radius:8px; padding:10px; margin-bottom:10px;
    box-shadow:0 1px 6px rgba(0,0,0,.03);
  }
  .historial-wrap .table-wrap td{
    border:none; padding:6px 0;
  }
  .historial-wrap .label{ display:block; font-size:12px; color:#6b7280; margin-bottom:2px; }
  .historial-wrap .row-top{
    display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:4px;
  }
}

/* Utilidades pequeñas */
.w-auto{ width:auto !important; }

/* Botones personalizados para index.php */
.btn-clientes {
  background: #2563eb;   /* Azul */
  color: #fff;
}
.btn-clientes:hover { background: #1d4ed8; }

.btn-ventas {
  background: #f59e0b;   /* Naranja */
  color: #fff;
}
.btn-ventas:hover { background: #d97706; }

.btn-tarifas {
  background: #10b981;   /* Verde */
  color: #fff;
}
.btn-tarifas:hover { background: #059669; }

.btn-ubicaciones { 
  background: #9c27b0;   /* Morado */
  color: #fff; 
}
.btn-ubicaciones:hover { background: #7b1fa2; }

/* ====== UTILIDADES ADMIN UBICACIONES ====== */
.grid-3{
  display:grid;
  gap:10px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
@media (max-width:720px){
  .grid-3{ grid-template-columns: 1fr; }
}

.mb-8{ margin-bottom:8px !important; }
.mb-10{ margin-bottom:10px !important; }
.mb-12{ margin-bottom:12px !important; }
.mt-8{ margin-top:8px !important; }

.gap-6{ gap:6px !important; }
.gap-8{ gap:8px !important; }

.row-form{
  display:flex; align-items:center; flex-wrap:wrap; gap:8px;
}
.row-actions{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
}

.admin-filters{
  position: sticky; top: 58px; z-index: 5;   /* ajusta si tu topbar es más alta */
  background:#fff; border:1px solid #e5e7eb; border-radius:10px;
  padding:12px; margin:10px 0;
  box-shadow:0 1px 6px rgba(0,0,0,.04);
}

.badge-muted{
  display:inline-block; padding:4px 10px; border-radius:999px; font-size:12px;
  border:1px solid #d1d5db; background:#f9fafb; color:#374151;
}


