/* ============================================================
   GoGo Bikes — Dashboard Fintech Oscuro
   Diseño mobile-first, sin dependencias externas
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Fondos */
  --bg:           #07101f;
  --surface:      #0e1c30;
  --surface-2:    #132338;
  --surface-3:    #182d47;
  --border:       #1c3050;
  --border-light: #243b5e;

  /* Texto */
  --text:         #dce8f5;
  --text-muted:   #6b8cad;
  --text-dim:     #3a5572;

  /* Acentos */
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --primary-glow: rgba(37,99,235,.25);
  --cyan:         #06b6d4;
  --cyan-h:       #0891b2;
  --green:        #10b981;
  --green-dim:    rgba(16,185,129,.15);
  --green-border: #059669;
  --yellow:       #f59e0b;
  --yellow-dim:   rgba(245,158,11,.15);
  --yellow-border:#d97706;
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,.15);
  --red-border:   #dc2626;
  --purple:       #8b5cf6;

  /* Layout */
  --sidebar-w:    240px;
  --header-h:     60px;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --transition:   .18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 60% 20%, rgba(37,99,235,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 10% 80%, rgba(6,182,212,.08) 0%, transparent 50%),
              var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.login-logo p  { color: var(--text-muted); font-size: .85rem; margin-top: .25rem; }

/* ── App Layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}
.app-main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}
.sidebar-logo .logo-icon { font-size: 1.4rem; }
.sidebar-logo .logo-text { color: var(--text); }
.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: .25rem;
  line-height: 1;
}

.nav-section {
  padding: 1rem .75rem .25rem;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
}
.nav-menu { padding: .5rem .75rem; }
.nav-item { margin-bottom: .2rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active .nav-link {
  background: var(--primary-glow);
  color: #93c5fd;
  border: 1px solid rgba(37,99,235,.3);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
}
.sidebar-footer strong { color: var(--text); display: block; margin-bottom: .15rem; }

/* ── Overlay móvil ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}
.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .35rem;
}
.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}
.header-title { font-weight: 600; font-size: .95rem; color: var(--text); }
.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .82rem;
}
.user-name { color: var(--text-muted); display: none; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-header .card-title { margin-bottom: 0; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.blue::before   { background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.stat-card.green::before  { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.red::before    { background: var(--red); }
.stat-card.purple::before { background: var(--purple); }

.stat-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1;
}
.stat-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .4rem;
}
.stat-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.8rem;
  opacity: .15;
}

/* ── Grids de contenido ────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.content-grid.thirds { grid-template-columns: 1fr 1fr 1fr; }
.full-width { grid-column: 1 / -1; }

/* ── Formularios ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  padding: .6rem .85rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-row.thirds { grid-template-columns: 1fr 1fr 1fr; }
.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .3rem;
}
.form-error {
  font-size: .75rem;
  color: var(--red);
  margin-top: .3rem;
}

/* ── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--primary);    color: #fff; }
.btn-primary:hover { background: var(--primary-h); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-success   { background: var(--green);      color: #fff; }
.btn-success:hover { background: var(--green-border); }
.btn-danger    { background: var(--red);        color: #fff; }
.btn-danger:hover { background: var(--red-border); }
.btn-secondary { background: var(--surface-3);  color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost     { background: transparent;       color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-cyan      { background: var(--cyan);       color: #fff; }
.btn-cyan:hover { background: var(--cyan-h); }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2em .6em;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-primary  { background: var(--primary-glow); color: #93c5fd; border: 1px solid rgba(37,99,235,.3); }
.badge-green    { background: var(--green-dim);    color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.badge-yellow   { background: var(--yellow-dim);   color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }
.badge-red      { background: var(--red-dim);      color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.badge-cyan     { background: rgba(6,182,212,.15); color: #67e8f9; border: 1px solid rgba(6,182,212,.3); }
.badge-gray     { background: rgba(107,140,173,.15);color: var(--text-muted); border: 1px solid var(--border); }
.badge-secondary { background: var(--surface-3);  color: var(--text-muted); border: 1px solid var(--border); }

/* ── Tablas ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: monospace; font-size: .82rem; }

/* ── Alertas ─────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: var(--green-dim);  border: 1px solid var(--green-border);  color: #6ee7b7; }
.alert-warning { background: var(--yellow-dim); border: 1px solid var(--yellow-border); color: #fcd34d; }
.alert-danger  { background: var(--red-dim);    border: 1px solid var(--red-border);    color: #fca5a5; }
.alert-info    { background: var(--primary-glow);border: 1px solid rgba(37,99,235,.4);  color: #93c5fd; }

/* ── Calculadora: panel de resultados ─────────────────────── */
.result-panel {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.result-row:last-child { border-bottom: none; }
.result-row.total {
  margin-top: .5rem;
  padding-top: .75rem;
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid var(--border-light);
  border-bottom: none;
}
.result-row.highlight .result-val { color: var(--cyan); }
.result-row.main .result-val      { color: var(--green); font-size: 1.25rem; }
.result-label { color: var(--text-muted); }
.result-val   { font-variant-numeric: tabular-nums; font-weight: 600; }
.result-badge { font-size: .7rem; }

/* ── Stock visual ───────────────────────────────────────────── */
.stock-bar-wrap { display: flex; align-items: center; gap: .75rem; }
.stock-bar-bg   { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.stock-bar      { height: 100%; border-radius: 3px; transition: width .4s ease; }
.stock-bar.ok     { background: var(--green); }
.stock-bar.warn   { background: var(--yellow); }
.stock-bar.danger { background: var(--red); }
.stock-num  { font-size: .85rem; font-weight: 700; min-width: 2.5rem; text-align: right; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .2rem;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body    { padding: 1.5rem; }
.modal-footer  { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Utilidades ─────────────────────────────────────────────── */
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.ml-auto { margin-left: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .82rem; }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-cyan  { color: var(--cyan); }
.fw-bold { font-weight: 700; }
.hidden  { display: none !important; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.page-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* Divisor de sección */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Toast de notificaciones */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideIn .2s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--cyan); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-toggle { display: flex; }
  .app-content  { margin-left: 0; }
  .content-grid { grid-template-columns: 1fr; }
  .content-grid.thirds { grid-template-columns: 1fr; }
  .user-name { display: none; }
}
@media (max-width: 600px) {
  .app-main { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.thirds { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 1.25rem; }
  .modal { max-width: 100%; border-radius: 14px 14px 0 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .login-box { padding: 2rem 1.25rem; }
}
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Tabla searchable filter ───────────────────────────────── */
.table-search {
  max-width: 260px;
  position: relative;
}
.table-search input {
  padding-left: 2.2rem;
}
.table-search::before {
  content: '🔍';
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  pointer-events: none;
}
