/* Variables de tema: Arc UI (Claro Cálido) + HorizonX (Oscuro) + Grainient + Uber Base */
:root {
  --bg: #f6f3ec;
  --card: #fffdf9;
  --card-muted: #efeae0;
  --border: rgba(20, 20, 19, 0.085);
  --text: #141413;
  --text-muted: #5c5b57;
  --primary: #276ef1;
  --primary-hover: #1d4ed8;
  --shadow: 0 8px 24px -10px rgba(20, 20, 19, 0.08);
  --hero-bg: radial-gradient(120% 140% at 0% 0%, #276ef1 0%, #3b5bdb 42%, #4c3f91 82%, #1e1b4b 100%);
  --hero-border: rgba(39, 110, 241, 0.25);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #090b10;
  --card: #12151e;
  --card-muted: #181c28;
  --border: rgba(255, 255, 255, 0.085);
  --text: #f5f7fa;
  --text-muted: #98a2b3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.55);
  --hero-bg: radial-gradient(120% 140% at 0% 0%, #1e3a8a 0%, #172554 38%, #0f172a 78%, #1e1b4b 100%);
  --hero-border: rgba(96, 165, 250, 0.28);
  color-scheme: dark;
}

/* Tarjeta Hero con textura Grainient (film grain sutil) */
.hero-grainient {
  background: var(--hero-bg);
  border-color: var(--hero-border) !important;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.hero-grainient::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-grainient > * {
  position: relative;
  z-index: 1;
}

/* Squircle suave estilo Arc UI / Bento */
.rounded-2xl {
  border-radius: 1.35rem;
}

/* Animación suave al cambiar de vista */
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-animate {
  animation: viewFadeIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hover sutil en tarjetas Bento */
.bento-card {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), border-color 220ms ease, box-shadow 220ms ease;
}
.bento-card:hover {
  border-color: rgba(148, 163, 184, 0.28);
}
[data-theme="dark"] .bento-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

/* Métricas internas de vidrio esmerilado dentro de la tarjeta Hero */
.hero-metric-chip {
  background: rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.875rem;
  padding: 0.625rem 0.75rem;
}

/* Sidebar estilo Arc UI */
.arc-sidebar {
  background: rgba(240, 235, 225, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
[data-theme="dark"] .arc-sidebar {
  background: rgba(14, 17, 24, 0.88);
}

/* Bottom nav flotante estilo móvil moderno */
.mobile-floating-nav {
  background: rgba(255, 253, 249, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}
[data-theme="dark"] .mobile-floating-nav {
  background: rgba(18, 21, 30, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", Roboto, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Números tabulares para alineación contable precisa */
.font-tabular {
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

/* Animación de punto palpitante estilo Pokébonk */
@keyframes pokebonk-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.badge-pokebonk {
  animation: pokebonk-pulse 1.8s infinite ease-in-out;
}

/* Manejo adaptativo del Header (Desktop normal vs iPhone Notch) */
.header-safe-top {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .header-safe-top {
      padding-top: max(44px, calc(env(safe-area-inset-top, 0px) + 10px));
      padding-bottom: 0.6rem;
    }
  }
}

/* Forzar que todos los selects y sus options hereden el fondo y texto correctos del tema */
select, option {
  background-color: var(--card) !important;
  color: var(--text) !important;
}

[data-theme="dark"] select,
[data-theme="dark"] option {
  background-color: #172033 !important;
  color: #f1f5f9 !important;
}

/* Animación táctil en botones */
.btn-action {
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-action:active {
  transform: scale(0.97);
}

/* Transición suave para Drawer lateral */
.transition-drawer {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

/* Donut Chart nativo mediante conic-gradient continuo */
.conic-donut {
  border-radius: 9999px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.conic-donut-hole {
  position: absolute;
  border-radius: 9999px;
  background-color: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

/* Swipe-to-delete en celular iOS */
.swipe-container {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  border-radius: 0.875rem;
}
.swipe-action-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 85px;
  background-color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0.875rem;
}
.swipe-card {
  position: relative;
  background-color: var(--card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* Spinners */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin-fast {
  animation: spin 0.75s linear infinite;
}
