/* ============================================================
   CCSFAC — Dashboard de Gestión
   Fuente: Inter | Paleta: azul marino FAC + dorado
   ============================================================ */

:root {
  --db-sidebar-w: 230px;
  --db-fac-azul: #1a3a6e;
  --db-fac-azul-oscuro: #112550;
  --db-fac-dorado: #c9a227;
  --db-fac-dorado-claro: #f0d080;
  --db-sidebar-text: rgba(255,255,255,0.78);
  --db-sidebar-hover: rgba(255,255,255,0.10);
  --db-sidebar-active-bg: rgba(201,162,39,0.18);
  --db-sidebar-active-text: var(--db-fac-dorado-claro);
}

* { box-sizing: border-box; }

body.db-body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  background: #f0f2f6;
  color: #212529;
  margin: 0;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.db-sidebar {
  width: var(--db-sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(175deg, var(--db-fac-azul-oscuro) 0%, var(--db-fac-azul) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
}

.db-sidebar__brand {
  display: flex;
  align-items: center;
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.db-sidebar__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  line-height: 1.2;
}

.db-sidebar__sub {
  font-size: 0.68rem;
  color: var(--db-fac-dorado-claro);
  letter-spacing: 0.02em;
}

.db-sidebar__nav {
  padding: 0.75rem 0.6rem;
  flex: 1;
}

.db-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  color: var(--db-sidebar-text);
  text-decoration: none;
  font-size: 0.845rem;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.db-nav-item i { font-size: 1.05rem; flex-shrink: 0; }

.db-nav-item:hover {
  background: var(--db-sidebar-hover);
  color: #fff;
}

.db-nav-item.active {
  background: var(--db-sidebar-active-bg);
  color: var(--db-sidebar-active-text);
  font-weight: 600;
}

.db-nav-item--danger { color: rgba(255,100,100,0.85); }
.db-nav-item--danger:hover { background: rgba(220,53,69,0.18); color: #ff8080; }

.db-sidebar__divider {
  border-color: rgba(255,255,255,0.1);
  margin: 0.5rem 0.85rem;
}

/* ── Main area ────────────────────────────────────────────── */
.db-main {
  margin-left: var(--db-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
.db-topbar {
  height: 54px;
  background: #fff;
  border-bottom: 1px solid #e2e6ea;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.db-topbar__toggle {
  background: none; border: none; cursor: pointer;
  color: #495057; padding: 4px;
}

.db-topbar__title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #212529;
  flex: 1;
}

.db-topbar__user {
  font-size: 0.82rem;
  color: #6c757d;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.db-topbar__user:hover,
.db-topbar__user:focus {
  background: #f0f2f6;
  color: #343a40;
  outline: none;
  box-shadow: none;
}

.db-topbar__user::after {
  margin-left: 0.4em;
}

/* ── Content ──────────────────────────────────────────────── */
.db-content {
  padding: 1.75rem 1.75rem;
  flex: 1;
}

/* ── Cards ────────────────────────────────────────────────── */
.db-card {
  border: 1px solid #dee2e6;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.db-card__header {
  font-weight: 600;
  font-size: 0.84rem;
  background: #f8f9fb;
  border-bottom: 1px solid #dee2e6;
  border-radius: 10px 10px 0 0 !important;
  padding: 0.65rem 1rem;
  color: #343a40;
}

/* ── Stat cards ───────────────────────────────────────────── */
.db-stat-card {
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.db-stat-card__icon {
  position: absolute;
  right: 1rem; bottom: 0.5rem;
  font-size: 3.5rem;
  opacity: 0.15;
  line-height: 1;
}

.db-stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.db-stat-card__label {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Nombres usados en el CSS (por compatibilidad) */
.db-stat-card--blue    { background: linear-gradient(135deg, #1a3a6e 0%, #1e4a8a 100%); }
.db-stat-card--green   { background: linear-gradient(135deg, #157347 0%, #198754 100%); }

/* Nombres usados en el template home.html */
.db-stat--blue  { background: linear-gradient(135deg, #1a3a6e 0%, #1e4a8a 100%); }
.db-stat--green { background: linear-gradient(135deg, #157347 0%, #198754 100%); }
.db-stat--gold  { background: linear-gradient(135deg, #a07800 0%, #c9a227 100%); }
.db-stat--teal  { background: linear-gradient(135deg, #0f6b70 0%, #17a2b8 100%); }
.db-stat-card--orange  { background: linear-gradient(135deg, #d35400 0%, #e67e22 100%); }
.db-stat-card--purple  { background: linear-gradient(135deg, #6f42c1 0%, #9461e0 100%); }

/* ── Page heading ─────────────────────────────────────────── */
.db-page-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--db-fac-azul);
  letter-spacing: -0.02em;
  margin: 0;
}

/* ── Form sections ────────────────────────────────────────── */
.db-form-section {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6c757d;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

/* ── Log list (inline) ────────────────────────────────────── */
.db-log-list { padding: 0.5rem 1rem; }

.db-log-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f0f2f6;
}

.db-log-item:last-child { border-bottom: none; }

.db-log-item__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

/* Clases del template home.html para el log */
.db-log-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.db-log--creacion_proceso { background: #dbe4f3; color: #1a3a6e; }
.db-log--cambio_estado    { background: #fde8d0; color: #c05000; }
.db-log--subida_documento { background: #d3e4fd; color: #0a58ca; }
.db-log--recepcion_oferta { background: #d1f0e0; color: #0a5c30; }
.db-log--envio_email      { background: #e8d8fb; color: #5a29a3; }

.db-log-item__body { flex: 1; min-width: 0; }

.db-log-item__desc {
  font-size: 0.825rem;
  color: #343a40;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-log-item__meta {
  font-size: 0.72rem;
  color: #6c757d;
  margin-top: 1px;
}

/* Color del dot según acción */
.db-log-dot--creacion_proceso  { background: #1a3a6e; }
.db-log-dot--cambio_estado     { background: #e67e22; }
.db-log-dot--subida_documento  { background: #0d6efd; }
.db-log-dot--recepcion_oferta  { background: #198754; }
.db-log-dot--envio_email       { background: #6f42c1; }

/* ── Log badge (tabla log.html) ───────────────────────────── */
.db-log-badge {
  font-size: 0.68rem; font-weight: 500;
  padding: 0.28em 0.65em; border-radius: 20px;
}

.db-log-badge--creacion_proceso  { background: #dbe4f3; color: #1a3a6e; }
.db-log-badge--cambio_estado     { background: #fde8d0; color: #c05000; }
.db-log-badge--subida_documento  { background: #d3e4fd; color: #0a58ca; }
.db-log-badge--recepcion_oferta  { background: #d1f0e0; color: #0a5c30; }
.db-log-badge--envio_email       { background: #e8d8fb; color: #5a29a3; }

/* ── Estado badges (reutilizados del público) ─────────────── */
.badge.estado-borrador    { background: #6c757d; color: #fff; }
.badge.estado-abierto     { background: #198754; color: #fff; }
.badge.estado-cerrado     { background: #e67e22; color: #fff; }
.badge.estado-adjudicado  { background: #1a3a6e; color: #fff; }
.badge.estado-desierto    { background: #dc3545; color: #fff; }
.badge.estado-cancelado   { background: #6c757d; color: #fff; }

/* ── Paquetes oferta (detalle oferta) ─────────────────────── */
.db-oferta-paquete {
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
  background: #fafbfc;
  transition: box-shadow 0.18s;
}

.db-oferta-paquete:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }

.db-oferta-paquete__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.6rem;
}

.db-oferta-paquete__badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
}

/* ── Tabla general ────────────────────────────────────────── */
.table thead th {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--db-fac-azul) !important;
  color: #fff !important;
  border-color: #1e4a8a;
  padding: 0.65rem 1rem;
}

.table tbody tr:hover { background: #f0f4ff; }

/* ── Login page ───────────────────────────────────────────── */
body.db-login-body {
  background: linear-gradient(135deg, var(--db-fac-azul-oscuro) 0%, var(--db-fac-azul) 60%, #1e4a8a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.db-login-card {
  background: #fff;
  border-radius: 14px;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 20px 60px rgba(17, 37, 80, 0.35);
}

.db-login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.db-login-brand h1 {
  font-size: 1.1rem;
  color: var(--db-fac-azul);
  margin-bottom: 0.2rem;
}

.db-login-brand p {
  color: #6c757d;
  font-size: 0.78rem;
  margin: 0;
}

/* ── Responsive sidebar ───────────────────────────────────── */
@media (max-width: 991px) {
  .db-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .db-sidebar.open {
    transform: translateX(0);
  }
  .db-main {
    margin-left: 0;
  }
}
