/* assets/css/app.css — PermiSeg — Sistema de Permisos de Seguridad */

/* ── Variables ──────────────────────────── */
:root {
  --navy:       #0f172a;
  --navy-80:    #1e293b;
  --navy-60:    #334155;
  --steel:      #475569;
  --muted:      #94a3b8;
  --line:       #e2e8f0;
  --surface:    #f8fafc;
  --white:      #ffffff;
  --amber:      #f59e0b;
  --amber-light:#fef3c7;
  --green:      #10b981;
  --green-light:#d1fae5;
  --red:        #ef4444;
  --red-light:  #fee2e2;
  --blue:       #3b82f6;
  --blue-light: #dbeafe;

  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.12);

  --nav-h:      60px;
  --bottom-h:   68px;
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
}

/* ── Reset ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--navy);
  padding-top: var(--nav-h);
  padding-bottom: var(--bottom-h);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Navbar ─────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.nav-brand { display: flex; align-items: center; gap: 8px; }
.nav-icon  { font-size: 20px; }
.nav-title { font-size: 17px; font-weight: 700; color: var(--white); letter-spacing: -.3px; }
.nav-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .5px;
  padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
}
.nav-badge.admin { background: var(--amber); color: var(--navy); }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.notif-btn {
  position: relative; display: flex; align-items: center;
  padding: 6px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.08);
}
.notif-icon  { font-size: 18px; }
.notif-count {
  position: absolute; top: 0; right: 0;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.nav-user { position: relative; cursor: pointer; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--amber); color: var(--navy);
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 44px;
  background: var(--white); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); min-width: 180px;
  overflow: hidden; border: 1px solid var(--line);
}
.dropdown-menu.open { display: block; }
.dropdown-name {
  padding: 12px 14px; font-size: 13px; font-weight: 600;
  color: var(--steel); border-bottom: 1px solid var(--line);
}
.dropdown-menu a {
  display: block; padding: 11px 14px; font-size: 14px;
  color: var(--navy-80); transition: background .15s;
}
.dropdown-menu a:hover { background: var(--surface); }
.dropdown-menu .logout-link { color: var(--red); }

/* ── Bottom Nav ─────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottom-h);
  background: var(--white);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 8px 4px;
  font-size: 20px; color: var(--muted); transition: color .15s;
}
.bottom-nav a small { font-size: 10px; font-family: var(--font); }
.bottom-nav a.active { color: var(--navy); }
.bottom-nav a.active small { font-weight: 600; }

/* ── Main Layout ────────────────────────── */
.main-content { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ── Page Header ────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.page-header p  { font-size: 14px; color: var(--steel); margin-top: 4px; }

/* ── Cards ──────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.card-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 12px;
}

/* ── Stat Grid (dashboard) ──────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.stat-value { font-size: 28px; font-weight: 700; font-family: var(--mono); }
.stat-label { font-size: 12px; color: var(--steel); margin-top: 2px; }
.stat-card.amber  .stat-value { color: var(--amber); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.blue   .stat-value { color: var(--blue); }

/* ── Badges / Pills ─────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 20px; white-space: nowrap;
}
.badge.pendiente { background: var(--amber-light); color: #92400e; }
.badge.aprobado  { background: var(--green-light);  color: #065f46; }
.badge.rechazado { background: var(--red-light);    color: #991b1b; }

/* ── Solicitud Item ─────────────────────── */
.solicitud-item {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px;
  display: grid; gap: 6px;
  border-left: 4px solid transparent;
}
.solicitud-item.pendiente { border-color: var(--amber); }
.solicitud-item.aprobado  { border-color: var(--green); }
.solicitud-item.rechazado { border-color: var(--red); }
.solicitud-item .si-top   { display: flex; justify-content: space-between; align-items: flex-start; }
.solicitud-item .si-agente { font-weight: 600; font-size: 15px; }
.solicitud-item .si-fecha  { font-size: 13px; color: var(--steel); }
.solicitud-item .si-motivo { font-size: 13px; color: var(--steel); }
.solicitud-item .si-btn    { margin-top: 6px; }

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--navy-60); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font);
  background: var(--white); color: var(--navy);
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,23,42,.08);
}
.form-control::placeholder { color: var(--muted); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { min-height: 90px; resize: vertical; }

/* Checkbox group */
.check-group { display: flex; flex-direction: column; gap: 10px; }
.check-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; cursor: pointer;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); transition: all .15s;
}
.check-label:has(input:checked) {
  border-color: var(--navy); background: rgba(15,23,42,.04);
}
.check-label input[type="radio"],
.check-label input[type="checkbox"] { accent-color: var(--navy); width: 16px; height: 16px; }

/* ── Buttons ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  border: none; cursor: pointer; transition: all .15s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary   { background: var(--navy);  color: #fff; }
.btn-primary:hover   { background: var(--navy-80); }
.btn-success   { background: var(--green); color: #fff; }
.btn-danger    { background: var(--red);   color: #fff; }
.btn-outline   { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn-outline:hover { background: var(--surface); }
.btn-amber     { background: var(--amber); color: var(--navy); }
.btn-sm        { padding: 7px 14px; font-size: 13px; }
.btn-block     { width: 100%; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Table (mobile-friendly) ────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--navy); color: #fff; padding: 10px 12px; text-align: left; font-weight: 600; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--surface); }

/* ── Alert ──────────────────────────────── */
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start;
}
.alert-success { background: var(--green-light); color: #065f46; }
.alert-error   { background: var(--red-light);   color: #991b1b; }
.alert-warning { background: var(--amber-light);  color: #92400e; }
.alert-info    { background: var(--blue-light);   color: #1e40af; }

/* ── Login Page ─────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--navy);
  padding-top: 0; /* override body padding */
}
.login-card {
  background: var(--white); border-radius: 20px;
  padding: 32px 24px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .shield { font-size: 48px; }
.login-logo h1 { font-size: 26px; font-weight: 800; letter-spacing: -1px; margin-top: 8px; }
.login-logo p  { font-size: 13px; color: var(--steel); margin-top: 4px; }

/* ── Search / Filter bar ────────────────── */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar .form-control { flex: 1; min-width: 140px; }
.filter-bar .btn { flex-shrink: 0; }

/* ── Empty state ────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 16px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--steel); }
.empty-state p  { font-size: 13px; margin-top: 4px; }

/* ── Timeline (estado solicitud) ────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item  { display: flex; gap: 14px; }
.tl-line  { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl-dot   { width: 20px; height: 20px; border-radius: 50%; background: var(--line); border: 3px solid var(--white); flex-shrink: 0; }
.tl-dot.done    { background: var(--green); }
.tl-dot.current { background: var(--amber); }
.tl-dot.bad     { background: var(--red); }
.tl-connector   { width: 2px; flex: 1; background: var(--line); min-height: 24px; }
.tl-body  { padding-bottom: 20px; }
.tl-label { font-size: 14px; font-weight: 600; }
.tl-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Utilities ──────────────────────────── */
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 13px; }
.text-center { text-align: center; }
.mt-4  { margin-top: 4px;  }
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────── */
@media (min-width: 500px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
