/* ============================================================
   SISTEMA POLICIA DE TUCUMAN - Depto. Personal D-1
   Paleta institucional: azul marino profundo + dorado + blanco
   ============================================================ */

:root {
  --azul-marino:    #1a2744;
  --azul-medio:     #243561;
  --azul-claro:     #2e4280;
  --dorado:         #c8a84b;
  --dorado-claro:   #e8c96a;
  --dorado-oscuro:  #a08030;
  --blanco:         #ffffff;
  --gris-claro:     #f0f2f7;
  --gris-medio:     #e2e6f0;
  --gris-texto:     #6b7280;
  --texto-oscuro:   #1f2937;

  --verde:  #10b981;
  --rojo:   #ef4444;
  --amarillo: #f59e0b;
  --azul-info: #3b82f6;
  --violeta: #8b5cf6;
  --naranja: #f97316;

  --sombra-sm: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --sombra-md: 0 4px 16px rgba(26,39,68,.15);
  --sombra-lg: 0 8px 32px rgba(26,39,68,.20);
  --radio:    12px;
  --radio-sm: 8px;
  --radio-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gris-claro);
  color: var(--texto-oscuro);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: linear-gradient(135deg, var(--azul-marino) 0%, var(--azul-medio) 100%);
  border-bottom: 3px solid var(--dorado);
  padding: 0 24px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sombra-md);
  flex-wrap: nowrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}

.topbar-brand img {
  height: 48px;
  width: auto;
  flex-shrink: 0;
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-brand-text .nombre-inst {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--blanco);
  letter-spacing: 0.5px;
  line-height: 1.1;
  white-space: nowrap;
}

.topbar-brand-text .sub-inst {
  font-size: 11px;
  color: var(--dorado-claro);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.notif-btn {
  position: relative;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--blanco);
  font-size: 18px;
  transition: background .2s;
  flex-shrink: 0;
}
.notif-btn:hover { background: rgba(255,255,255,.2); }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--rojo);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 24px;
  padding: 6px 14px 6px 14px;
  cursor: pointer;
  position: relative;
  transition: background .2s;
  max-width: 100%;
}
.user-menu:hover { background: rgba(255,255,255,.2); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--dorado);
  flex-shrink: 0;
}

.user-avatar-placeholder {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--dorado);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--azul-marino);
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--blanco);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.user-rol  {
  font-size: 11px;
  color: var(--dorado-claro);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra-lg);
  min-width: 200px;
  overflow: hidden;
  border: 1px solid var(--gris-medio);
  z-index: 200;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--texto-oscuro);
  text-decoration: none;
  font-size: 14px;
  transition: background .15s;
}
.dropdown-menu a:hover { background: var(--gris-claro); }
.dropdown-menu a.danger { color: var(--rojo); }
.dropdown-divider { height: 1px; background: var(--gris-medio); }

/* ── SIDEBAR ── */
.layout {
  display: flex;
  min-height: calc(100vh - 70px);
}

.sidebar {
  width: 240px;
  background: var(--azul-marino);
  flex-shrink: 0;
  padding: 20px 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(200,168,75,.7);
  padding: 8px 20px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.08);
  color: var(--blanco);
  border-left-color: var(--dorado);
}

.sidebar-link.active {
  background: rgba(200,168,75,.15);
  color: var(--dorado-claro);
  border-left-color: var(--dorado);
}

.sidebar-icon { font-size: 18px; width: 22px; text-align: center; }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  padding: 28px;
  min-width: 0;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--azul-marino);
  letter-spacing: 0.5px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--gris-texto);
  margin-top: 4px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gris-texto);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--azul-claro); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── CARDS ── */
.card {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra-sm);
  padding: 24px;
  border: 1px solid var(--gris-medio);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gris-claro);
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--azul-marino);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── STATS CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 20px;
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--gris-medio);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--color-acento, var(--azul-claro));
}

.stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--azul-marino);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gris-texto);
  margin-top: 4px;
  font-weight: 500;
}

/* ── PERFIL DEL POLICÍA ── */
.perfil-header {
  background: linear-gradient(135deg, var(--azul-marino) 0%, var(--azul-claro) 100%);
  border-radius: var(--radio-lg);
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.perfil-header::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(200,168,75,.1);
}

.perfil-foto {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--dorado);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  flex-shrink: 0;
}

.perfil-foto-placeholder {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--dorado);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--azul-marino);
  border: 4px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}

.perfil-info { flex: 1; }
.perfil-nombre {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--blanco);
  letter-spacing: 0.5px;
}
.perfil-jerarquia {
  font-size: 14px;
  color: var(--dorado-claro);
  font-weight: 500;
  margin-top: 2px;
}
.perfil-datos {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.perfil-dato {
  font-size: 13px;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── MÓDULOS/SECCIONES ── */
.modulos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.modulo-card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 20px;
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--gris-medio);
  text-decoration: none;
  color: inherit;
  transition: all .2s;
  display: block;
}

.modulo-card:hover {
  box-shadow: var(--sombra-md);
  transform: translateY(-2px);
  border-color: var(--azul-claro);
}

.modulo-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radio-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
}

.modulo-titulo {
  font-weight: 600;
  font-size: 15px;
  color: var(--azul-marino);
  margin-bottom: 4px;
}

.modulo-desc {
  font-size: 13px;
  color: var(--gris-texto);
}

/* ── BADGES / ESTADOS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-verde   { background: rgba(16,185,129,.15); color: #065f46; }
.badge-rojo    { background: rgba(239,68,68,.15);  color: #991b1b; }
.badge-amarillo{ background: rgba(245,158,11,.15); color: #92400e; }
.badge-azul    { background: rgba(59,130,246,.15); color: #1e40af; }
.badge-violeta { background: rgba(139,92,246,.15); color: #5b21b6; }
.badge-naranja { background: rgba(249,115,22,.15); color: #c2410c; }
.badge-gris    { background: rgba(107,114,128,.15);color: #374151; }

/* ── TABLAS ── */
.tabla-container {
  overflow-x: auto;
  border-radius: var(--radio);
  border: 1px solid var(--gris-medio);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--azul-marino);
  color: var(--blanco);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radio) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radio) 0 0; }

tbody tr { border-bottom: 1px solid var(--gris-medio); transition: background .1s; }
tbody tr:hover { background: var(--gris-claro); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 16px; }

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--azul-marino);
  margin-bottom: 6px;
}

.form-label .required { color: var(--rojo); }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gris-medio);
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--texto-oscuro);
  background: var(--blanco);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--azul-claro);
  box-shadow: 0 0 0 3px rgba(46,66,128,.12);
}

.form-control.error { border-color: var(--rojo); }
.form-hint { font-size: 12px; color: var(--gris-texto); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--rojo); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── BOTONES ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radio-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--azul-marino);
  color: var(--blanco);
}
.btn-primary:hover { background: var(--azul-medio); box-shadow: var(--sombra-sm); }

.btn-dorado {
  background: var(--dorado);
  color: var(--azul-marino);
}
.btn-dorado:hover { background: var(--dorado-claro); box-shadow: var(--sombra-sm); }

.btn-verde   { background: var(--verde);  color: white; }
.btn-verde:hover   { filter: brightness(1.1); }
.btn-rojo    { background: var(--rojo);   color: white; }
.btn-rojo:hover    { filter: brightness(1.1); }
.btn-outline {
  background: transparent;
  color: var(--azul-marino);
  border: 1.5px solid var(--azul-marino);
}
.btn-outline:hover { background: var(--azul-marino); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ── ALERTS ── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radio-sm);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,.1);  border-left: 4px solid var(--verde);    color: #065f46; }
.alert-error   { background: rgba(239,68,68,.1);   border-left: 4px solid var(--rojo);     color: #991b1b; }
.alert-warning { background: rgba(245,158,11,.1);  border-left: 4px solid var(--amarillo); color: #92400e; }
.alert-info    { background: rgba(59,130,246,.1);  border-left: 4px solid var(--azul-info);color: #1e40af; }

/* ── TIMELINE DE ESTADO ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 36px;
  width: 2px;
  height: calc(100% - 36px);
  background: var(--gris-medio);
}

.timeline-content { flex: 1; padding-top: 6px; }
.timeline-title { font-weight: 600; font-size: 14px; }
.timeline-fecha { font-size: 12px; color: var(--gris-texto); margin-top: 2px; }
.timeline-desc  { font-size: 13px; color: var(--gris-texto); margin-top: 4px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--azul-marino) 0%, var(--azul-claro) 60%, #1a3a6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(200,168,75,.08);
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(200,168,75,.06);
}

.login-box {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 420px;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img {
  height: 80px;
  margin-bottom: 12px;
}

.login-logo-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--azul-marino);
  line-height: 1.2;
}

.login-logo-sub {
  font-size: 12px;
  color: var(--gris-texto);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.login-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--dorado), transparent);
  margin: 20px 0;
}

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--gris-medio);
  border-radius: var(--radio);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gris-claro);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--azul-claro);
  background: rgba(46,66,128,.05);
}

.upload-zone-icon { font-size: 40px; margin-bottom: 8px; }
.upload-zone-text { font-size: 14px; color: var(--gris-texto); }
.upload-zone-text strong { color: var(--azul-claro); }

/* ── COMPROBANTE QR ── */
.comprobante-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.3);
  border-radius: var(--radio);
  padding: 16px;
}

.comprobante-hash {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--gris-texto);
  word-break: break-all;
  margin-top: 8px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; top: 70px; left: 0; height: calc(100vh - 70px); z-index: 90; }
  .main-content { padding: 16px; }
  .topbar { padding: 0 10px; }
  .topbar-brand { gap: 8px; }
  .topbar-brand img { height: 34px; }
  .topbar-brand-text .nombre-inst { font-size: 13px; }
  .topbar-brand-text .sub-inst { display: none; }
  .topbar-right { gap: 6px; }
  .notif-btn { width: 32px; height: 32px; font-size: 14px; }
  .user-menu { padding: 5px 8px; gap: 6px; }
  .user-name { max-width: 78px; font-size: 11px; }
  .user-rol { max-width: 78px; font-size: 9px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .perfil-header { flex-direction: column; text-align: center; }
  .perfil-datos { justify-content: center; }
  .hamburger { display: flex !important; }
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.hamburger span {
  width: 24px; height: 2px;
  background: var(--blanco);
  border-radius: 2px;
  transition: all .2s;
}

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--gris-texto); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gris-claro); }
::-webkit-scrollbar-thumb { background: var(--azul-claro); border-radius: 3px; }
