/* =============================================
   FinDeMes — Design System
   Fintech vibrante · Mobile-first · Production
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── Variables ──────────────────────────────── */
:root {
  /* Colores primarios */
  --verde:       #00E5A0;
  --verde-dark:  #00B87D;
  --verde-glow:  rgba(0, 229, 160, 0.20);
  --azul:        #0D1F3C;
  --azul-mid:    #112A52;
  --azul-card:   #162F5A;
  --azul-border: #1E3D6E;

  /* Accentos */
  --naranja:     #FF6B35;
  --amarillo:    #FFD166;
  --rojo:        #FF4757;
  --violeta:     #7B68EE;

  /* Texto */
  --text-primary:   #F0F4FF;
  --text-secondary: #8BA3C8;
  --text-muted:     #4E6A94;

  /* Superficies */
  --bg-main:     #080F1E;
  --bg-surface:  #0D1A30;
  --bg-card:     #111F3B;
  --bg-input:    #0A1524;

  /* Tipografía */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Espaciado */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Sombras */
  --shadow-card:  0 4px 24px rgba(0,0,0,0.35);
  --shadow-verde: 0 0 28px rgba(0, 229, 160, 0.18);
  --shadow-float: 0 8px 40px rgba(0,0,0,0.5);

  /* Transiciones */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Reset & Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Tipografía ─────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { color: var(--text-secondary); font-weight: 300; }
a  { color: var(--verde); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* ── Layout ─────────────────────────────────── */
.container { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 1.25rem; }
.container--wide { max-width: 900px; }

/* ── Botones ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border: none; border-radius: var(--radius-md);
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all 0.25s var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--verde);
  color: var(--azul);
  box-shadow: var(--shadow-verde);
}
.btn--primary:hover { background: var(--verde-dark); transform: translateY(-2px); box-shadow: 0 0 36px rgba(0,229,160,0.32); }
.btn--primary:active { transform: translateY(0); }
.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--azul-border);
}
.btn--ghost:hover { border-color: var(--verde); color: var(--verde); }
.btn--danger { background: var(--rojo); color: #fff; }
.btn--full { width: 100%; }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.82rem; }

/* ── Inputs ──────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: 0.45rem;
  font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1.5px solid var(--azul-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px var(--verde-glow);
}
.form-input::placeholder { color: var(--text-muted); }

/* ── Cards ───────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--azul-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}
.card--glow { box-shadow: var(--shadow-card), var(--shadow-verde); border-color: rgba(0,229,160,0.2); }

/* ── Badges ──────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge--verde  { background: var(--verde-glow); color: var(--verde); }
.badge--rojo   { background: rgba(255,71,87,0.15); color: var(--rojo); }
.badge--naranja{ background: rgba(255,107,53,0.15); color: var(--naranja); }
.badge--yellow { background: rgba(255,209,102,0.15); color: var(--amarillo); }

/* ── Alertas ─────────────────────────────────── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert--error   { background: rgba(255,71,87,0.1); color: var(--rojo); border-color: var(--rojo); }
.alert--success { background: rgba(0,229,160,0.1); color: var(--verde); border-color: var(--verde); }
.alert--info    { background: rgba(123,104,238,0.1); color: var(--violeta); border-color: var(--violeta); }

/* ── Navbar ──────────────────────────────────── */
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-surface);
  border-top: 1px solid var(--azul-border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 0.6rem 0.5rem;
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted); font-size: 0.68rem; font-weight: 500;
  border: none; background: none; font-family: var(--font-body);
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item.active { color: var(--verde); }
.nav-item.active svg { filter: drop-shadow(0 0 6px var(--verde)); }

/* ── Header de página ────────────────────────── */
.page-header {
  padding: 1.5rem 0 1rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.page-header__icon {
  width: 40px; height: 40px;
  background: var(--verde-glow);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--verde);
}

/* ── Stat cards ──────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--azul-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.stat-card__label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.35rem; }
.stat-card__value { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.stat-card__delta { font-size: 0.75rem; margin-top: 0.25rem; }
.stat-card--verde  { border-color: rgba(0,229,160,0.25); }
.stat-card--rojo   { border-color: rgba(255,71,87,0.2); }
.stat-card--yellow { border-color: rgba(255,209,102,0.2); }

/* ── Progress bar ────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--azul-border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-bar__fill {
  height: 100%; border-radius: 99px;
  background: var(--verde);
  transition: width 0.6s var(--ease);
}

/* ── Lista de movimientos ────────────────────── */
.mov-item {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--azul-border);
}
.mov-item:last-child { border-bottom: none; }
.mov-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 1rem;
}
.mov-icon--ingreso  { background: rgba(0,229,160,0.12); }
.mov-icon--gasto    { background: rgba(255,71,87,0.12); }
.mov-icon--extra    { background: rgba(255,209,102,0.12); }
.mov-body { flex: 1; min-width: 0; }
.mov-desc { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-date { font-size: 0.72rem; color: var(--text-muted); }
.mov-amount { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; white-space: nowrap; }

/* ── Tabs ────────────────────────────────────── */
.tabs {
  display: flex; gap: 0.35rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  margin-bottom: 1.25rem;
}
.tab {
  flex: 1; padding: 0.6rem;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  color: var(--text-muted); background: transparent;
}
.tab.active { background: var(--verde); color: var(--azul); font-weight: 700; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8,15,30,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--azul-border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem 1.25rem 2rem;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal__handle {
  width: 36px; height: 4px;
  background: var(--azul-border);
  border-radius: 99px;
  margin: 0 auto 1.25rem;
}

/* ── Calendario ──────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-header-cell {
  text-align: center; font-size: 0.68rem;
  color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; padding: 0.4rem 0;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px; font-size: 0.8rem;
  cursor: pointer; position: relative;
  transition: background 0.15s;
}
.cal-day:hover { background: var(--azul-card); }
.cal-day.today { background: var(--verde); color: var(--azul); font-weight: 700; }
.cal-day.has-event::after {
  content: '';
  position: absolute; bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--naranja);
}
.cal-day.other-month { opacity: 0.3; }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--azul-border); border-radius: 99px; }

/* ── Utilidades ──────────────────────────────── */
.hidden  { display: none !important; }
.flex    { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-verde   { color: var(--verde); }
.text-rojo    { color: var(--rojo); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.pb-nav { padding-bottom: 5.5rem; }
.section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; margin-bottom: 0.75rem; }

/* ── Skeleton loader ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--azul-card) 25%, var(--azul-border) 50%, var(--azul-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Animación entrada ────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.45s var(--ease) both; }
.fade-up-delay-1 { animation-delay: 0.08s; }
.fade-up-delay-2 { animation-delay: 0.16s; }
.fade-up-delay-3 { animation-delay: 0.24s; }

/* ── Auth pages ──────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 2rem 1.25rem;
  background: var(--bg-main);
  position: relative; overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute; top: -120px; right: -80px;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(0,229,160,0.09) 0%, transparent 70%);
  pointer-events: none;
}
.auth-logo {
  text-align: center; margin-bottom: 2rem;
}
.auth-logo__icon {
  width: 64px; height: 64px;
  background: var(--verde);
  border-radius: 18px;
  display: inline-grid; place-items: center;
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-verde);
}
.auth-logo__name {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 800;
  color: var(--text-primary);
}
.auth-logo__tagline { font-size: 0.82rem; color: var(--text-muted); }

.divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.25rem 0;
}
.divider__line { flex: 1; height: 1px; background: var(--azul-border); }
.divider__text { font-size: 0.75rem; color: var(--text-muted); }

/* ── Checkbox custom ──────────────────────────── */
.checkbox-wrap { display: flex; align-items: flex-start; gap: 0.6rem; }
.checkbox-wrap input[type=checkbox] {
  width: 18px; height: 18px; flex-shrink: 0;
  accent-color: var(--verde);
  margin-top: 2px;
}
.checkbox-wrap label { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }

/* ── Donut mini ───────────────────────────────── */
.donut-wrap { position: relative; display: inline-block; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* ── Admin table ──────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
  text-align: left; padding: 0.65rem 0.75rem;
  color: var(--text-muted); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--azul-border);
}
.data-table td { padding: 0.75rem 0.75rem; border-bottom: 1px solid rgba(30,61,110,0.4); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Responsive ──────────────────────────────── */
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .navbar { top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--azul-border); flex-direction: column; width: 72px; height: 100vh; padding: 1.5rem 0.5rem; }
  .nav-item { flex-direction: column; }
  body { padding-left: 72px; }
  .pb-nav { padding-bottom: 2rem; }
}
