/* Permisos Carlos Alcivar - Custom Styles */

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

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  margin: 0;
}

/* ===== NAVBAR ===== */
#navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }

.marca-card {
  cursor: pointer;
  border-left: 4px solid #e2e8f0;
  transition: all 0.2s;
}
.marca-card:hover { border-left-color: #3b82f6; transform: translateX(2px); }
.marca-card.selected { border-left-color: #1e40af; background: #eff6ff; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-vigente { background: #dcfce7; color: #15803d; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-caducado { background: #fee2e2; color: #991b1b; }
.badge-noapl { background: #f1f5f9; color: #64748b; }
.badge-condicionado { background: #fce7f3; color: #9d174d; }

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

/* ===== TABLES ===== */
.table-container { overflow-x: auto; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th { background: #1e3a8a; color: white; padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; text-align: left; }
td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
tr:hover td { background: #f8fafc; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}
.modal-box {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: #3b82f6;
  background: #eff6ff;
}

/* ===== SEARCH & FILTERS ===== */
.search-input {
  padding: 10px 16px 10px 44px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  width: 100%;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}
.search-input:focus { border-color: #3b82f6; }

.filter-select {
  padding: 9px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}
.filter-select:focus { border-color: #3b82f6; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: #1e40af; color: white; }
.btn-primary:hover { background: #1e3a8a; }
.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; color: #374151; border: 2px solid #e2e8f0; }
.btn-outline:hover { border-color: #3b82f6; color: #1e40af; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px 10px; }

/* ===== TABS ===== */
.tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn.active { border-bottom-color: #1e40af; color: #1e40af; }
.tab-btn:hover:not(.active) { color: #374151; }

/* ===== PERMISOS GRID ===== */
.permiso-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 6px;
}

/* ===== STATS ===== */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slideInRight 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #1e40af; }

@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== LOADING ===== */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

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