/* =========================================================
   PERMISOS HABILITANTES - Carlos Alcivar
   ========================================================= */

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray: #6b7280;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  margin: 0;
}

/* ── NAVBAR ── */
#navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 60%, #2563eb 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(30,64,175,0.3);
}

/* ── TABS ── */
.tab-btn {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tab-btn:hover { color: var(--primary); background: #f0f7ff; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── CARDS ── */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }

/* ── MARCA CARD ── */
.marca-card {
  cursor: pointer;
  border-left: 4px solid #e2e8f0;
  transition: transform .15s, box-shadow .2s;
}
.marca-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-vigente  { background: #dcfce7; color: #15803d; }
.badge-caducado { background: #fee2e2; color: #b91c1c; }
.badge-pendiente{ background: #fef3c7; color: #b45309; }
.badge-noapl    { background: #f1f5f9; color: #64748b; }
.badge-standby  { background: #ede9fe; color: #7c3aed; }
.badge-tipo     { background: #dbeafe; color: #1d4ed8; font-size: 10px; }
.badge-gastrono { background: #fce7f3; color: #be185d; font-size: 10px; }
.badge-banco    { background: #d1fae5; color: #065f46; font-size: 10px; }
.badge-oficina  { background: #fef3c7; color: #92400e; font-size: 10px; }
.badge-ancla    { background: #ede9fe; color: #5b21b6; font-size: 10px; }

/* ── STATUS DOT ── */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green  { background: #22c55e; }
.dot-red    { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-gray   { background: #94a3b8; }
.dot-purple { background: #a78bfa; }

/* ── PERMISO ROW ── */
.permiso-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* ── INPUTS ── */
.search-input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border .2s;
  background: #fff;
}
.search-input:focus { border-color: var(--primary-light); }
.filter-select {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  transition: border .2s;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--primary-light); }
textarea.filter-select { resize: vertical; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.92); }
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-outline   { background: #fff; color: #374151; border: 1.5px solid #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm        { padding: 6px 12px; font-size: 12px; }
.btn-xs        { padding: 4px 8px;  font-size: 11px; }
.btn-icon      { padding: 6px 10px; }
.btn-ghost     { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  margin: auto;
  position: relative;
  animation: slideIn .2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── TABLE ── */
.table-container { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  color: #374151;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2.5px dashed #93c5fd;
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #eff6ff;
}
.upload-zone:hover, .upload-zone.drag-over {
  background: #dbeafe;
  border-color: var(--primary-light);
  transform: scale(1.01);
}

/* ── SPINNER ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: fadeIn .25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes fadeIn { from { opacity:0; transform: translateX(30px); } }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #2563eb; }
.toast-warning { background: #d97706; }

/* ── STATS CARDS ── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

/* ── PROGRESS BAR ── */
.progress-bar { height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ── VISITA FORM ── */
.visita-form {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .modal-box { border-radius: 12px; }
  .stat-card { padding: 14px; }
  .btn span.hide-mobile { display: none; }
  thead th { padding: 8px 10px; }
  tbody td { padding: 8px 10px; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── STATUS INDICATOR (real-time) ── */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #16a34a;
  font-weight: 600;
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.8); }
}

/* ── TAG GRUPO ── */
.grupo-tag {
  font-size: 10px;
  padding: 2px 7px;
  background: #fef9c3;
  color: #854d0e;
  border-radius: 99px;
  font-weight: 600;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }

/* ── LINE CLAMP ── */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ── DETAIL GRID ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .detail-grid { grid-template-columns: 1fr; } }
