/* ============================================================
   Panel Agencia — main.css
   Tema: Dark mode con paleta oficial Aura (agenciaaura.mx)
   ============================================================ */

:root {
  /* === Paleta Aura — adaptada a fondo negro === */
  --aura-blue: #2b8df0;          /* azul brillante para mejor contraste sobre negro */
  --aura-blue-strong: #046bd2;   /* azul oficial Aura */
  --aura-blue-dark: #045cb4;
  --aura-blue-soft: rgba(43, 141, 240, 0.12);
  --aura-blue-soft-hover: rgba(43, 141, 240, 0.20);
  --aura-blue-border: rgba(43, 141, 240, 0.30);

  /* === Fondos negros (capas) === */
  --bg-primary: #000000;        /* fondo base, negro puro como aura.mx */
  --bg-secondary: #0a0a0a;      /* sidebar */
  --bg-tertiary: #111111;       /* cards, paneles */
  --bg-elevated: #161616;       /* hover, dropdowns */
  --bg-input: #1a1a1a;          /* inputs */

  /* === Bordes === */
  --border: #1f1f1f;
  --border-strong: #2a2a2a;
  --border-bright: #3a3a3a;

  /* === Texto === */
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;

  /* === Estados === */
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  /* === Layout === */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 12px 32px rgba(43, 141, 240, 0.18);

  --sidebar-width: 260px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Montserrat', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo {
  max-width: 160px;
  height: auto;
  display: block;
  /* Si el logo tiene fondo blanco/claro, dejarlo asi.
     El logo de aura.mx ya esta diseñado para fondo blanco/oscuro,
     ajustamos el filter solo si fuera necesario. */
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0.875rem 0.875rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--aura-blue-soft);
  color: var(--aura-blue);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.125rem;
  width: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.user-info {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aura-blue), var(--aura-blue-strong));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(43, 141, 240, 0.4);
}

.user-text {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-correo {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: block;
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  transition: var(--transition);
}

.logout-btn:hover {
  background: var(--aura-blue);
  color: white;
  border-color: var(--aura-blue);
}

/* ============================================================
   Main content
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

.main-fullscreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 20% 30%, rgba(43, 141, 240, 0.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(43, 141, 240, 0.08), transparent 50%),
    var(--bg-primary);
}

/* ============================================================
   Page header
   ============================================================ */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'Antonio', 'Montserrat', sans-serif;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
  text-transform: uppercase;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--aura-blue);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: var(--aura-blue-soft);
  color: var(--aura-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--aura-blue-border);
}

.card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.card p {
  color: var(--text-secondary);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.muted {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.mt-6 { margin-top: 2rem; }

/* ============================================================
   Login
   ============================================================ */
.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 1.25rem;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-footer p {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  padding: 0.6875rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  outline: none;
  border-color: var(--aura-blue);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--aura-blue-soft);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  background: var(--aura-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: var(--aura-blue-strong);
  box-shadow: 0 4px 16px rgba(43, 141, 240, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

/* ============================================================
   Flash messages
   ============================================================ */
.flash-messages {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
}

.flash-error {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.flash-success {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.flash-warning {
  background: var(--warning-soft);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

/* ============================================================
   Checklist
   ============================================================ */
.checklist {
  list-style: none;
  margin-top: 0.75rem;
}

.checklist li {
  padding: 0.375rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.75rem;
}

.checklist li::before {
  position: absolute;
  left: 0;
  font-size: 0.875rem;
}

.checklist li.done::before {
  content: "✅";
}

.checklist li.todo::before {
  content: "⏳";
  filter: grayscale(0.4);
}

/* ============================================================
   Tagline (estilo del sitio web aura.mx)
   ============================================================ */
.tagline {
  font-family: 'Antonio', sans-serif;
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  color: var(--aura-blue);
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* ============================================================
   KPI cards (header de modulo)
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.375rem;
}

.kpi-value {
  font-family: 'Antonio', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--aura-blue); }

/* ============================================================
   Filtros
   ============================================================ */
.filtros-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.filtro-search {
  flex: 1;
  min-width: 220px;
  padding: 0.5rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
}

.filtro-search:focus {
  outline: none;
  border-color: var(--aura-blue);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--aura-blue-soft);
}

.filtro-select {
  padding: 0.5rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: var(--aura-blue);
  border-color: var(--aura-blue);
  color: white;
}

.btn-ghost {
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-ghost:hover {
  color: var(--aura-blue);
  background: rgba(43, 141, 240, 0.08);
  border-color: rgba(43, 141, 240, 0.2);
}

/* Variantes semanticas */
.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-success {
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn-success:hover {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.5);
}

/* Tamano pequeno: aplica a btn-primary/secondary/ghost/danger/success */
.btn-sm {
  padding: 0.3125rem 0.75rem;
  font-size: 0.8125rem;
  gap: 0.25rem;
}

.btn-xs {
  padding: 0.1875rem 0.5rem;
  font-size: 0.75rem;
  gap: 0.25rem;
}

/* Boton solo icono: cuadrado, sin texto */
.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-family: inherit;
}
.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-icon.btn-icon-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-icon-sm { width: 1.625rem; height: 1.625rem; font-size: 0.75rem; }

/* Boton inline para acciones rapidas dentro de pills/headers */
.btn-action {
  padding: 0.25rem 0.625rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn-action:hover {
  background: var(--aura-blue);
  border-color: var(--aura-blue);
  color: white;
}
.btn-action.btn-action-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}
.btn-action.btn-action-success:hover {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}

/* ============================================================
   Tabla de datos
   ============================================================ */
.table-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table thead th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-elevated);
}

.row-clickable {
  cursor: pointer;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.cell-stack strong {
  color: var(--text-primary);
  font-weight: 600;
}

.cell-stack .muted {
  font-size: 0.75rem;
}

.text-right { text-align: right; }
.small { font-size: 0.75rem; }

.mono {
  font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.0625rem 0.375rem;
  border-radius: 0.25rem;
}

/* ============================================================
   Pills (badges de estado)
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}

.pill-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.25);
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.pill-info {
  background: var(--aura-blue-soft);
  color: var(--aura-blue);
  border-color: var(--aura-blue-border);
}

.pill-muted {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  border-color: var(--border-strong);
}

.pill .mono {
  background: transparent;
  padding: 0;
  font-size: 0.625rem;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: 'Antonio', sans-serif;
  font-size: 1.25rem;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.mt-3 { margin-top: 0.75rem; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition);
}

.breadcrumb a:hover {
  color: var(--aura-blue);
}

/* ============================================================
   Detalle (info-list)
   ============================================================ */
.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.info-list {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

.info-list dt {
  color: var(--text-tertiary);
  font-weight: 500;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border);
}

.info-list dd {
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.info-list dt:last-of-type,
.info-list dd:last-of-type {
  border-bottom: none;
}

.card-danger {
  border-color: rgba(239, 68, 68, 0.4);
}

.error-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.75rem;
}

/* ============================================================
   Scrollbar (dark)
   ============================================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 5px;
  border: 2px solid var(--bg-secondary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }
  .page-title {
    font-size: 1.75rem;
  }
}
