/* ============================================================
   SIESIS FORMS v2.0 - Estilos globales
   Marca: SIESIS GROUP
   Colores: Azul #2BBCD4 / Magenta #C0177A / Oscuro #1A2B3C
   ============================================================ */

:root {
  /* Paleta SIESIS */
  --azul:         #2BBCD4;
  --azul-mid:     #1FA8BF;
  --azul-oscuro:  #1A2B3C;
  --azul-claro:   #E8F9FC;
  --azul-line:    rgba(43,188,212,0.18);
  --magenta:      #C0177A;
  --magenta-bg:   #FCE4F3;
  --magenta-mid:  #A01268;
  /* Neutros */
  --blanco:       #FFFFFF;
  --fondo:        #F0F7F9;
  --fondo2:       #E4EEF1;
  --gris:         #6B7280;
  --gris-claro:   #F3F4F6;
  --borde:        #D1E8ED;
  --texto:        #111827;
  --texto-2:      #374151;
  /* Sombras */
  --sombra-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --sombra:       0 4px 16px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --sombra-lg:    0 10px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  /* Radios */
  --radio:        10px;
  --radio-lg:     16px;
  --radio-xl:     20px;
  /* Fuentes */
  --font-display: 'Arial Black', 'Arial', sans-serif;
  --font-body:    'Arial', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
a  { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- LAYOUT ADMIN ---- */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--azul-oscuro);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sidebar-logo img { height: 38px; width: auto; object-fit: contain; margin-bottom: 8px; filter: brightness(0) invert(1); }

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.sidebar-logo-badge {
  display: inline-block;
  background: var(--azul);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-top: 3px;
  text-transform: uppercase;
}
.sidebar-logo-sub { font-size: 0.67rem; color: rgba(255,255,255,0.4); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-section-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 14px 10px 5px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radio);
  color: rgba(255,255,255,0.7);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(43,188,212,0.15); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--azul); color: #fff; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.73rem;
  color: rgba(255,255,255,0.35);
}
.sidebar-footer .user-name { color: rgba(255,255,255,0.85); font-weight: 600; font-size: 0.8rem; }
.sidebar-cliente-badge {
  display: inline-block;
  background: rgba(43,188,212,0.2);
  color: var(--azul);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 3px;
  font-weight: 600;
}

/* ---- CONTENIDO PRINCIPAL ---- */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--blanco);
  border-bottom: 1px solid var(--borde);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.topbar-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--texto); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page-body { padding: 28px; flex: 1; }

/* ---- CARDS ---- */
.card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--borde);
  box-shadow: var(--sombra-sm);
}
.card-header {
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-family: var(--font-display); font-size: 0.93rem; font-weight: 700; color: var(--texto); }
.card-body { padding: 22px; }

/* ---- STATS ---- */
.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-lg);
  border: 1px solid var(--borde);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.stat-num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--azul); line-height: 1; }
.stat-lbl { font-size: 0.76rem; color: var(--gris); margin-top: 5px; font-weight: 500; }
.stat-icon { width: 40px; height: 40px; background: var(--azul-claro); border-radius: var(--radio); display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 19px; height: 19px; stroke: var(--azul); }

/* ---- BOTONES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radio);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.16s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--azul); color: white; border-color: var(--azul); box-shadow: 0 2px 8px rgba(43,188,212,0.3); }
.btn-primary:hover { background: var(--azul-mid); border-color: var(--azul-mid); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(43,188,212,0.4); color: white; text-decoration: none; }
.btn-secondary { background: var(--blanco); color: var(--texto-2); border-color: var(--borde); }
.btn-secondary:hover { background: var(--gris-claro); color: var(--texto); text-decoration: none; }
.btn-danger { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.btn-danger:hover { background: #DC2626; color: white; text-decoration: none; }
.btn-magenta { background: var(--magenta); color: white; border-color: var(--magenta); }
.btn-magenta:hover { background: var(--magenta-mid); color: white; text-decoration: none; }
.btn-excel { background: #16A34A; color: white; border-color: #16A34A; }
.btn-excel:hover { background: #15803D; color: white; text-decoration: none; }
.btn-sm { padding: 6px 13px; font-size: 0.78rem; }
.btn-xs { padding: 4px 10px; font-size: 0.72rem; }
.w-100 { width: 100%; justify-content: center; }

/* ---- TABLAS ---- */
.table-wrap { overflow-x: auto; }
.cf-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.cf-table th { background: var(--fondo); color: var(--gris); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; padding: 10px 16px; border-bottom: 1px solid var(--borde); text-align: left; font-weight: 700; white-space: nowrap; }
.cf-table td { padding: 11px 16px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.cf-table tbody tr:hover { background: var(--azul-claro); }
.cf-table tbody tr:last-child td { border-bottom: none; }

/* ---- FORMULARIOS ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--texto-2); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--texto);
  background: var(--blanco);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(43,188,212,0.15); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.74rem; color: var(--gris); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---- BADGES ---- */
.badge-rol { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.badge-superadmin { background: rgba(192,23,122,0.12); color: var(--magenta); }
.badge-admin      { background: rgba(43,188,212,0.12); color: var(--azul-mid); }
.badge-visor      { background: var(--gris-claro);      color: var(--gris); }

.badge-estado { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.badge-pendiente { background: #FEF3C7; color: #92400E; }
.badge-aprobado  { background: #D1FAE5; color: #065F46; }
.badge-rechazado { background: #FEE2E2; color: #991B1B; }

.badge-tipo { display: inline-block; background: var(--azul-claro); color: var(--azul-oscuro); padding: 2px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }

/* ---- ALERTAS ---- */
.alert { padding: 12px 16px; border-radius: var(--radio); font-size: 0.86rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info     { background: var(--azul-claro); color: var(--azul-oscuro); border: 1px solid var(--borde); }
.alert-warning  { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* ---- MODAL ---- */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--blanco); border-radius: var(--radio-xl); box-shadow: var(--sombra-lg); max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--borde); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gris); padding: 4px; border-radius: 6px; display: flex; }
.modal-close:hover { background: var(--gris-claro); color: var(--texto); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--borde); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- UTILITARIOS ---- */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm  { font-size: 0.84rem; }
.fs-xs  { font-size: 0.74rem; }
.text-muted { color: var(--gris); }
.text-azul  { color: var(--azul); }
.text-magenta { color: var(--magenta); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }
.d-none { display: none; }

/* ---- LOGIN ---- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--azul-oscuro); padding: 20px; }
.login-card { background: var(--blanco); border-radius: var(--radio-xl); box-shadow: var(--sombra-lg); width: 100%; max-width: 400px; padding: 40px 36px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 52px; width: auto; }
.login-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--texto); text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 0.8rem; color: var(--gris); text-align: center; margin-bottom: 28px; }

/* ---- FOOTER ---- */
.page-footer { padding: 14px 28px; border-top: 1px solid var(--borde); font-size: 0.7rem; color: var(--gris); text-align: center; }

/* ---- SUPERADMIN BADGE ---- */
.superadmin-bar {
  background: linear-gradient(90deg, var(--magenta), var(--magenta-mid));
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  padding: 5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ---- TIPO FORMULARIO CARDS ---- */
.tipo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tipo-card {
  border: 2px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.18s;
  background: var(--blanco);
  text-align: center;
}
.tipo-card:hover { border-color: var(--azul); background: var(--azul-claro); transform: translateY(-2px); box-shadow: var(--sombra); }
.tipo-card.selected { border-color: var(--azul); background: var(--azul-claro); }
.tipo-card-icon { font-size: 1.8rem; margin-bottom: 8px; }
.tipo-card-label { font-size: 0.82rem; font-weight: 600; color: var(--texto); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}
