/* =========================================================
   Trade Journal Calendar · BASE
   Reset, variables, tipografías, primitivos.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700&family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Paleta - oscuro fintech */
  --bg-0: #07090f;
  --bg-1: #0c1018;
  --bg-2: #131825;
  --bg-3: #1a2030;
  --line: rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.12);

  --text:        #e8ecf3;
  --text-muted:  #8b94a8;
  --text-dim:    #5b6478;

  --green:       #22d39a;
  --green-soft:  rgba(34, 211, 154, 0.14);
  --green-line:  rgba(34, 211, 154, 0.35);

  --red:         #ff5d7a;
  --red-soft:    rgba(255, 93, 122, 0.14);
  --red-line:    rgba(255, 93, 122, 0.35);

  --accent:      #6ee7ff;
  --accent-soft: rgba(110, 231, 255, 0.14);

  /* Tipografía */
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Radios y elevación */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 6px 24px rgba(0,0,0,0.35);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.05) inset, 0 16px 50px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background: var(--bg-0);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--text);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 .4em;
  color: var(--text);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-size: 1.15rem; }

p  { color: var(--text-muted); margin: 0 0 1em; }

button { font: inherit; cursor: pointer; }

/* ----- Botones ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .8rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: -0.005em;
  transition: transform .06s ease, background .2s ease, border-color .2s ease, color .2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--green);
  color: #052016;
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(34,211,154,0.0), 0 10px 28px rgba(34,211,154,0.25);
}
.btn-primary:hover { background: #1ec18b; color: #052016; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.25); background: rgba(255,255,255,0.03); }

.btn-text {
  background: transparent;
  color: var(--text-muted);
  padding: .55rem .9rem;
}
.btn-text:hover { color: var(--text); }

.btn-lg { padding: 1rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ----- Containers ----- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ----- Alertas ----- */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--r-sm);
  font-size: .92rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--red-soft);
  color: #ffb1c1;
  border-color: var(--red-line);
}
.alert-info  {
  background: var(--accent-soft);
  color: #bdf2ff;
  border-color: rgba(110,231,255,0.3);
}

/* ----- Form ----- */
.field { display: block; margin-bottom: 1rem; }
.field > span {
  display: block;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
  letter-spacing: 0.01em;
}
.field input, .field textarea {
  width: 100%;
  padding: .85rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-3);
}
.field .hint { color: var(--text-dim); font-size: .8rem; }

/* ----- Brand ----- */
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--green), var(--accent));
  color: #052016;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(34,211,154,0.35);
}
.brand-name { color: var(--text); }

/* ----- Utilidades ----- */
.row-between {
  display: flex; justify-content: space-between; align-items: center;
  margin: -.5rem 0 .8rem;
}
.link-muted { color: var(--text-muted); font-size: .88rem; }
.link-muted:hover { color: var(--accent); }

/* =========================================================
   LIGHT THEME
   Overrides all CSS variables when [data-theme="light"]
   ========================================================= */
[data-theme="light"] {
  --bg-0: #f5f7fa;
  --bg-1: #ffffff;
  --bg-2: #f0f2f6;
  --bg-3: #e4e8ee;
  --line: rgba(0,0,0,0.08);
  --line-strong: rgba(0,0,0,0.14);

  --text:        #1a1d26;
  --text-muted:  #5a6175;
  --text-dim:    #8b94a8;

  --green:       #0ea672;
  --green-soft:  rgba(14,166,114,0.12);
  --green-line:  rgba(14,166,114,0.3);

  --red:         #dc3b5e;
  --red-soft:    rgba(220,59,94,0.10);
  --red-line:    rgba(220,59,94,0.3);

  --accent:      #1a8cff;
  --accent-soft: rgba(26,140,255,0.12);

  --shadow-1: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  color-scheme: light;
}

[data-theme="light"] .btn-primary {
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,166,114,0.25);
}
[data-theme="light"] .btn-primary:hover { color: #fff; }

[data-theme="light"] .range-tab.is-active {
  color: #fff;
}

[data-theme="light"] .brand-mark {
  color: #fff;
}

[data-theme="light"] .cell.pos {
  background: linear-gradient(180deg, #d0f5e6, #b4edd8);
  color: #0a5a3e;
}
[data-theme="light"] .cell.neg {
  background: linear-gradient(180deg, #fde0e7, #f9c5d1);
  color: #7a1d34;
}
[data-theme="light"] .cell.pos .day-pnl,
[data-theme="light"] .cell.pos .day-num { color: #0a5a3e; }
[data-theme="light"] .cell.neg .day-pnl,
[data-theme="light"] .cell.neg .day-num { color: #7a1d34; }
[data-theme="light"] .cell.pos:hover { background: linear-gradient(180deg, #c0eede, #a8e5cc); }
[data-theme="light"] .cell.neg:hover { background: linear-gradient(180deg, #f9d0da, #f5b3c3); }

[data-theme="light"] .cell.is-today {
  border-color: rgba(0,0,0,0.35);
}

[data-theme="light"] .mock-cell.pos {
  background: linear-gradient(180deg, #d0f5e6, #b4edd8); color: #0a5a3e;
}
[data-theme="light"] .mock-cell.neg {
  background: linear-gradient(180deg, #fde0e7, #f9c5d1); color: #7a1d34;
}
[data-theme="light"] .mock-cell.pos strong,
[data-theme="light"] .mock-cell.neg strong { color: inherit; }

[data-theme="light"] .gradient-text {
  background: linear-gradient(120deg, #0ea672, #1a8cff, #6a4fff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ----- Select ----- */
.field select {
  width: 100%;
  padding: .85rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  transition: border-color .15s ease, background .15s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b94a8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg-3);
}
[data-theme="light"] .field select {
  background-color: #fff;
}
[data-theme="light"] .field select:focus {
  background-color: #f8f9fb;
}
