/* ==========================================================================
   ZPRO RENTABILIDAD — THEME v3.0
   Brand-aligned CSS based on zpro.cl identity
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================================================
   CSS VARIABLES — DARK THEME (default)
   ========================================================================== */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-main: #131313;
  --bg-alt: #181818;
  --bg-surface: #1c1b1b;
  --bg-surface-hover: #252424;
  --bg-surface-light: #2a2a2a;
  --bg-elevated: #1e1e1e;
  --bg-input: #1a1a1a;

  /* Brand */
  --primary: #ff4500;
  --primary-hover: #e63e00;
  --primary-glow: rgba(255, 69, 0, 0.25);
  --primary-soft: rgba(255, 69, 0, 0.12);

  /* Text */
  --text-main: #e5e2e1;
  --text-muted: #9ca3af;
  --text-heading: #ffffff;
  --text-inverse: #131313;

  /* Borders */
  --border-color: #2d2d2d;
  --border-hover: #404040;

  /* Status */
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.12);

  /* Navbar */
  --nav-bg: rgba(19, 19, 19, 0.85);
  --nav-scrolled-bg: rgba(19, 19, 19, 0.96);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px var(--primary-glow);

  /* Misc */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1400px;

  /* Patterns */
  --grid-line: rgba(255, 255, 255, 0.04);
  --dot-color: rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   LIGHT THEME
   ========================================================================== */
html[data-theme="light"] {
  color-scheme: light;

  --bg-main: #f5f3ef;
  --bg-alt: #ebe8e2;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f9f7f4;
  --bg-surface-light: #f0ede7;
  --bg-elevated: #ffffff;
  --bg-input: #f5f3ef;

  --primary: #c2410c;
  --primary-hover: #9a3412;
  --primary-glow: rgba(194, 65, 12, 0.2);
  --primary-soft: rgba(194, 65, 12, 0.08);

  --text-main: #272522;
  --text-muted: #6b7280;
  --text-heading: #1f1d1a;
  --text-inverse: #ffffff;

  --border-color: #e5e2dd;
  --border-hover: #d1ccc5;

  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.1);

  --nav-bg: rgba(245, 243, 239, 0.85);
  --nav-scrolled-bg: rgba(245, 243, 239, 0.96);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 24px var(--primary-glow);

  --grid-line: rgba(0, 0, 0, 0.04);
  --dot-color: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ==========================================================================
   BACKGROUND PATTERNS
   ========================================================================== */
.bg-grid {
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
}

.bg-dots {
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container { padding: 0 32px; }
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6, .heading-font {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.2;
}

.title-hero {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.title-section {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
}

.title-card {
  font-size: 18px;
  font-weight: 600;
}

.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }

/* ==========================================================================
   PRELOADER
   ========================================================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.zpro-spinner {
  width: 60px;
  height: 60px;
  animation: spin 1.2s linear infinite;
}

.zpro-spinner circle {
  fill: var(--primary);
}

.preloader span {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: var(--font-heading);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.navbar.scrolled {
  background: var(--nav-scrolled-bg);
  box-shadow: var(--shadow-md);
}

.nav-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-brand .nav-logo-icon {
  height: 38px;
  width: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-brand .nav-logo-text {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* In light theme, the text logo (orange on dark) needs brightness adjustment */
html[data-theme="light"] .nav-brand .nav-logo-text {
  filter: brightness(0.7);
}

@media (max-width: 767px) {
  .nav-content {
    position: relative;
    justify-content: flex-end;
  }
  .nav-brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .nav-brand .nav-logo-icon {
    height: 44px;
  }
  .nav-brand .nav-logo-text {
    height: 52px;
  }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 6px;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.nav-links a,
.nav-links button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--text-heading);
  background: var(--primary-soft);
}

.nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 20px;
}

.theme-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Mobile menu toggle */
.menu-toggle {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 24px;
}

@media (min-width: 768px) {
  .menu-toggle { display: none; }
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  padding: 20px;
  flex-direction: column;
  gap: 4px;
  z-index: 999;
  overflow-y: auto;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a,
.mobile-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.mobile-menu a:hover,
.mobile-menu button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ==========================================================================
   TICKER BAR
   ========================================================================== */
.ticker-bar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  height: 38px;
  display: flex;
  align-items: center;
  margin-top: 64px;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 30s linear infinite;
  white-space: nowrap;
}

.ticker-track:hover {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 40px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.ticker-item .pair {
  font-weight: 600;
  color: var(--text-heading);
}

.ticker-item .price {
  color: var(--text-main);
}

.ticker-item .change-up {
  color: var(--success);
}

.ticker-item .change-down {
  color: var(--danger);
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */
.main-content {
  padding: 32px 0 64px;
  min-height: calc(100vh - 64px - 38px);
}

/* ==========================================================================
   DASHBOARD CARDS
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.dash-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.dash-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.dash-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dash-card:hover::before {
  opacity: 1;
}

.dash-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-card .label i {
  font-size: 16px;
  color: var(--primary);
}

.dash-card .value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}

.dash-card .value.positive { color: var(--success); }
.dash-card .value.negative { color: var(--danger); }

.dash-card .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   FORM / INPUTS SECTION
   ========================================================================== */
.params-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.params-header h2 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.params-header h2 i {
  color: var(--primary);
}

.exchange-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.preset-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-inverse);
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-group label .info-tip {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: help;
  position: relative;
}

.form-group label .info-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  text-transform: none;
  letter-spacing: normal;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ==========================================================================
   ACTIONS BAR
   ========================================================================== */
.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.actions-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions-right {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

.btn i { font-size: 18px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-ghost:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}
.btn-sm i { font-size: 16px; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 18px;
}

/* ==========================================================================
   MAIN TABLE
   ========================================================================== */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

.table-scroll::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table thead th {
  position: sticky;
  z-index: 10;
  background: var(--bg-alt);
  padding: 12px 14px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-color);
}

.data-table thead tr:first-child th {
  top: 0;
}

.data-table thead tr:nth-child(2) th {
  top: 41px; /* Height of the first row */
}

.data-table thead th.col-monto {
  text-align: right;
  min-width: 100px;
}

.data-table thead th.col-profit {
  color: var(--primary);
  min-width: 100px;
}

.data-table thead th.col-ciclo {
  min-width: 90px;
}

.data-table thead tr:first-child th {
  border-bottom: 1px solid var(--border-color);
}

.data-table thead tr:first-child th:first-child {
  position: sticky;
  left: 0;
  z-index: 20;
}

.data-table thead tr:first-child th.header-monto {
  background: var(--bg-surface-light);
}

.data-table thead tr:first-child th.header-ciclos {
  background: var(--primary);
  color: #fff;
  letter-spacing: 1px;
}

.data-table tbody td {
  padding: 10px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
  white-space: nowrap;
}

.data-table tbody td:first-child {
  text-align: right;
  font-weight: 600;
  color: var(--text-heading);
  position: sticky;
  left: 0;
  background: var(--bg-surface);
  z-index: 5;
  border-right: 1px solid var(--border-color);
}

.data-table tbody tr:hover td {
  background: var(--bg-surface-hover);
}

.data-table tbody tr:hover td:first-child {
  background: var(--bg-surface-hover);
}

.data-table tbody td.profit-positive {
  color: var(--success);
  font-weight: 600;
}

.data-table tbody td.profit-negative {
  color: var(--danger);
  font-weight: 600;
}

/* Row highlight for favorite montos */
.data-table tbody tr.row-highlight td {
  background: var(--primary-soft);
}

.data-table tbody tr.row-highlight td:first-child {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-alt);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i {
  color: var(--primary);
  font-size: 22px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-alt);
}

/* ==========================================================================
   CALCULATOR MODAL TABLE
   ========================================================================== */
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.calc-table thead th {
  padding: 12px 16px;
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid var(--border-color);
  font-size: 13px;
}

.calc-table thead th.col-label {
  text-align: left;
  background: transparent;
  border: none;
  width: 40%;
}

.calc-table thead th.col-logrado {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  color: var(--success);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.calc-table thead th.col-estimado {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  color: var(--danger);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.calc-table tbody th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 500;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.calc-table tbody th i {
  color: var(--text-muted);
  margin-left: 6px;
  cursor: help;
  font-size: 14px;
}

.calc-table tbody td {
  text-align: center;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-color);
}

.calc-table tbody td input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  width: 100%;
  outline: none;
  transition: var(--transition);
}

.calc-table tbody td input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   PPP MODAL
   ========================================================================== */
.ppp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 640px) {
  .ppp-grid { grid-template-columns: 1fr; }
}

.ppp-column h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-heading);
}

.ppp-column h4 i { color: var(--primary); }

.ppp-table {
  width: 100%;
  border-collapse: collapse;
}

.ppp-table thead th {
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.ppp-table tbody td {
  padding: 4px 6px;
}

.ppp-table tbody td input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: var(--transition);
}

.ppp-table tbody td input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.ppp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.ppp-results {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.8;
}

.ppp-results strong {
  color: var(--text-heading);
}

/* ==========================================================================
   DONATION MODAL
   ========================================================================== */
.donation-content {
  text-align: center;
}

/* ==========================================================================
   BINANCE PAY CARD
   ========================================================================== */
.binance-pay-card {
  background: #181a20; /* Binance dark color */
  border-radius: 16px;
  overflow: hidden;
  max-width: 320px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  color: #fff;
  font-family: var(--font-heading);
  border: 1px solid rgba(255,255,255,0.05);
}

.bp-header {
  background: #0b0e11;
  padding: 16px;
  text-align: center;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.bp-header i {
  color: #fcd535; /* Binance yellow */
  font-size: 24px;
}

.bp-header strong {
  color: #fcd535;
  font-weight: 600;
}

.bp-body {
  padding: 24px;
}

.bp-subtitle {
  color: #848e9c;
  font-size: 14px;
  margin-bottom: 20px;
}

.bp-qr-container {
  width: 220px;
  height: 220px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 4px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-qr-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bp-name {
  margin-top: 24px;
  font-size: 18px;
  font-weight: 600;
  color: #eaecef;
}

/* ==========================================================================
   HISTORY PANEL
   ========================================================================== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.history-item .hist-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item .hist-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.history-item .hist-date {
  font-size: 11px;
  color: var(--text-muted);
}

.history-item .hist-profit {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.history-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.4;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-left img {
  width: 24px;
  height: 24px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-right a {
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-right a:hover {
  color: var(--primary);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 13px;
  color: var(--text-main);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.toast i { font-size: 20px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--info); }

.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ==========================================================================
   TOOLTIP (Pure CSS)
   ========================================================================== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  pointer-events: none;
  animation: tooltip-fade 0.2s ease;
}

@keyframes tooltip-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* ==========================================================================
   RESPONSIVE — TABLET (max 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .main-content {
    padding: 20px 0 48px;
  }

  .container {
    padding: 0 16px;
  }

  .title-hero {
    font-size: 26px;
  }

  /* Dashboard: 2 columns on tablet, 3 on wider */
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .dash-card {
    padding: 14px;
  }

  .dash-card .value {
    font-size: 18px;
  }

  .dash-card .label {
    font-size: 11px;
  }

  .dash-card .sub {
    font-size: 11px;
  }

  /* Params section */
  .params-section {
    padding: 16px;
  }

  .params-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .exchange-presets {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .inputs-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Actions */
  .actions-bar {
    flex-direction: column;
    gap: 10px;
  }

  .actions-left, .actions-right {
    width: 100%;
    justify-content: center;
  }

  /* Table */
  .table-wrapper {
    border-radius: var(--radius-md);
  }

  .data-table {
    font-size: 12px;
  }

  .data-table thead th {
    padding: 8px 10px;
    font-size: 10px;
  }

  .data-table tbody td {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Modals */
  .modal-box {
    border-radius: var(--radius-lg);
    max-height: 95vh;
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-header h3 {
    font-size: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  /* PPP Modal */
  .ppp-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Calc table */
  .calc-table thead th {
    padding: 8px 10px;
    font-size: 11px;
  }

  .calc-table tbody th {
    padding: 10px 12px;
    font-size: 12px;
  }

  .calc-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Footer */
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .footer-left, .footer-right {
    justify-content: center;
  }
}

/* ==========================================================================
   RESPONSIVE — MOBILE SMALL (max 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .title-hero {
    font-size: 22px;
  }

  .main-content {
    padding: 16px 0 40px;
  }

  /* Navbar */
  .nav-content {
    height: 56px;
    padding: 0 12px;
  }

  .nav-brand .nav-logo-icon {
    height: 32px;
    width: 32px;
  }

  .nav-brand .nav-logo-text {
    height: 18px;
  }

  /* Ticker */
  .ticker-bar {
    margin-top: 56px;
    height: 32px;
  }

  .ticker-item {
    font-size: 11px;
  }

  /* Dashboard: 2 columns */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
  }

  .dash-card {
    padding: 12px;
  }

  .dash-card .value {
    font-size: 16px;
  }

  .dash-card .label {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .dash-card .label i {
    font-size: 14px;
  }

  .dash-card .sub {
    font-size: 10px;
    margin-top: 4px;
  }

  /* Params */
  .params-section {
    padding: 14px;
    margin-bottom: 16px;
  }

  .params-header h2 {
    font-size: 15px;
  }

  .preset-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .inputs-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .form-group label {
    font-size: 10px;
  }

  .form-input {
    padding: 8px 10px;
    font-size: 14px;
  }

  /* Buttons */
  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .btn i {
    font-size: 16px;
  }

  .actions-bar {
    margin-bottom: 12px;
  }

  /* Table */
  .table-scroll {
    max-height: 60vh;
  }

  .data-table {
    font-size: 11px;
  }

  .data-table thead th {
    padding: 6px 8px;
    font-size: 9px;
  }

  .data-table tbody td {
    padding: 6px 8px;
    font-size: 11px;
  }

  .data-table tbody td:first-child {
    min-width: 80px;
  }

  /* Modals — full screen on small devices */
  .modal-overlay {
    padding: 8px;
  }

  .modal-box {
    border-radius: var(--radius-md);
    max-height: 96vh;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-header h3 {
    font-size: 15px;
    gap: 6px;
  }

  .modal-header h3 i {
    font-size: 18px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-footer {
    padding: 10px 14px;
    gap: 6px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* PPP */
  .ppp-table tbody td input {
    padding: 6px 8px;
    font-size: 12px;
  }

  .ppp-actions {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  /* Calc table */
  .calc-table {
    font-size: 12px;
  }

  .calc-table thead th {
    padding: 8px 6px;
    font-size: 10px;
  }

  .calc-table thead th small {
    display: none;
  }

  .calc-table tbody th {
    padding: 8px 10px;
    font-size: 11px;
    max-width: 120px;
    word-wrap: break-word;
  }

  .calc-table tbody td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .calc-table tbody td input {
    padding: 6px 8px;
    font-size: 13px;
  }

  /* Donation */
  .donation-content img {
    max-width: 240px;
  }

  /* Shortcuts hint */
  .main-content > .container > p:last-child {
    display: none;
  }

  /* History */
  .history-item {
    padding: 10px 12px;
  }

  .history-item .hist-label {
    font-size: 12px;
  }

  .history-item .hist-profit {
    font-size: 13px;
  }

  /* Footer */
  .footer-left {
    font-size: 11px;
  }

  .footer-left img {
    width: 20px;
    height: 20px;
  }

  .footer-right a {
    font-size: 11px;
  }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fade-in 0.5s ease forwards;
}

.animate-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-in-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-in-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* Pulse effect for live data */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
