/* --------- TIPOGRAFÍA Y RESET --------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root {
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --transition-fast: 0.18s ease-out;
  --transition-med: 0.25s ease-out;
}

html[data-theme="dark"] {
  --bg: radial-gradient(circle at top, #0f172a 0, #020617 52%, #020617 100%);
  --shell: rgba(15, 23, 42, 0.9);
  --card: rgba(15, 23, 42, 0.9);
  --border-subtle: rgba(148, 163, 184, 0.5);
  --border-strong: rgba(148, 163, 184, 0.8);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #facc15;
  --accent-soft: rgba(250, 204, 21, 0.12);
  --primary: #38bdf8;
  --primary-soft: rgba(56, 189, 248, 0.12);
  --shadow-soft: 0 26px 70px rgba(15, 23, 42, 0.85);
  --shadow-card: 0 18px 42px rgba(15, 23, 42, 0.95);
  --header-glow: 0 0 40px rgba(56, 189, 248, 0.35);
  --chip-bg: rgba(15, 23, 42, 0.9);
}

html[data-theme="light"] {
  --bg: radial-gradient(circle at top, #e0edff 0, #f4f7fb 45%, #ffffff 100%);
  --shell: rgba(255, 255, 255, 0.9);
  --card: #ffffff;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --border-strong: rgba(148, 163, 184, 0.8);
  --text: #0f172a;
  --muted: #6b7280;
  --accent: #eab308;
  --accent-soft: rgba(234, 179, 8, 0.12);
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.15);
  --shadow-card: 0 16px 36px rgba(15, 23, 42, 0.12);
  --header-glow: 0 0 0 rgba(0, 0, 0, 0);
  --chip-bg: #f9fafb;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: stretch;
  justify-content: center;
  transition: background 0.4s ease-out, color 0.25s ease-out;
}

main {
  width: 100%;
  max-width: 960px;
  padding: 22px 16px 34px;
  margin: 0 auto;
  animation: fade-in 0.6s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------- HEADER --------- */

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

.logo-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: radial-gradient(
    circle at 30% 20%,
    #f9fafb 0,
    #e5e7eb 24%,
    #0ea5e9 50%,
    #4f46e5 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #0b1120;
  box-shadow: var(--header-glow);
  transform: translateY(0);
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

.logo-block:hover .logo-mark {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 55px rgba(56, 189, 248, 0.55);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-text strong {
  font-size: 20px;
  letter-spacing: 0.02em;
}

.logo-text span {
  font-size: 12px;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--chip-bg);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--transition-fast),
    background var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast), color var(--transition-fast);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

html[data-theme="dark"] .theme-toggle-icon {
  background: #0f172a;
}

html[data-theme="light"] .theme-toggle-icon {
  background: #facc15;
  color: #1f2933;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-0.5px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
}

/* --------- HERO --------- */

.hero {
  text-align: left;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(22px, 4.2vw, 26px);
  margin-bottom: 6px;
}

.hero p {
  font-size: 13px;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 500;
  margin-top: 10px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

/* --------- NAV DE HERRAMIENTAS --------- */

.tool-nav {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  margin-top: 16px;
  margin-bottom: 6px;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.tool-tab {
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.tool-tab span {
  font-size: 14px;
}

.tool-tab-active {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.4);
  transform: translateY(-0.5px);
}

/* --------- SHELL / CONTENEDORES --------- */

.shell {
  margin-top: 14px;
  background: var(--shell);
  border-radius: var(--radius-lg);
  padding: 18px 16px 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(24px);
}

@media (min-width: 768px) {
  .shell {
    padding: 20px 22px 24px;
  }
}

.tool-shell {
  display: none;
}

.tool-shell-active {
  display: block;
}

.tool-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.tool-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* INPUT MONTO */

.input-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .input-row {
    flex-direction: row;
    align-items: center;
  }
}

.input-label {
  font-size: 13px;
  color: var(--muted);
  min-width: 130px;
}

.amount-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-prefix {
  font-size: 24px;
  font-weight: 700;
}

.amount-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  outline: none;
  background: radial-gradient(
    circle at top,
    #fef9c3 0,
    #fef3c7 45%,
    #fefce8 100%
  );
  color: #111827;
  text-align: right;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--transition-med), transform var(--transition-med),
    border-color var(--transition-fast), background 0.35s ease-out;
}

.amount-input::placeholder {
  color: rgba(15, 23, 42, 0.45);
}

.amount-input:focus {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.45),
    0 18px 32px rgba(250, 204, 21, 0.28);
  transform: translateY(-1px);
}

html[data-theme="light"] .amount-input {
  background: radial-gradient(
    circle at top,
    #eef2ff 0,
    #e0f2fe 45%,
    #eff6ff 100%
  );
}

/* TASA / RATE & HELPERS */

.rate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rate-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rate-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--chip-bg);
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: border-color var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.rate-pill input {
  accent-color: var(--accent);
  cursor: pointer;
}

.rate-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(-0.5px);
}

.helper {
  font-size: 11px;
  color: var(--muted);
}

.error {
  min-height: 16px;
  font-size: 12px;
  color: #f97373;
  margin-top: 4px;
}

/* RESULTADOS BOLETA */

.results-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .results-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.result-card {
  border-radius: var(--radius-md);
  padding: 14px 14px 16px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(30, 64, 175, 0.85)
  );
  box-shadow: var(--shadow-card);
  transform: translateY(0);
  transition: transform var(--transition-med), box-shadow var(--transition-med),
    border-color var(--transition-fast), background 0.35s ease-out;
}

html[data-theme="light"] .result-card {
  background: linear-gradient(145deg, #ffffff, #e0edff);
}

.result-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.95);
  border-color: var(--primary);
}

.result-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.result-main-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.result-value {
  font-size: 21px;
  font-weight: 700;
}

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

.result-highlight {
  color: var(--accent);
  font-weight: 600;
}

/* --------- UF & IVA: CAJAS Y RESULTADOS --------- */

.direction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--muted);
}

.direction-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--chip-bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.direction-pill input {
  accent-color: var(--primary);
}

.direction-pill-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.4);
  transform: translateY(-0.5px);
}

.uf-results,
.iva-results {
  margin-top: 16px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  box-shadow: var(--shadow-card);
  font-size: 13px;
  line-height: 1.5;
}

.uf-results strong,
.iva-results strong {
  color: var(--accent);
}

/* FOOTER */

footer {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

footer strong {
  font-weight: 600;
}

/* --------- BLOG: TIPOGRAFÍA SUAVE --------- */

.blog-article,
.blog-article p,
.blog-article li,
.blog-article ul,
.blog-article table,
.blog-article td,
.blog-article th,
.article-body,
.article-body p,
.article-body li,
.article-body ul,
.article-body table,
.article-body td,
.article-body th {
  font-weight: 400;
}

.blog-article h1,
.article-body h1 {
  font-weight: 600;
}

.blog-article h2,
.blog-article h3,
.article-body h2,
.article-body h3 {
  font-weight: 600;
}

/* -----------------------------------------
   MINI MENÚ DEL BLOG (burbujas estilizadas)
------------------------------------------*/

.mini-blog-menu,
nav.mini-blog-menu {
  margin: 14px 0 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.mini-blog-menu .mini-link,
nav.mini-blog-menu .mini-link {
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  text-decoration: none;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.mini-blog-menu .mini-link.active,
nav.mini-blog-menu .mini-link.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.mini-blog-menu .mini-link:hover,
nav.mini-blog-menu .mini-link:hover {
  transform: translateY(-1px);
  color: var(--primary);
}

/* === ASISTENTE CALCULANDO === */

#calc-ai-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* Burbuja flotante */
#calc-ai-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Ventana de chat */
#calc-ai-chat {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  max-height: 480px;
  background: #020617;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

#calc-ai-chat.hidden {
  display: none;
}

.calc-ai-header {
  padding: 10px 12px;
  background: #020617;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-ai-header small {
  font-size: 11px;
  opacity: 0.8;
}

#calc-ai-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 16px;
}

/* Mensajes */
#calc-ai-messages {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  background: #020617;
}

.calc-ai-msg {
  margin-bottom: 8px;
  max-width: 90%;
  padding: 8px 10px;
  border-radius: 10px;
  line-height: 1.3;
}

.calc-ai-msg.user {
  margin-left: auto;
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 2px;
}

.calc-ai-msg.bot {
  margin-right: auto;
  background: #0f172a;
  color: #e5e7eb;
  border-bottom-left-radius: 2px;
}

/* Input */
.calc-ai-input-row {
  display: flex;
  padding: 8px;
  border-top: 1px solid #1e293b;
  background: #020617;
}

#calc-ai-input {
  flex: 1;
  border: 1px solid #1e293b;
  background: #020617;
  color: #e5e7eb;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

#calc-ai-input::placeholder {
  color: #6b7280;
}

#calc-ai-send {
  margin-left: 6px;
  border-radius: 999px;
  border: none;
  padding: 0 10px;
  font-size: 14px;
  cursor: pointer;
  background: #2563eb;
  color: white;
}

.calc-ai-footer-note {
  font-size: 10px;
  padding: 4px 10px 8px;
  color: #6b7280;
  background: #020617;
}
.ad-shell{
  margin-top: 18px;
  margin-bottom: 18px;
}

.ad-label{
  font-size: 12px;
  opacity: .7;
  margin-bottom: 8px;
}
