/* Permisos Habilitantes - Carlos Alcivar */
:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --gray: #6b7280;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f1f5f9; }

/* ===== NAVBAR ===== */
#navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  position: sticky; top: 0; z-index: 100;
}
/* ===== TABS ===== */
.tab-bar { background: white; border-bottom: 2px solid #e2e8f0; position: sticky; top: 60px; z-index: 90; }
.tab-btn {
  padding: 12px 18px; font-size: 14px; font-weight: 600; color: #64748b;
  border: none; background: none; cursor: pointer; border-bottom: 3px solid transparent;
  transition: all 0.2s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== CARDS ===== */
.card { background: white; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.marca-card {
  cursor: pointer; border-left: 4px solid #e2e8f0;
  transition: all 0.2s; border-radius: var(--radius);
  background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.marca-card:hover { border-left-color: var(--primary-light); box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateX(2px); }
.marca-card.pendiente { border-left-color: #fbbf24; }
.marca-card.vigente { border-left-color: #22c55e; }
.marca-card.alerta { border-left-color: #f97316; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

/* ===== 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 0.15s; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: white; border: 1.5px solid #cbd5e1; color: #374151; }
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 10px; }
.btn-ghost { background: transparent; color: #64748b; border: none; }
.btn-ghost:hover { background: #f1f5f9; }

/* ===== INPUTS ===== */
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 14px; background: white; color: #1e293b; transition: border-color 0.15s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.input-group { display: flex; align-items: center; position: relative; }
.input-group .input { padding-left: 36px; }
.input-group .icon { position: absolute; left: 10px; color: #94a3b8; font-size: 14px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white; border-radius: 14px; max-width: 700px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 900px; }
@keyframes modalIn { from { opacity:0; transform:scale(0.95) translateY(-10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #f8fafc, #fff);
}
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid #f1f5f9; display: flex; gap: 8px; justify-content: flex-end; }

/* ===== TOAST ===== */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; color: white; padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500; min-width: 220px; max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.25s ease; border-left: 4px solid #3b82f6;
}
.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }
@keyframes toastIn { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:translateX(0); } }

/* ===== STATS CARDS ===== */
.stat-card {
  background: white; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07); border-top: 3px solid transparent;
}
.stat-card.blue { border-top-color: var(--primary); }
.stat-card.green { border-top-color: #22c55e; }
.stat-card.yellow { border-top-color: #f59e0b; }
.stat-card.red { border-top-color: #ef4444; }
.stat-card.purple { border-top-color: #8b5cf6; }

/* ===== PERMISO ROW ===== */
.permiso-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f8fafc; }
.permiso-row:last-child { border-bottom: none; }

/* ===== TABLA VISITAS ===== */
.tabla-visitas { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla-visitas th { background: #f8fafc; padding: 9px 12px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid #e2e8f0; }
.tabla-visitas td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: #374151; vertical-align: middle; }
.tabla-visitas tr:hover td { background: #f8fafc; }
.tabla-visitas th:first-child, .tabla-visitas td:first-child { padding-left: 16px; }

/* ===== DOC ITEM ===== */
.doc-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; border: 1px solid #e2e8f0; background: #fafafa;
  transition: all 0.15s;
}
.doc-item:hover { background: #f0f7ff; border-color: #bfdbfe; }
.doc-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* ===== LOADING ===== */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-dark { border-color: rgba(30,64,175,0.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary-light); background: #eff6ff; }
.upload-zone input[type="file"] { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .tab-btn { padding: 10px 12px; font-size: 13px; }
  .modal { border-radius: 14px 14px 0 0; max-height: 95vh; margin-top: auto; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .btn { padding: 7px 12px; }
  .tabla-visitas { font-size: 12px; }
  .tabla-visitas th, .tabla-visitas td { padding: 7px 8px; }
}

/* ===== MISC ===== */
.divider { height: 1px; background: #f1f5f9; margin: 12px 0; }
.text-muted { color: #94a3b8; font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.section-title { font-size: 15px; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.empty-state { text-align: center; padding: 40px 20px; color: #94a3b8; }
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; opacity: 0.4; }

/* ===== FILTER CHIPS ===== */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1.5px solid #e2e8f0; background: white; color: #374151; transition: all 0.15s;
}
.chip:hover { border-color: var(--primary-light); color: var(--primary); }
.chip.active { border-color: var(--primary); background: #eff6ff; color: var(--primary); }

/* ===== SCROLL ===== */
.overflow-scroll { overflow-x: auto; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
