/* ══════════════════════════════════════════════════════
   SISTEMA CASA DE CAMBIOS - SR. DE LOS MILAGROS
   Tema: Morado y Dorado (Colores del Señor de los Milagros)
   ══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Paleta principal: Morado y Dorado ── */
  --primary:        #5b1f8a;   /* morado oscuro */
  --primary-light:  #7b35b8;   /* morado medio */
  --primary-dark:   #3b0f5e;   /* morado muy oscuro */
  --accent:         #c9930a;   /* dorado */
  --accent-light:   #f0b429;   /* dorado claro */
  --accent-pale:    #fef3c7;   /* dorado muy suave */

  /* ── Estado ── */
  --danger:         #dc2626;
  --success:        #16a34a;
  --warning:        #d97706;
  --info:           #0369a1;

  /* ── Fondos y superficie ── */
  --bg:             #f5f0fa;   /* fondo general levemente morado */
  --bg-card:        #ffffff;
  --bg-sidebar:     #3b0f5e;   /* morado muy oscuro para sidebar */
  --bg-sidebar2:    #2d0a48;   /* sidebar más oscuro aún */

  /* ── Texto ── */
  --text:           #1a0a2e;
  --text-muted:     #6b5c7e;
  --text-light:     #9c8ab0;

  /* ── Bordes y sombras ── */
  --border:         #e6d8f5;
  --shadow:         0 2px 12px rgba(91,31,138,0.10);
  --shadow-lg:      0 8px 32px rgba(91,31,138,0.16);

  /* ── Otros ── */
  --radius:         10px;
  --radius-lg:      16px;
  --sidebar-w:      268px;
  --header-h:       64px;
  --font:           'Outfit', sans-serif;
  --font-mono:      'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ══ LAYOUT ══ */
.app-layout { display: flex; min-height: 100vh; }

/* ══ SIDEBAR ══ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 100;
  transition: transform .3s;
  overflow-y: auto;
  /* Línea dorada sutil en el borde derecho */
  border-right: 2px solid rgba(201,147,10,0.3);
}

/* ── Logo ── */
.sidebar-logo {
  padding: 0;
  border-bottom: 1px solid rgba(201,147,10,0.25);
  background: var(--bg-sidebar2);
}

.logo-img {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
}

.logo-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  background: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
}
.logo-icon img {
  width: 100%; height: 100%; object-fit: cover;
}

.logo-text strong {
  display: block; font-size: 12px; font-weight: 800;
  color: var(--accent-light); line-height: 1.2;
  text-transform: uppercase; letter-spacing: .03em;
}
.logo-text span {
  font-size: 10px; color: rgba(255,255,255,0.45);
}

/* ── Nav ── */
.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-group-label {
  padding: 14px 18px 5px;
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  color: rgba(240,180,41,0.5);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.62);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: all .18s; position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.95);
}
.nav-item.active {
  background: rgba(201,147,10,0.18);
  color: var(--accent-light);
  border-right: 3px solid var(--accent);
  font-weight: 700;
}
.nav-item i { width: 17px; height: 17px; flex-shrink: 0; }

/* ── Footer sidebar ── */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(201,147,10,0.2);
  background: var(--bg-sidebar2);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-dark); font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.user-name  { color: #fff; font-size: 12px; font-weight: 700; }
.user-role  { color: rgba(255,255,255,0.4); font-size: 10px; }
.btn-logout {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,0.35); cursor: pointer; padding: 4px;
  transition: color .2s;
}
.btn-logout:hover { color: #ff6b6b; }

/* ══ MAIN ══ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

.top-bar {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(91,31,138,0.07);
}
.top-bar-title { font-size: 17px; font-weight: 800; flex: 1; color: var(--primary); }
.top-bar-badge {
  background: var(--primary); color: #fff;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}

.tc-display {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg); padding: 5px 12px;
  border-radius: 20px; font-size: 12px;
  border: 1px solid var(--border);
}
.tc-display .tc-val { font-family: var(--font-mono); font-weight: 800; color: var(--primary); }

.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.page-body { padding: 24px; flex: 1; }

/* ══ CARDS ══ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--border);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
  color: var(--primary);
}

/* ══ STAT CARDS ══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #ede9fe; color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.gold   { background: #fef9c3; color: var(--accent); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: var(--primary-light); }
.stat-icon.gray   { background: #f1f5f9; color: #64748b; }

.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.stat-value { font-size: 21px; font-weight: 800; font-family: var(--font-mono); color: var(--text); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ══ TABLES ══ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg); padding: 10px 14px;
  text-align: left; font-size: 11px;
  font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tbody tr:hover { background: #faf7fd; }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ══ BADGES ══ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-gold    { background: #fef9c3; color: #92400e; }
.badge-purple  { background: #f3e8ff; color: #7e22ce; }

/* ══ FORMS ══ */
.form-grid   { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-size: 12px; font-weight: 700; color: var(--text); }
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: #fff; width: 100%;
  transition: border .18s, box-shadow .18s; outline: none;
}
.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(123,53,184,0.12);
}
.form-control.mono { font-family: var(--font-mono); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 72px; }
.form-hint { font-size: 11px; color: var(--text-muted); }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-addon {
  padding: 9px 13px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-left: none; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  display: flex; align-items: center; white-space: nowrap;
}

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px; font-weight: 700;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .18s; white-space: nowrap;
}
.btn i { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-light); color: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm  { padding: 5px 11px; font-size: 11.5px; }
.btn-lg  { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  padding: 7px; border-radius: 8px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-icon:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ══ ALERTS ══ */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500; margin-bottom: 14px;
}
.alert i { width: 17px; height: 17px; flex-shrink: 0; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ══ MODALS ══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(59,15,94,0.55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(18px); transition: transform .22s;
  border-top: 4px solid var(--accent);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 18px 22px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 800; color: var(--primary); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-body  { padding: 18px 22px; }
.modal-footer { padding: 0 22px 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ══ MISC ══ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-title    { font-size: 22px; font-weight: 900; color: var(--primary); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.amount-compra { color: var(--success); font-weight: 700; }
.amount-venta  { color: var(--danger);  font-weight: 700; }
.amount-saldo  { color: var(--primary); font-weight: 700; }

.empty-state {
  text-align: center; padding: 44px 20px; color: var(--text-muted);
}
.empty-state i { width: 44px; height: 44px; margin: 0 auto 12px; display: block; opacity: .25; }

/* ══ TC WIDGET ══ */
.tc-widget {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(201,147,10,0.35);
  box-shadow: 0 4px 20px rgba(91,31,138,0.25);
}
.tc-widget-title {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; opacity: .65; margin-bottom: 12px;
}
.tc-rates { display: flex; gap: 28px; flex-wrap: wrap; }
.tc-rate-item { display: flex; flex-direction: column; }
.tc-rate-label { font-size: 10px; opacity: .6; }
.tc-rate-value { font-size: 26px; font-weight: 900; font-family: var(--font-mono); color: var(--accent-light); }
.tc-rate-sub   { font-size: 10px; opacity: .5; }
.tc-source {
  margin-top: 10px; font-size: 10px; opacity: .5;
  display: flex; align-items: center; gap: 6px;
}
.tc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-light);
  animation: pulse 2s infinite;
  display: inline-block;
}
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.35} }

/* ══ BILLETERA ══ */
.billetera-card { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 14px; }
.billetera-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 14px 18px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--accent);
}
.billetera-cliente { font-weight: 800; font-size: 15px; }
.billetera-doc     { font-size: 11px; opacity: .65; }
.billetera-saldos  { background: #fff; padding: 14px 18px; }
.saldo-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.saldo-item:last-child { border-bottom: none; }
.saldo-moneda { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.saldo-bandera { font-size: 18px; }
.saldo-valor   { font-family: var(--font-mono); font-size: 17px; font-weight: 900; color: var(--primary); }

/* ══ RESPONSIVE ══ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 14px; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(59,15,94,0.45); z-index: 99;
}
.sidebar-overlay.open { display: block; }
