/* ══════════════════════════════════════════════════════════
   CicloCambios – Arbitraje de Divisas Digitales
   Hoja de estilos principal
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #F4F6F9;       /* Light blue-slate background */
  --surface:   #FFFFFF;       /* Pure white card backgrounds */
  --surface2:  #F8FAFC;       /* Soft grey for card headers */
  --border:    #E2E8F0;       /* Soft borders */
  --accent:    #0A3F66;       /* Brand Navy Blue from logo */
  --accent2:   #1E3A8A;       /* Deep corporate blue */
  --accent-bg: #0A3F66;
  --green:     #00B368;       /* Brand Emerald Green from logo */
  --green-bg:  #ECFDF5;       /* Very soft green background tint */
  --amber:     #D97706;       /* Amber-600 */
  --amber-bg:  #FFFBEB;       /* Amber-50 */
  --red:       #DC2626;       /* Deep Red */
  --white:     #1E293B;       /* Main text color (slate-800) */
  --muted:     #64748B;       /* Secondary text color (slate-500) */
  --input-bg:  #F8FAFC;       /* Soft input background */
  --radius:    14px;
  --radius-sm: 8px;
}

body.dark-mode {
  --bg:        #060F1E;
  --surface:   #0B1523;
  --surface2:  #0F1E31;
  --border:    rgba(255, 255, 255, 0.08);
  --white:     #F8FAFC;
  --muted:     #94A3B8;
  --input-bg:  #08101C;
  --accent:    #38BDF8;
  --accent2:   #0EA5E9;
  --accent-bg: #0F1E31;
  --green-bg:  rgba(16, 185, 129, 0.1);
  --amber-bg:  rgba(245, 158, 11, 0.1);
}

body.dark-mode .topbar {
  background: rgba(11, 21, 35, 0.88);
}
body.dark-mode .tabbar {
  background: rgba(11, 21, 35, 0.92);
}
body.dark-mode select.field-input {
  background-image: url("data:image/svg+xml;utf8,<svg fill='%2338BDF8' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

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

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--white);
  min-height: 100dvh;
}

/* ── TOP BAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-logo {
  height: 32px;
  display: block;
}
.topbar-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .03em;
  color: var(--white);
}
.topbar-title span {
  color: var(--green);
}
.topbar-sub {
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.topbar-user-icon {
  display: none;
}
.topbar-user-link {
  color: var(--white);
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Botones de Barra Superior */
.btn-topbar {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  box-sizing: border-box;
}

#theme-toggle.btn-topbar {
  background: rgba(10, 63, 102, 0.08);
  border: 1px solid rgba(10, 63, 102, 0.15);
  color: var(--accent);
  padding: 6px 10px;
  cursor: pointer;
}

body.dark-mode #theme-toggle.btn-topbar {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.btn-admin {
  color: var(--accent);
  background: rgba(10, 63, 102, 0.08);
  border: 1px solid rgba(10, 63, 102, 0.15);
  gap: 5px;
}

body.dark-mode .btn-admin {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

.btn-logout {
  color: var(--red);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

/* ── TAB BAR ── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: 64px; padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border: none; background: none; cursor: pointer;
  color: var(--muted); font-family: 'Syne', sans-serif;
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  transition: color .2s;
}
.tab-btn.active { color: var(--accent); }
.tab-btn svg { width: 20px; height: 20px; }

/* ── SCREENS ── */
.screen { display: none; padding: 16px 16px 88px; }
.screen.active { display: block; }

/* ── SECTION CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}
.card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.step-badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #FFFFFF;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--white); }
.card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

/* ── FIELD ── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}

.field-input {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  font-size: 16px; font-weight: 500;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
select.field-input {
  background-image: url("data:image/svg+xml;utf8,<svg fill='%230A3F66' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 32px;
  cursor: pointer;
}
.field-input:focus { outline: none; border-color: var(--accent); }
.field-input.readonly {
  color: var(--white); background: transparent;
  border-color: transparent; padding-left: 0;
  font-size: 15px;
}
.field-note { font-size: 10px; color: var(--muted); font-style: italic; }

/* ── RESULT ROW ── */
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-label { font-size: 13px; color: var(--muted); }
.result-value { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 600; color: var(--white); }
.result-value.green { color: var(--green); }
.result-value.red   { color: var(--red); }
.result-value.amber { color: var(--amber); }

/* ── SUMMARY CARD ── */
.summary-card {
  background: var(--green-bg);
  border: 1px solid #00A06A;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.summary-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); margin-bottom: 12px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-item-label { font-size: 9px; color: var(--green); opacity: .7; letter-spacing: .05em; text-transform: uppercase; }
.summary-item-value { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; color: var(--green); }
.summary-item-value.big { font-size: 20px; font-weight: 500; }

/* ── PIPELINE CARD ── */
.pipeline-card {
  background: var(--accent-bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.pipeline-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-bottom: 10px;
  text-align: center;
}
.pipeline-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.pipeline-node {
  flex: 1;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 4px 6px;
  min-width: 0;
}
.pipeline-node-label {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-node-value {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-node-unit {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pipeline-arrow {
  font-size: 14px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  font-weight: 700;
  animation: pipelinePulse 2s ease-in-out infinite;
}
@keyframes pipelinePulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}
.pipeline-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.pipeline-result-sign {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 700;
}
.pipeline-result-value {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 700;
}
.pipeline-result.gain { color: var(--green); }
.pipeline-result.gain .pipeline-result-sign { color: var(--green); }
.pipeline-result.loss { color: #FF6B6B; }
.pipeline-result.loss .pipeline-result-sign { color: #FF6B6B; }

/* ── USDT ALERT ── */
.usdt-alert {
  background: var(--amber-bg);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.usdt-alert-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.usdt-alert-text { font-size: 11px; color: var(--amber); line-height: 1.4; }

/* ── REGISTER BTN ── */
.register-btn {
  width: 100%; padding: 16px;
  background: var(--green); color: #FFFFFF;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; transition: opacity .15s, transform .1s;
  margin-top: 4px;
  box-shadow: 0 4px 10px rgba(0, 179, 104, 0.15);
}
.register-btn:active { opacity: .85; transform: scale(.98); }

/* ── REGISTRO ── */
.empty-state {
  text-align: center; padding: 48px 16px; color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 13px; line-height: 1.5; }

.op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  transition: all 0.3s ease;
}
.op-card.removing {
  animation: fadeOutSlideUp 0.3s ease forwards;
}
@keyframes fadeOutSlideUp {
  0% {
    opacity: 1;
    transform: translateY(0);
    max-height: 180px;
    margin-bottom: 10px;
    padding: 14px 16px;
    border-color: var(--border);
  }
  100% {
    opacity: 0;
    transform: translateY(-15px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    border-width: 0;
    overflow: hidden;
  }
}
.op-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.op-date { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }
.op-bank { font-size: 11px; font-weight: 700; color: var(--accent); background: rgba(0,212,255,.1); padding: 2px 8px; border-radius: 20px; margin-right: 20px; }
.op-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.op-item { display: flex; flex-direction: column; gap: 2px; }
.op-item-label { font-size: 9px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.op-item-value { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--white); }
.op-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }
.op-ganancia { display: flex; flex-direction: column; gap: 1px; }
.op-ganancia-label { font-size: 9px; color: var(--green); letter-spacing: .04em; text-transform: uppercase; }
.op-ganancia-value { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 500; color: var(--green); }
.op-pct { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 700; color: var(--green); background: var(--green-bg); padding: 4px 10px; border-radius: 20px; }
.op-delete {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px;
  line-height: 1;
}

/* ── RESUMEN ── */
.period-header {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  padding: 8px 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.period-table { width: 100%; border-collapse: collapse; }
.period-table th {
  font-size: 9px; color: var(--muted); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  text-align: right; padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.period-table th:first-child { text-align: left; }
.period-table td {
  font-family: 'DM Mono', monospace; font-size: 11px;
  text-align: right; padding: 8px 4px;
  border-bottom: 1px solid rgba(31,45,69,.5);
  color: var(--white);
}
.period-table td:first-child { text-align: left; color: var(--muted); font-family: 'Syne', sans-serif; font-size: 11px; }
.period-table tr.current td { color: var(--accent); }
.period-table tr.current td:first-child { color: var(--accent); font-weight: 700; }
.period-table td.pos { color: var(--green); }
.period-table td.zero { color: var(--muted); }

.acumulado-card {
  background: linear-gradient(135deg, #0A3F66 0%, #172554 100%);
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(10, 63, 102, 0.15);
}
.acumulado-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.ac-item { display: flex; flex-direction: column; gap: 3px; }
.ac-label { font-size: 9px; color: #93C5FD; text-transform: uppercase; letter-spacing: .05em; }
.ac-value { font-family: 'DM Mono', monospace; font-size: 16px; color: #FFFFFF; font-weight: 500; }

/* ── BANCOS ── */
.banco-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.banco-row:last-child { border-bottom: none; }
.banco-name { font-size: 13px; font-weight: 600; }
.banco-coms { display: flex; gap: 10px; align-items: center; }
.banco-pct { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--amber); }
.banco-total { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--green); background: var(--green-bg); padding: 2px 8px; border-radius: 12px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0F172A; color: #FFFFFF;
  font-size: 12px; font-weight: 700;
  padding: 10px 20px; border-radius: 100px;
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none; z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ── SECTION LABEL ── */
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding: 16px 0 8px;
}

.divider { height: 1px; background: var(--border); margin: 4px 0 12px; }

/* ── RESPONSIVE OVERRIDES ── */
@media (max-width: 480px) {
  .topbar {
    padding: 8px 10px;
    min-height: 56px;
  }
  .topbar-left {
    gap: 6px;
  }
  .topbar-logo {
    height: 24px;
  }
  .topbar-title {
    font-size: 13px;
  }
  .topbar-sub {
    display: none !important;
  }
  .topbar-right {
    gap: 4px;
  }
  .topbar-user-label {
    display: none !important;
  }
  .topbar-user-icon {
    display: inline-block;
  }
  .topbar-user-link {
    max-width: 70px;
    font-size: 10px;
  }
  .btn-topbar {
    padding: 4px 8px;
    font-size: 10px;
    height: 24px;
  }
  #theme-toggle.btn-topbar {
    padding: 4px 6px;
  }
  #top-date,
  .topbar-date-divider {
    display: none !important;
  }
}

/* ── ESTADOS EN TRÁNSITO (COMPRAS ABIERTAS) ── */
.op-card-open {
  border-left: 4px solid var(--amber) !important;
}
.badge {
  display: inline-block;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  font-family: 'Syne', sans-serif;
}
.badge-open {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber);
}
.status-pending {
  color: var(--amber);
  font-style: italic;
  font-size: 11px;
  font-weight: 500;
}
.liquidate-btn {
  transition: transform 0.1s ease, filter 0.2s ease;
  font-family: 'Syne', sans-serif;
}
.liquidate-btn:active {
  transform: scale(0.96);
}
.liquidate-btn:hover {
  filter: brightness(1.1);
}

/* ── PREMIUM GATE STYLING ── */
.premium-overlay {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}
.premium-blur {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
  opacity: 0.25;
}
.premium-locked-card {
  background: rgba(15, 30, 49, 0.7);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.premium-locked-icon {
  font-size: 32px;
  background: rgba(14, 165, 233, 0.1);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  margin-bottom: 4px;
}
.premium-locked-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  font-family: 'Syne', sans-serif;
  margin: 0;
}
.premium-locked-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 12px;
  max-width: 320px;
}
.btn-unlock {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(10, 63, 102, 0.3);
}
.btn-unlock:hover {
  background: #0d5488;
  transform: translateY(-1px);
}
.btn-unlock:active {
  transform: translateY(1px);
}
.premium-feature-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-size: 11px;
  color: var(--white);
  margin: 8px 0;
}
.premium-feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.premium-feature-item span {
  color: #38bdf8;
  font-weight: bold;
}

.badge-plan-link {
  transition: all 0.2s ease-in-out;
}
.badge-plan-link:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  filter: brightness(1.2);
}

