/* ============================================================================
   portal.css — Identidad visual del Portal Tributario (FacturacionDIAN)
   Unificado con la marca CyberShop: azul icónico #122C94 / #091C5A.
   Fuente única de tema (portado de CyberShop variables.css).
   ========================================================================== */

:root {
  /* Marca CyberShop */
  --azul:          #122C94;
  --azul-oscuro:   #091C5A;
  --navy:          #0e1b33;
  --azul-medio:    #2a4d69;
  --naranja:       #fb8500;   /* acento */
  --marca-rgb:     18, 44, 148;

  /* Superficies / texto */
  --bg:            #f4f6fb;
  --surface:       #ffffff;
  --borde:         #e6ebf5;
  --texto:         #1e293b;
  --muted:         #64748b;

  /* Estados (semánticos) */
  --st-pendiente:  #f59e0b;
  --st-procesando: #0ea5e9;
  --st-aceptada:   #16a34a;
  --st-rechazada:  #dc2626;
  --st-error:      #64748b;
  --st-cancelada:  #94a3b8;

  /* Formas */
  --radio:         14px;
  --radio-sm:      10px;
  --sombra:        0 6px 20px rgba(var(--marca-rgb), 0.06);
  --sombra-fuerte: 0 12px 34px rgba(var(--marca-rgb), 0.12);
  --focus:         0 0 0 3px rgba(var(--marca-rgb), 0.35);

  /* Bootstrap: re-tematizar el primario a azul de marca */
  --bs-primary:      #122C94;
  --bs-primary-rgb:  18, 44, 148;
  --bs-link-color:   #122C94;
  --bs-link-hover-color: #091C5A;
}

body {
  color: var(--texto);
  font-family: 'Raleway', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(var(--marca-rgb), 0.10), transparent 34%),
    linear-gradient(180deg, #f8faff 0%, #eef2fb 42%, #f4f6fb 100%);
  background-attachment: fixed;
}

/* ── Botones / enlaces de marca ─────────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--azul); --bs-btn-border-color: var(--azul);
  --bs-btn-hover-bg: var(--azul-oscuro); --bs-btn-hover-border-color: var(--azul-oscuro);
  --bs-btn-active-bg: var(--azul-oscuro); --bs-btn-active-border-color: var(--azul-oscuro);
  --bs-btn-disabled-bg: var(--azul); --bs-btn-disabled-border-color: var(--azul);
  box-shadow: 0 4px 12px rgba(var(--marca-rgb), 0.22);
}
.btn-outline-primary {
  --bs-btn-color: var(--azul); --bs-btn-border-color: var(--azul);
  --bs-btn-hover-bg: var(--azul); --bs-btn-hover-border-color: var(--azul);
  --bs-btn-active-bg: var(--azul-oscuro);
}
.text-primary { color: var(--azul) !important; }
.bg-primary   { background-color: var(--azul) !important; }
a { color: var(--azul); }
a:hover { color: var(--azul-oscuro); }
.btn { border-radius: var(--radio-sm); font-weight: 600; }
.btn-lg { border-radius: var(--radio); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ── Layout: sidebar (gradiente de marca, igual al admin de CyberShop) ───── */
.sidebar {
  width: 264px;
  /* !important para ganarle a Bootstrap .offcanvas-lg que en escritorio fuerza
     background-color: transparent !important */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 20%),
    linear-gradient(180deg, var(--azul-oscuro) 0%, var(--azul) 100%) !important;
  color: #fff;
  min-height: 100vh;
  box-shadow: 12px 0 32px rgba(9, 28, 90, 0.22);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 8px;
}
.sidebar .brand img, .sidebar .brand .brand-mark {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  background: rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem; flex: 0 0 auto;
}
.sidebar .brand .brand-name { font-weight: 800; font-size: 1.02rem; line-height: 1.15; }
.sidebar .brand .brand-sub  { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); font-weight: 600; }
.sidebar .nav-cat {
  padding: 14px 18px 4px; font-size: 0.68rem; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.5); font-weight: 700;
}
.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.82); border-radius: 12px; margin: 4px 10px;
  padding: 13px 18px; font-weight: 600; font-size: 0.88rem; letter-spacing: .01em;
  display: flex; align-items: center; gap: 12px;
  transition: background .2s ease, color .2s ease;
}
.sidebar .nav-link i { width: 20px; text-align: center; opacity: 0.78; transition: color .2s ease, opacity .2s ease; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.sidebar .nav-link:hover i { opacity: 1; color: var(--naranja); }
.sidebar .nav-link.active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.sidebar .nav-link.active i { opacity: 1; color: var(--naranja); }
.sidebar .side-foot { color: rgba(255, 255, 255, 0.7); font-size: 0.78rem; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--borde);
  padding: 12px 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-weight: 700; color: var(--azul-oscuro); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}
.card .card-header { background: transparent; border-bottom: 1px solid var(--borde); font-weight: 700; }

/* Tarjetas KPI del dashboard */
.stat-card { border-left: 5px solid var(--azul); border-radius: var(--radio); }
.stat-card .stat-num { font-size: 1.9rem; font-weight: 800; color: var(--texto); line-height: 1; }
.stat-card .stat-lbl { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-card.verde    { border-left-color: var(--st-aceptada); }
.stat-card.azul     { border-left-color: var(--azul); }
.stat-card.rojo     { border-left-color: var(--st-rechazada); }
.stat-card.naranja  { border-left-color: var(--naranja); }
.stat-card.gris     { border-left-color: var(--st-cancelada); }

/* CTA grande (Emitir factura) */
.cta-emitir {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  color: #fff; border-radius: var(--radio); padding: 22px 24px;
  text-decoration: none; box-shadow: var(--sombra-fuerte);
}
.cta-emitir:hover { color: #fff; filter: brightness(1.06); }
.cta-emitir .cta-ico { font-size: 2rem; opacity: .92; }
.cta-emitir .cta-title { font-weight: 800; font-size: 1.15rem; }
.cta-emitir .cta-sub { opacity: .85; font-size: 0.88rem; }

/* ── Badges de estado (píldoras) ────────────────────────────────────────── */
.badge-estado {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px; font-weight: 700; font-size: 0.76rem;
}
.badge-PENDIENTE  { background: #fef3c7; color: #92400e; }
.badge-PROCESANDO { background: #e0f2fe; color: #075985; }
.badge-ACEPTADA   { background: #dcfce7; color: #166534; }
.badge-RECHAZADA  { background: #fee2e2; color: #991b1b; }
.badge-ERROR      { background: #e2e8f0; color: #334155; }
.badge-CANCELADA  { background: #f1f5f9; color: #475569; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.table { --bs-table-bg: transparent; }
.table th {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--borde);
}
.table td { vertical-align: middle; }

/* ── Checklist "listo para facturar" ────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borde); }
.checklist li:last-child { border-bottom: none; }
.checklist .chk-ok  { color: var(--st-aceptada); }
.checklist .chk-no  { color: var(--st-rechazada); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .es-ico { font-size: 3rem; color: var(--azul); opacity: .5; }
.empty-state h4 { color: var(--texto); margin: 12px 0 6px; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.form-control, .form-select { border-radius: var(--radio-sm); border-color: #d7deec; }
.form-control:focus, .form-select:focus {
  border-color: var(--azul); box-shadow: var(--focus);
}
.form-label { font-weight: 600; color: #475569; font-size: 0.9rem; }
.field-help { font-size: 0.8rem; color: var(--muted); }

/* Banner de ambiente */
.env-banner { border-radius: var(--radio); padding: 12px 16px; font-weight: 600; }
.env-banner.pruebas    { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.env-banner.produccion { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
