/* ── FitData Tools — Design System ── */
/* Nota: Poppins se carga en cada vista con <link rel="preconnect"> + carga asíncrona */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:     #22c55e;
    --green-dark:#16a34a;
    --green-soft:#dcfce7;
    --blue:      #3b82f6;
    --dark:      #0f172a;
    --gray:      #64748b;
    --light:     #f8fafc;
    --white:     #ffffff;
    --border:    #e2e8f0;
    --radius:    14px;
    --shadow:    0 4px 24px rgba(0,0,0,.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--white);
    color: var(--dark);
    line-height: 1.6;
}

/* ── NAVBAR ── */
nav.tool-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 5%; height: 68px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.nav-logo {
    font-size: 1.3rem; font-weight: 700; color: var(--dark);
    text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.nav-logo span { color: var(--green); }
.nav-links { display: flex; align-items: center; gap: 1.8rem; list-style: none; }
.nav-links a { text-decoration: none; color: var(--gray); font-size: .9rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--dark); }
.nav-cta {
    background: var(--green); color: white;
    padding: .5rem 1.3rem; border-radius: 50px; font-size: .88rem;
    font-weight: 600; text-decoration: none; transition: background .2s, transform .15s;
}
.nav-cta:hover { background: var(--green-dark); transform: translateY(-1px); }

/* ── TOOL HEADER ── */
.tool-header {
    padding: 100px 5% 48px;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    border-bottom: 1px solid #e2e8f0;
}
.breadcrumb-nav { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--gray); margin-bottom: 1.2rem; }
.breadcrumb-nav a { color: var(--gray); text-decoration: none; }
.breadcrumb-nav a:hover { color: var(--green); }
.breadcrumb-sep { color: #cbd5e1; }
.tool-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--green-soft); color: var(--green-dark);
    padding: .3rem .9rem; border-radius: 50px;
    font-size: .78rem; font-weight: 700; margin-bottom: 1rem;
    text-transform: uppercase; letter-spacing: .05em;
}
.tool-header h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800; line-height: 1.2;
    color: var(--dark); margin-bottom: .8rem;
}
.tool-header p {
    font-size: 1rem; color: var(--gray); max-width: 600px; line-height: 1.7;
}

/* ── MAIN TOOL CONTENT ── */
.tool-main {
    max-width: 1100px; margin: 0 auto;
    padding: 48px 5%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start;
}

/* ── FORM PANEL ── */
.form-panel {
    background: var(--light); border-radius: var(--radius);
    padding: 2rem; position: sticky; top: 88px;
}
.form-panel h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--dark); }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--gray); margin-bottom: .4rem; }
.form-group input[type="number"],
.form-group select {
    width: 100%; padding: .72rem 1rem;
    border: 2px solid #e2e8f0; border-radius: 10px;
    font-family: 'Poppins', sans-serif; font-size: .92rem;
    transition: border-color .2s; outline: none; background: white; color: var(--dark);
}
.form-group input:focus,
.form-group select:focus { border-color: var(--green); }
.form-error { font-size: .75rem; color: #ef4444; margin-top: .25rem; min-height: 1em; }

/* Radio groups */
.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-option {
    display: flex; align-items: center; gap: .5rem;
    background: white; border: 2px solid #e2e8f0; border-radius: 10px;
    padding: .6rem 1rem; cursor: pointer; transition: all .2s; font-size: .88rem; font-weight: 500;
}
.radio-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.radio-option input { accent-color: var(--green); }

/* Activity radio list */
.activity-list { display: flex; flex-direction: column; gap: .6rem; }
.activity-option {
    display: flex; align-items: center; gap: .75rem;
    background: white; border: 2px solid #e2e8f0; border-radius: 10px;
    padding: .75rem 1rem; cursor: pointer; transition: all .2s;
}
.activity-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.activity-option input { accent-color: var(--green); flex-shrink: 0; }
.activity-label { font-size: .88rem; font-weight: 600; color: var(--dark); }
.activity-desc { font-size: .75rem; color: var(--gray); }

.btn-calc {
    width: 100%; background: var(--green); color: white;
    border: none; padding: .85rem; border-radius: 50px;
    font-size: .95rem; font-weight: 600; cursor: pointer;
    margin-top: .8rem; transition: background .2s;
    font-family: 'Poppins', sans-serif;
}
.btn-calc:hover { background: var(--green-dark); }

/* ── RESULT PANEL ── */
.result-panel { display: flex; flex-direction: column; gap: 1.5rem; }

.result-card-main {
    background: white; border-radius: var(--radius);
    padding: 2rem; border: 2px solid #e2e8f0;
    text-align: center; min-height: 200px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.result-placeholder { color: #cbd5e1; font-size: .9rem; }
.result-placeholder-icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* Imágenes dentro de resultados */
.result-card-main img {
    max-width: 200px;
    width: clamp(100px, 30%, 200px);
    display: block;
    margin: .8rem auto 0;
    border-radius: 8px;
}
@media (max-width: 600px) {
    .result-card-main img { max-width: 130px; width: clamp(80px, 40%, 130px); }
}

/* Result output (populated by JS) */
#resultImc, #resultIcc, #resultGet, #resultMacro, #resultVo2, #resultExpect,
#resultadoVo2, #resultadoMets {
    font-size: 1rem; line-height: 1.7;
}
#resultadoVo2 { font-size: 2rem; font-weight: 800; color: var(--dark); }
#numMets { font-size: 2.5rem; font-weight: 800; color: var(--green); }

.result-info {
    background: var(--green-soft); border-radius: var(--radius);
    padding: 1rem 1.2rem; font-size: .85rem; color: var(--green-dark); font-weight: 500;
}
.result-info a { color: var(--green-dark); font-weight: 700; }

/* ── AD BANNER ── */
.ad-section {
    background: #f8fafc; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
    padding: 1rem 5%; text-align: center; min-height: 110px;
    display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.ad-label { font-size: .65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .4rem; }

/* ── INFO SECTION ── */
.info-section { padding: 48px 5%; background: white; max-width: 1100px; margin: 0 auto; }
.info-section h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .8rem; }
.info-section p { font-size: .9rem; color: var(--gray); line-height: 1.8; margin-bottom: 1rem; }

/* ── RELATED TOOLS ── */
.related-section { padding: 48px 5%; background: var(--light); }
.related-section h3 { font-size: 1.1rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; }
.related-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; max-width: 900px; margin: 0 auto;
}
.related-card {
    background: white; border-radius: var(--radius); padding: 1.2rem;
    text-decoration: none; color: inherit; border: 2px solid transparent;
    transition: all .2s; display: flex; align-items: center; gap: .8rem;
}
.related-card:hover { border-color: var(--green); box-shadow: var(--shadow); transform: translateY(-2px); }
.related-icon { font-size: 1.5rem; flex-shrink: 0; }
.related-name { font-size: .85rem; font-weight: 600; }
.related-desc { font-size: .75rem; color: var(--gray); }

/* ── VIDEO ── */
.video-wrapper { display: flex; justify-content: center; margin: 1.5rem 0; width: 100%; }
.video-wrapper iframe {
    border-radius: var(--radius);
    width: 480px; max-width: 100%;
    aspect-ratio: 16 / 9; height: auto;
}

/* ── MODAL (Bootstrap-free) ── */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: white; border-radius: var(--radius); padding: 2rem;
    max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-box h3 { color: #ef4444; font-size: 1.1rem; margin-bottom: 1rem; }
.modal-box ul { padding-left: 1.2rem; font-size: .88rem; color: var(--gray); line-height: 2; }
.modal-close {
    width: 100%; background: #ef4444; color: white; border: none;
    padding: .7rem; border-radius: 8px; font-size: .9rem; font-weight: 600;
    cursor: pointer; margin-top: 1.2rem; font-family: 'Poppins', sans-serif;
}
.btn-danger-outline {
    background: transparent; color: #ef4444; border: 2px solid #ef4444;
    padding: .75rem 1.5rem; border-radius: 50px; font-size: .9rem; font-weight: 600;
    cursor: pointer; font-family: 'Poppins', sans-serif; transition: all .2s;
    width: 100%; margin-top: .5rem;
}
.btn-danger-outline:hover { background: #ef4444; color: white; }

/* ── FOOTER ── */
footer.tool-footer {
    background: var(--dark); color: #64748b;
    padding: 2.5rem 5% 1.5rem;
    border-top: 1px solid #1e293b;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 1.5rem; }
.footer-brand p { font-size: .82rem; color: #64748b; max-width: 220px; margin-top: .5rem; }
.footer-col h4 { color: white; font-size: .82rem; font-weight: 700; margin-bottom: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.footer-col a { display: block; color: #64748b; text-decoration: none; font-size: .82rem; margin-bottom: .4rem; transition: color .2s; }
.footer-col a:hover { color: var(--green); }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 1.2rem; font-size: .78rem; text-align: center; }

/* ── ARTICLE (blog posts) ── */
.article-header {
    padding: 100px 5% 48px;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    border-bottom: 1px solid #e2e8f0;
}
.article-header h1 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800; color: var(--dark);
    line-height: 1.25; margin-bottom: .8rem;
}
.article-header p { font-size: 1rem; color: var(--gray); max-width: 640px; line-height: 1.7; }
.article-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.article-meta-item { font-size: .8rem; color: var(--gray); font-weight: 500; }

.article-body {
    max-width: 860px; margin: 0 auto;
    padding: 48px 5%;
}
.article-body h2 {
    font-size: 1.15rem; font-weight: 700; color: var(--dark);
    margin: 2rem 0 .7rem; padding-bottom: .4rem;
    border-bottom: 2px solid var(--green-soft);
}
.article-body h3 { font-size: 1rem; font-weight: 700; color: var(--dark); margin: 1.5rem 0 .5rem; }
.article-body p { font-size: .95rem; color: var(--gray); line-height: 1.85; margin-bottom: 1rem; }
.article-body ul, .article-body ol {
    padding-left: 1.4rem; margin-bottom: 1rem;
}
.article-body li { font-size: .95rem; color: var(--gray); line-height: 1.8; margin-bottom: .3rem; }
.article-body a { color: var(--green-dark); font-weight: 600; }
.article-body a:hover { text-decoration: underline; }
.article-body strong { color: var(--dark); }

.article-img {
    width: 100%; border-radius: var(--radius);
    margin: 1.5rem 0; display: block;
    box-shadow: var(--shadow);
}
.article-img-side {
    float: right; width: 40%; margin: 0 0 1.5rem 2rem;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.article-refs {
    background: var(--light); border-radius: var(--radius);
    padding: 1.5rem; margin-top: 2rem;
}
.article-refs h3 { font-size: .9rem; font-weight: 700; margin-bottom: .8rem; color: var(--dark); }
.article-refs cite { font-size: .82rem; color: var(--gray); font-style: normal; display: block; margin-bottom: .5rem; line-height: 1.6; }
.article-author {
    background: white; border: 2px solid #e2e8f0;
    border-radius: var(--radius); padding: 1.2rem 1.5rem;
    margin-top: 1.5rem; font-size: .85rem; color: var(--gray);
}
.article-author strong { color: var(--dark); }
.btn-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--gray); font-size: .85rem; font-weight: 600;
    text-decoration: none; margin-bottom: 1.5rem; transition: color .2s;
}
.btn-back:hover { color: var(--green); }
@media (max-width: 600px) {
    .article-img-side { float: none; width: 100%; margin: 1rem 0; }
}

/* ── RESPONSIVE ── */

/* Evitar scroll horizontal en cualquier página */
html, body { overflow-x: hidden; max-width: 100%; }

@media (max-width: 800px) {
    .tool-main { grid-template-columns: 1fr; }
    .form-panel { position: static; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    nav.tool-nav { padding: 0 4%; }
    .nav-links { display: none; }
    .footer-grid { grid-template-columns: 1fr; gap: 1.2rem; }
    .tool-header { padding: 90px 4% 36px; }
    .tool-main { padding: 32px 4%; gap: 2rem; }
    footer.tool-footer { padding: 2rem 4% 1.2rem; }

    /* Radio buttons: envolver en varias filas si no caben */
    .radio-group { flex-wrap: wrap; gap: .7rem; }

    /* Related tools: 2 columnas en móvil */
    .related-grid { grid-template-columns: repeat(2, 1fr); }

    /* Modal responsive */
    .modal-box { padding: 1.5rem 1rem; margin: 1rem; }
    .modal-box ul { padding-left: 1rem; }

    /* Info sections */
    .info-section { padding: 32px 4%; }
    .related-section { padding: 32px 4%; }
}
@media (max-width: 400px) {
    /* Related tools: 1 columna en móvil muy pequeño */
    .related-grid { grid-template-columns: 1fr; }
    /* Reducir padding listas */
    .info-section ul, .article-body ul, .article-body ol { padding-left: .9rem; }
}
