/* styles.css — estilos propios de Gesfact.
   El grueso del layout viene de Tailwind por CDN; aquí van componentes reutilizables
   y ajustes que conviene tener fuera de las clases utilitarias. Todo en español. */

:root {
  --korex-azul: #2563eb;
  --korex-azul-claro: #60a5fa;
  --korex-oscuro: #0f172a;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ----------------------------------------------------------------------------
   Marca / logo
---------------------------------------------------------------------------- */
.korex-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 60%, #1e3a8a 100%);
  position: relative;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}
.korex-logo-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.95);
  border-right-color: transparent;
  border-bottom-color: transparent;
}

/* ----------------------------------------------------------------------------
   Formularios
---------------------------------------------------------------------------- */
.korex-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.625rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.korex-input:focus {
  outline: none;
  border-color: var(--korex-azul);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.korex-input::placeholder { color: #94a3b8; }

.korex-store-select {
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  max-width: 14rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  cursor: pointer;
}
.korex-store-select option { color: #0f172a; }

/* ----------------------------------------------------------------------------
   Botones
---------------------------------------------------------------------------- */
.korex-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--korex-azul);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.625rem;
  transition: background 0.15s, transform 0.05s;
}
.korex-btn-primary:hover { background: #1d4ed8; }
.korex-btn-primary:active { transform: translateY(1px); }
.korex-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.korex-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.625rem;
  transition: background 0.15s, border-color 0.15s;
}
.korex-btn-secondary:hover { background: #f1f5f9; border-color: #94a3b8; }

.korex-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}
.korex-btn-danger:hover { background: #fee2e2; }

/* ----------------------------------------------------------------------------
   Navegación lateral
---------------------------------------------------------------------------- */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active {
  background: var(--korex-azul);
  color: #fff;
}
.nav-link.active svg { color: #fff; }
.nav-link svg { width: 18px; height: 18px; color: #94a3b8; flex-shrink: 0; }
.nav-link.active svg { color: #fff; }

/* ----------------------------------------------------------------------------
   Tarjetas KPI
---------------------------------------------------------------------------- */
.kpi-card {
  background: #fff;
  border-radius: 0.875rem;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 1px solid #eef2f7;
}
.kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: #0f172a; }
.kpi-label { font-size: 0.75rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }

/* ----------------------------------------------------------------------------
   Badges de estado y motivos
---------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-anomalia { background: #fee2e2; color: #b91c1c; }
.badge-normal { background: #dcfce7; color: #15803d; }
.badge-neutro { background: #e2e8f0; color: #475569; }
.badge-efectivo { background: #dcfce7; color: #166534; }
.badge-tarjeta { background: #dbeafe; color: #1d4ed8; }
.badge-desconocido { background: #f1f5f9; color: #64748b; }

/* ----------------------------------------------------------------------------
   Tablas
---------------------------------------------------------------------------- */
.korex-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.korex-table thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.korex-table tbody td { padding: 0.65rem 0.9rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.korex-table tbody tr:hover { background: #f8fafc; }

/* ----------------------------------------------------------------------------
   Miniaturas
---------------------------------------------------------------------------- */
.thumb {
  background: #e2e8f0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E") center / 40px no-repeat;
  object-fit: cover;
}

/* ----------------------------------------------------------------------------
   Toasts
---------------------------------------------------------------------------- */
.toast {
  background: #0f172a;
  color: #fff;
  border-radius: 0.625rem;
  padding: 0.7rem 0.95rem;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  animation: toast-in 0.18s ease-out;
}
.toast-ok { border-left: 4px solid #22c55e; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid #3b82f6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Spinner / animación de carga */
.korex-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s infinite;
  border-radius: 0.5rem;
}
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
