/* ============================================================
   IBARRA VIVE EMBAJADORES — Estilos globales
   Paleta: Rojo #C0392B | Crema #F5E6C8 | Blanco #FFFFFF
   ============================================================ */

:root {
  --rojo:    #C0392B;
  --rojo-dk: #A93226;
  --rojo-lt: rgba(192,57,43,0.10);
  --crema:   #F5E6C8;
  --blanco:  #FFFFFF;
  --gris-bg: #F4F4F4;
  --gris-bd: #E0E0E0;
  --texto:   #1A1A1A;
  --texto-s: #666666;
  --texto-t: #999999;
  --sidebar: #1A1A1A;
  --verde:   #27AE60;
  --azul:    #2980B9;
  --amarillo:#F39C12;
  --radio:   10px;
  --radio-lg:16px;
  --shadow:  0 2px 8px rgba(0,0,0,0.08);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--texto);
  background: var(--gris-bg);
  line-height: 1.5;
}

a { color: var(--rojo); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TIPOGRAFÍA ── */
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p  { line-height: 1.6; }

/* ── BOTONES ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radio);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary   { background: var(--rojo);    color: var(--crema); }
.btn-primary:hover { background: var(--rojo-dk); color: var(--crema); text-decoration: none; }

.btn-secondary { background: var(--gris-bg); color: var(--texto); border: 1px solid var(--gris-bd); }
.btn-secondary:hover { background: #eaeaea; }

.btn-danger    { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }

.btn-success   { background: var(--verde); color: #fff; }

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

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--texto-s);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gris-bd);
  border-radius: var(--radio);
  font-size: 14px;
  font-family: inherit;
  color: var(--texto);
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--rojo); }
.form-control::placeholder { color: var(--texto-t); }

.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--gris-bd);
  border-radius: var(--radio);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}
.input-group:focus-within { border-color: var(--rojo); }
.input-group .form-control { border: none; background: transparent; }
.input-group .input-icon {
  padding: 0 12px;
  color: var(--texto-t);
  font-size: 17px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.input-group .eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 12px;
  color: var(--texto-t);
  font-size: 17px;
  display: flex;
  align-items: center;
}
.input-group .eye-btn:hover { color: var(--rojo); }

.form-error {
  font-size: 12px;
  color: var(--rojo);
  margin-top: 4px;
  display: none;
}
.form-error.show { display: block; }

/* ── ALERTAS ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radio);
  font-size: 13px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-danger  { background: #FCEBEB; color: #922B21; border-left: 3px solid var(--rojo); }
.alert-success { background: #EAFAF1; color: #1E8449; border-left: 3px solid var(--verde); }
.alert-info    { background: #EBF5FB; color: #1A5276; border-left: 3px solid var(--azul); }
.alert-warning { background: #FEF9E7; color: #9A7D0A; border-left: 3px solid var(--amarillo); }

/* ── CARDS ── */
.card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--gris-bd);
  padding: 1.25rem 1.5rem;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title span { font-size: 12px; color: var(--texto-s); font-weight: 400; }

/* ── TABLAS ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--texto-s);
  padding: 10px 12px;
  border-bottom: 1px solid var(--gris-bd);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #EAFAF1; color: #1E8449; }
.badge-danger  { background: #FCEBEB; color: #922B21; }
.badge-warning { background: #FEF9E7; color: #9A7D0A; }
.badge-info    { background: #EBF5FB; color: #1A5276; }
.badge-gray    { background: #f0f0f0; color: #666; }

/* ── LAYOUT ADMIN (desktop) ── */
.adm-layout {
  display: flex;
  min-height: 100vh;
}

.adm-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.adm-sidebar .logo-area {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.adm-sidebar .logo-area img { width: 120px; }
.adm-sidebar .role-badge {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--rojo);
  background: rgba(192,57,43,0.12);
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: 20px;
  padding: 2px 10px;
}

.adm-nav { flex: 1; padding: 0.75rem 0; }
.adm-nav-section {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0.75rem 1rem 0.3rem;
}
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 1rem;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.12s;
  text-decoration: none;
}
.adm-nav-item:hover, .adm-nav-item.active {
  color: #fff;
  background: rgba(192,57,43,0.15);
  border-left-color: var(--rojo);
  text-decoration: none;
}
.adm-nav-item i { font-size: 16px; flex-shrink: 0; }
.adm-nav-badge {
  margin-left: auto;
  background: var(--rojo);
  color: var(--crema);
  font-size: 10px;
  border-radius: 10px;
  padding: 1px 7px;
}

.adm-sidebar .user-area {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--rojo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--crema);
  flex-shrink: 0;
}
.user-name  { font-size: 12px; color: #fff; font-weight: 500; }
.user-role  { font-size: 10px; color: rgba(255,255,255,0.4); }
.logout-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.35); font-size: 17px;
  display: flex; align-items: center;
  margin-left: auto; padding: 4px;
  border-radius: 6px; transition: color 0.12s;
}
.logout-btn:hover { color: var(--rojo); }

.adm-content-wrap {
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.adm-topbar {
  background: var(--blanco);
  border-bottom: 1px solid var(--gris-bd);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.adm-topbar .page-title { font-size: 16px; font-weight: 600; }
.live-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--texto-s);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--verde);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.adm-content { padding: 1.5rem; }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }

/* ── METRIC CARDS ── */
.metric-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--gris-bd);
  padding: 1rem 1.1rem;
}
.metric-card .label {
  font-size: 11px; color: var(--texto-s);
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: space-between;
}
.metric-card .value { font-size: 28px; font-weight: 600; margin: 6px 0 2px; }
.metric-card .sub   { font-size: 11px; color: var(--texto-s); }
.metric-card .sub strong { color: var(--verde); }
.metric-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.metric-icon.red    { background: var(--rojo-lt); color: var(--rojo); }
.metric-icon.green  { background: rgba(39,174,96,0.1); color: var(--verde); }
.metric-icon.blue   { background: rgba(41,128,185,0.1); color: var(--azul); }
.metric-icon.amber  { background: rgba(243,156,18,0.1); color: var(--amarillo); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 1.25rem;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--texto-s);
  display: flex; align-items: center; padding: 4px;
}
.modal-close:hover { color: var(--rojo); }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 1.25rem; padding-top: 1rem;
  border-top: 1px solid var(--gris-bd);
}

/* ── LAYOUT EMBAJADOR (mobile-first) ── */
.emb-layout { min-height: 100vh; background: var(--gris-bg); }

.emb-topbar {
  background: var(--rojo);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.emb-topbar img { height: 36px; }
.emb-topbar .menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--crema); font-size: 22px;
  display: flex; align-items: center;
}

.emb-content { padding: 1rem; padding-bottom: 80px; }

.emb-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--blanco);
  border-top: 1px solid var(--gris-bd);
  display: flex;
  z-index: 100;
}
.emb-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  font-size: 10px;
  color: var(--texto-s);
  text-decoration: none;
  gap: 2px;
  transition: color 0.12s;
}
.emb-bottom-nav a i { font-size: 22px; }
.emb-bottom-nav a.active, .emb-bottom-nav a:hover { color: var(--rojo); }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  background: var(--gris-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: var(--blanco);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-header {
  background: var(--rojo);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-header::before {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.login-header img { width: 160px; position: relative; z-index: 1; }
.login-header .tagline {
  font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(245,230,200,0.7);
  margin-top: 0.75rem; position: relative; z-index: 1;
}
.login-body { padding: 1.75rem 1.5rem; }

/* ── BENEFICIO CARD (embajador) ── */
.benefit-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--gris-bd);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.benefit-card:hover { border-color: var(--rojo); box-shadow: 0 0 0 3px var(--rojo-lt); }
.benefit-card.selected { border-color: var(--verde); background: #EAFAF1; cursor: default; }
.benefit-card.full { opacity: 0.6; cursor: not-allowed; }
.benefit-card .bc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.benefit-card .bc-title { font-size: 14px; font-weight: 600; }
.benefit-card .bc-socio { font-size: 12px; color: var(--texto-s); margin-top: 3px; }
.benefit-card .bc-footer { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bc-tag {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: var(--gris-bg); color: var(--texto-s);
  display: flex; align-items: center; gap: 4px;
}

/* ── CUPOS BARRA ── */
.cupos-bar { height: 5px; background: var(--gris-bg); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.cupos-fill { height: 100%; border-radius: 3px; background: var(--verde); transition: width 0.4s; }
.cupos-fill.warning { background: var(--amarillo); }
.cupos-fill.danger  { background: var(--rojo); }

/* ── UTILITIES ── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.mb-1         { margin-bottom: 0.5rem; }
.mb-2         { margin-bottom: 1rem; }
.mb-3         { margin-bottom: 1.5rem; }
.mt-2         { margin-top: 1rem; }
.text-sm      { font-size: 12px; }
.text-muted   { color: var(--texto-s); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-600       { font-weight: 600; }
.d-none       { display: none !important; }
.w-100        { width: 100%; }

/* ── RESPONSIVE (desktop admin) ── */
@media (max-width: 768px) {
  .adm-sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .adm-sidebar.open { transform: translateX(0); }
  .adm-content-wrap { margin-left: 0; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gris-bd);
  border-top-color: var(--rojo);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── REALTIME BADGE ── */
.rt-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--verde);
  background: rgba(39,174,96,0.1); border-radius: 20px;
  padding: 2px 10px;
}
