/* ============================================
   TOOLBOX v2 — Production CSS
   Light/Dark mode + scroll animations
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ---- LIGHT THEME (default) ---- */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface2: #f0eeea;
  --border: #e2dfd9;
  --border2: #ccc9c2;
  --accent: #1a56ff;
  --accent-light: rgba(26,86,255,0.07);
  --accent2: #e8302a;
  --accent3: #00a878;
  --text: #111118;
  --text-muted: #6b6870;
  --text-dim: #aaa8b2;
  --radius: 16px;
  --radius-sm: 10px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 28px rgba(0,0,0,0.07);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-accent: 0 4px 24px rgba(26,86,255,0.22);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --header-bg: rgba(247,246,242,0.9);
}

/* ---- DARK THEME ---- */
[data-theme="dark"] {
  --bg: #0d0f14;
  --surface: #161920;
  --surface2: #1e2230;
  --border: #272c3e;
  --border2: #343c56;
  --accent: #5b8cff;
  --accent-light: rgba(91,140,255,0.08);
  --accent2: #ff6b6b;
  --accent3: #00e5a0;
  --text: #e8eaf2;
  --text-muted: #7b82a0;
  --text-dim: #4a5070;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 32px rgba(91,140,255,0.2);
  --header-bg: rgba(13,15,20,0.9);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.35s ease, color 0.35s ease;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

h1,h2,h3,h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; }
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- HEADER ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s, border-color 0.35s;
}
.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
  height: 64px; gap: 16px;
}

.logo {
  font-family: var(--font-head); font-size: 1.3rem; font-weight: 800;
  color: var(--text); display: flex; align-items: center; gap: 9px;
  white-space: nowrap; text-decoration: none; opacity: 1 !important;
  transition: opacity var(--transition);
}
.logo:hover { opacity: 0.8 !important; }
.logo-icon {
  width: 34px; height: 34px; background: var(--accent);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: transform var(--transition);
}
.logo:hover .logo-icon { transform: rotate(-6deg) scale(1.06); }
.logo span { color: var(--accent); }

/* ---- SEARCH ---- */
.search-wrap { flex: 1; max-width: 420px; position: relative; }
.search-input {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 40px;
  padding: 9px 20px 9px 42px; color: var(--text);
  font-family: var(--font-body); font-size: 0.875rem;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-light); }
.search-input::placeholder { color: var(--text-dim); }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 14px; pointer-events: none; }
.search-results { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); z-index: 200; animation: dropIn 0.15s ease; }
.search-results.show { display: block; }
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background var(--transition); font-size: 0.875rem; text-decoration: none; color: var(--text); opacity: 1 !important; }
.search-result-item:hover { background: var(--surface2); opacity: 1 !important; }

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  width: 38px; height: 38px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all var(--transition); flex-shrink: 0;
}
.theme-toggle:hover { background: var(--accent-light); border-color: var(--accent); transform: rotate(20deg); }

/* ---- ADS ---- */
.ad-block { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; transition: background 0.35s, border-color 0.35s; }
.ad-header { width: 100%; height: 90px; margin: 12px 0; }
.ad-mid { width: 100%; min-height: 250px; margin: 24px 0; }
.ad-footer { width: 100%; height: 90px; }

/* ---- HERO ---- */
.hero { padding: 80px 0 56px; text-align: center; position: relative; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-bg-circle { position: absolute; border-radius: 50%; filter: blur(90px); }
.hero-bg-circle:nth-child(1) { width: 500px; height: 500px; background: var(--accent); opacity: 0.07; top: -200px; left: 50%; transform: translateX(-55%); }
.hero-bg-circle:nth-child(2) { width: 280px; height: 280px; background: var(--accent3); opacity: 0.08; top: 20px; right: 8%; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-light); border: 1px solid rgba(26,86,255,0.18); color: var(--accent); padding: 5px 14px; border-radius: 40px; font-size: 0.8rem; font-weight: 500; margin-bottom: 22px; opacity: 0; animation: fadeUp 0.5s 0.05s ease forwards; }
.hero h1 { font-size: clamp(2rem,5vw,3.6rem); font-weight: 800; margin-bottom: 18px; letter-spacing: -0.02em; opacity: 0; animation: fadeUp 0.5s 0.15s ease forwards; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 1.05rem; color: var(--text-muted); max-width: 500px; margin: 0 auto 36px; opacity: 0; animation: fadeUp 0.5s 0.25s ease forwards; }
.stats-row { display: flex; align-items: center; justify-content: center; gap: 36px; flex-wrap: wrap; opacity: 0; animation: fadeUp 0.5s 0.35s ease forwards; }
.stat { text-align: center; }
.stat-num { font-family: var(--font-head); font-size: 1.7rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-div { width: 1px; height: 36px; background: var(--border); }

/* ---- SECTION HEADER ---- */
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.section-line { flex: 1; height: 1px; background: var(--border); }

/* ---- CATEGORIES ---- */
.categories-section { padding: 20px 0 28px; }
.categories-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab { padding: 7px 18px; border-radius: 40px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; transition: all var(--transition); font-weight: 500; }
.cat-tab:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- TOOLS GRID ---- */
.tools-section { padding: 4px 0 72px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }

/* Scroll reveal */
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
  text-decoration: none; color: inherit; opacity: 1 !important;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
  opacity: 0; transform: translateY(24px);
}
.tool-card.revealed {
  animation: cardReveal 0.45s ease forwards;
}
@keyframes cardReveal {
  to { opacity: 1; transform: translateY(0); }
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-4px) !important; }
.tool-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--accent-light) 0%, transparent 55%); opacity: 0; transition: opacity var(--transition); pointer-events: none; }
.tool-card:hover::after { opacity: 1; }

.tool-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; transition: transform var(--transition); }
.tool-card:hover .tool-icon { transform: scale(1.1) rotate(-5deg); }
.tool-card-title { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--text); transition: color var(--transition); }
.tool-card:hover .tool-card-title { color: var(--accent); }
.tool-card-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.55; flex: 1; }
.tool-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

.cat-badge { font-size: 0.7rem; padding: 3px 10px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cat-finanzas { background: rgba(0,168,120,0.1); color: var(--accent3); }
.cat-conversores { background: rgba(232,48,42,0.08); color: var(--accent2); }
.cat-utilidades { background: var(--accent-light); color: var(--accent); }
.cat-salud { background: rgba(255,160,0,0.1); color: #e6900a; }

.tool-arrow { color: var(--text-dim); font-size: 16px; transition: transform var(--transition), color var(--transition); }
.tool-card:hover .tool-arrow { transform: translateX(5px); color: var(--accent); }

.new-badge { position: absolute; top: 14px; right: 14px; background: var(--accent2); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- TOOL PAGE ---- */
.tool-page { padding: 32px 0 72px; }
.tool-page-header { margin-bottom: 36px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-dim); opacity: 1 !important; }
.breadcrumb a:hover { color: var(--accent); }
.tool-page-title { font-size: clamp(1.7rem,4vw,2.6rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.tool-page-desc { color: var(--text-muted); font-size: 1rem; max-width: 580px; }
.tool-page-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .tool-page-grid { grid-template-columns: 1fr; } }

/* ---- WIDGET ---- */
.tool-widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-sm); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 0.84rem; font-weight: 500; color: var(--text-muted); margin-bottom: 7px; }
input[type="text"],input[type="number"],input[type="email"],input[type="date"],select,textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-light); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%236b6870' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }
select option { background: var(--surface2); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 28px; border-radius: var(--radius-sm); border: none; font-family: var(--font-head); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.87; transform: translateY(-2px); box-shadow: var(--shadow-accent); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--accent3); color: #fff; }
.btn-success:hover { opacity: 0.87; transform: translateY(-2px); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* ---- RESULT BOX ---- */
.result-box { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 24px; display: none; }
.result-box.show { display: block; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.result-box h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 12px; }
.result-value { font-family: var(--font-head); font-size: 2rem; font-weight: 800; color: var(--accent3); margin-bottom: 10px; line-height: 1.1; }
.result-details { font-size: 0.87rem; color: var(--text-muted); line-height: 1.9; }

/* ---- SIDEBAR ---- */
.tool-sidebar { display: flex; flex-direction: column; gap: 14px; }
.sidebar-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.sidebar-box h4 { font-size: 0.75rem; font-weight: 700; margin-bottom: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; }
.related-tool { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); transition: color var(--transition); font-size: 0.88rem; opacity: 1 !important; }
.related-tool:last-child { border: none; }
.related-tool:hover { color: var(--accent); opacity: 1 !important; }

/* ---- RANGE ---- */
input[type="range"] { width: 100%; accent-color: var(--accent); border: none; box-shadow: none; background: transparent; padding: 0; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-val { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; color: var(--accent); min-width: 32px; }

/* ---- PASSWORD ---- */
.password-output { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; font-family: 'Courier New',monospace; font-size: 1.1rem; letter-spacing: 0.06em; color: var(--accent3); word-break: break-all; min-height: 56px; margin: 14px 0; display: flex; align-items: center; }
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }

/* ---- STRENGTH ---- */
.strength-bar { height: 3px; border-radius: 2px; background: var(--border); margin: 6px 0; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 2px; transition: all 0.4s ease; width: 0%; }
.strength-label { font-size: 0.78rem; font-weight: 600; }

/* ---- STATS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-top: 14px; }
.stat-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.stat-card-num { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-card-label { font-size: 0.73rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ---- CONV GRID ---- */
.conv-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 10px; margin-top: 18px; }
.conv-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; transition: border-color var(--transition); }
.conv-card:hover { border-color: var(--accent); }
.conv-card-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.conv-card-val { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: var(--accent); }

/* ---- TABS ---- */
.tabs-tool { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.tab-tool { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; transition: all var(--transition); font-weight: 500; }
.tab-tool.active { background: var(--surface2); border-color: var(--accent); color: var(--accent); }
.tab-tool:hover { border-color: var(--accent); color: var(--accent); }
.calc-mode { display: none; }
.calc-mode.active { display: block; }

/* ---- NAMES ---- */
.names-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(175px,1fr)); gap: 8px; margin-top: 14px; }
.name-chip { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; font-family: var(--font-head); font-size: 0.95rem; font-weight: 600; color: var(--text); cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.name-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.name-chip.copied { border-color: var(--accent3); color: var(--accent3); }

/* ---- AMORT TABLE ---- */
.amort-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.amort-table th { padding: 8px 12px; background: var(--surface2); color: var(--text-dim); font-weight: 600; text-align: right; }
.amort-table th:first-child { text-align: left; }
.amort-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: right; color: var(--text-muted); }
.amort-table td:first-child { text-align: left; color: var(--text); }
.amort-table tr:hover td { background: var(--surface2); }
.amort-scroll { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ---- HISTORY ---- */
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-family: 'Courier New',monospace; font-size: 0.83rem; color: var(--text-muted); }
.history-item:last-child { border: none; }

/* ---- FOOTER ---- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 44px 0 24px; margin-top: 72px; transition: background 0.35s, border-color 0.35s; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand p { font-size: 0.87rem; color: var(--text-muted); margin-top: 10px; max-width: 280px; line-height: 1.6; }
.footer-col h5 { font-size: 0.73rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 0.87rem; color: var(--text-muted); margin-bottom: 9px; opacity: 1 !important; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; color: var(--text-dim); flex-wrap: wrap; gap: 8px; }

/* ---- ANIMATIONS ---- */
@keyframes fadeUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }

/* ---- MOBILE ---- */
@media (max-width: 768px) {
  .header-inner { height: 58px; }
  .hero { padding: 52px 0 36px; }
  .tool-widget { padding: 20px; }
  .stats-row { gap: 20px; }
  .result-value { font-size: 1.6rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .logo-text { display: none; }
  .stat-div { display: none; }
  .btn { padding: 11px 18px; font-size: 0.88rem; }
}
