/* ===========================================
   MODULO PLANES Y PRECIOS — PresuCosto
   Diseno ejecutivo profesional
   =========================================== */

/* --- Design Tokens --- */
.planes-page {
    width: 100%;
    --pl-dark: #0f172a;
    --pl-dark-2: #1e293b;
    --pl-dark-3: #334155;
    --pl-text: #0f172a;
    --pl-text-2: #475569;
    --pl-text-3: #94a3b8;
    --pl-border: #e2e8f0;
    --pl-border-2: #cbd5e1;
    --pl-surface: #f8fafc;
    --pl-white: #ffffff;
    --pl-green: #10b981;
    --pl-green-bg: #ecfdf5;
    --pl-indigo: #6366f1;
    --pl-indigo-bg: #eef2ff;
    --pl-radius: 12px;
    --pl-radius-lg: 16px;
    --pl-shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --pl-shadow-md: 0 4px 16px rgba(15,23,42,.08);
    --pl-shadow-lg: 0 12px 40px rgba(15,23,42,.12);
    --pl-shadow-xl: 0 20px 60px rgba(15,23,42,.16);
}

/* --- Hero Section --- */
.planes-hero {
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
    padding: clamp(3rem, 6vw, 5rem) 1.5rem clamp(2.5rem, 5vw, 4rem);
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.planes-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(99,102,241,.07) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}
.planes-hero::after {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(99,102,241,.1) 0%, transparent 70%);
    pointer-events: none;
}
.planes-hero > * {
    position: relative;
    z-index: 1;
}
.planes-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    font-weight: 800;
    margin-bottom: .6rem;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
.planes-hero .hero-subtitulo {
    font-size: clamp(.92rem, 2vw, 1.1rem);
    color: rgba(255,255,255,.65);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- Hero Trust Stats --- */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}
.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
}
.hero-stat-numero {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}
.hero-stat-label {
    font-size: .7rem;
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
    letter-spacing: .07em;
}

/* --- Toggle mensual/anual --- */
.planes-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-top: 2rem;
    background: rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(255,255,255,.1);
    cursor: pointer;
}
.planes-toggle span {
    font-size: .88rem;
    color: rgba(255,255,255,.55);
    padding: .6rem 1.4rem;
    border-radius: 9px;
    transition: all .25s ease;
    user-select: none;
    white-space: nowrap;
}
.planes-toggle span.active {
    color: var(--pl-dark, #0f172a);
    font-weight: 600;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.toggle-switch {
    display: none;
}
.planes-ahorro {
    display: inline-block;
    background: var(--pl-green, #10b981);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 10px;
    margin-left: .3rem;
    vertical-align: middle;
}

/* --- Grid de Planes --- */
.planes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    max-width: 1160px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
    align-items: stretch;
}

/* --- Plan Card --- */
.plan-card {
    background: var(--pl-white, #fff);
    border: 1px solid var(--pl-border, #e2e8f0);
    border-radius: var(--pl-radius-lg, 16px);
    padding: 2rem 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease, box-shadow .25s ease;
    position: relative;
}
.plan-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--pl-shadow-lg, 0 12px 40px rgba(15,23,42,.12));
}
.plan-card.plan-actual {
    border-color: var(--pl-green, #10b981);
    background: var(--pl-green-bg, #ecfdf5);
}
.plan-card.plan-popular {
    border: 2px solid var(--pl-indigo, #6366f1);
    box-shadow: var(--pl-shadow-lg, 0 12px 40px rgba(15,23,42,.12)), 0 0 0 1px rgba(99,102,241,.08);
    transform: scale(1.03);
    z-index: 2;
}
.plan-card.plan-popular:hover {
    transform: scale(1.03) translateY(-6px);
    box-shadow: var(--pl-shadow-xl, 0 20px 60px rgba(15,23,42,.16)), 0 0 0 1px rgba(99,102,241,.12);
}
.plan-card.plan-popular::before {
    content: 'Mas popular';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .35rem 1rem;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.plan-card.plan-enterprise {
    border-color: var(--pl-dark-3, #334155);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

/* --- Card Internals --- */
.badges-plan {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .5rem;
}
.badge-plan {
    font-size: .62rem;
    padding: .2rem .55rem;
    border-radius: 5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-free { background: #f1f5f9; color: #64748b; }
.badge-premium { background: #ecfdf5; color: #047857; }
.badge-pro { background: #eef2ff; color: #4338ca; }
.badge-enterprise { background: #f1f5f9; color: #1e293b; }
.badge-actual { background: #dcfce7; color: #166534; }

/* --- Nombre y precio --- */
.plan-nombre {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .3rem;
    color: var(--pl-text, #0f172a);
}
.plan-descripcion {
    font-size: .82rem;
    color: var(--pl-text-2, #475569);
    margin-bottom: 1rem;
    min-height: 2.5em;
    line-height: 1.45;
}
.plan-precio-wrapper {
    padding: 1rem 0;
    margin-bottom: .75rem;
    border-top: 1px solid var(--pl-border, #e2e8f0);
    border-bottom: 1px solid var(--pl-border, #e2e8f0);
}
.plan-precio {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--pl-text, #0f172a);
    line-height: 1.1;
    margin: 0;
}
.plan-precio span {
    font-size: .82rem;
    font-weight: 400;
    color: var(--pl-text-3, #94a3b8);
}
.planes-ahorro-card {
    display: none;
    margin-top: .35rem;
}
.planes-ahorro-card span {
    font-size: .75rem;
    color: var(--pl-green, #10b981);
    font-weight: 600;
}
.plan-precio-anual {
    font-size: .8rem;
    color: #666;
    margin-top: .15rem;
}
.plan-precio-tachado {
    text-decoration: line-through;
    color: #aaa;
    font-size: .9rem;
    margin-right: .25rem;
}

/* --- Features list --- */
.plan-features {
    list-style: none;
    padding: 0;
    margin: .5rem 0 1.25rem;
    flex: 1;
}
.plan-features li {
    padding: .45rem 0;
    font-size: .84rem;
    color: var(--pl-text-2, #475569);
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    border-bottom: 1px solid #f1f5f9;
}
.plan-features li:last-child {
    border-bottom: none;
}
.plan-features li .feat-icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.35;
}
.plan-features li .feat-icon.si {
    color: var(--pl-green, #10b981);
}
.plan-features li .feat-icon.no {
    color: #cbd5e1;
}
.plan-features li.no-disponible {
    color: var(--pl-text-3, #94a3b8);
}
.feat-detalle {
    font-size: 0.78em;
    opacity: 0.60;
    font-weight: 400;
    margin-left: 2px;
}

/* --- Botones de plan --- */
.btn-plan {
    display: block;
    width: 100%;
    text-align: center;
    padding: .9rem 1rem;
    border-radius: var(--pl-radius, 12px);
    font-weight: 600;
    text-decoration: none;
    transition: all .2s ease;
    cursor: pointer;
    border: none;
    font-size: .92rem;
    letter-spacing: .01em;
    margin-top: auto;
}
.btn-plan:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--pl-shadow-sm, 0 1px 3px rgba(15,23,42,.06));
}
.btn-plan-free {
    background: var(--pl-surface, #f8fafc);
    color: var(--pl-text, #0f172a);
    border: 1px solid var(--pl-border, #e2e8f0);
}
.btn-plan-free:hover {
    background: #f1f5f9;
    border-color: var(--pl-border-2, #cbd5e1);
}
.btn-plan-premium {
    background: var(--pl-green, #10b981);
    color: #fff;
}
.btn-plan-premium:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16,185,129,.3);
}
.btn-plan-pro {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}
.btn-plan-pro:hover {
    box-shadow: 0 4px 16px rgba(99,102,241,.35);
}
.btn-plan-enterprise {
    background: var(--pl-dark, #0f172a);
    color: #fff;
}
.btn-plan-enterprise:hover {
    background: var(--pl-dark-2, #1e293b);
    box-shadow: 0 4px 12px rgba(15,23,42,.25);
}
.btn-plan-actual {
    background: #f1f5f9;
    color: var(--pl-text-3, #94a3b8);
    cursor: default;
}
.btn-plan-actual:hover {
    transform: none;
    box-shadow: none;
}
.btn-plan-cta-final {
    display: inline-block;
    width: auto;
    padding: .9rem 2.5rem;
    max-width: 300px;
}

/* --- Grandfathering note --- */
.nota-grandfathering {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: var(--pl-radius, 12px);
    padding: 1rem 1.5rem;
    max-width: 720px;
    margin: 1.5rem auto;
    font-size: .88rem;
    text-align: center;
    color: #92400e;
}

/* --- Trust Section --- */
.planes-trust {
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
    padding: 0 1.5rem;
}
.trust-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.trust-item {
    font-size: .82rem;
    color: var(--pl-text-2, #475569);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.trust-item .trust-icon {
    color: var(--pl-green, #10b981);
    font-weight: 700;
}

/* --- Tabla comparativa desplegable --- */
.comparativa-section {
    max-width: 1100px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}
.comparativa-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    cursor: pointer;
    padding: 1rem 1.5rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--pl-text, #0f172a);
    border: 1px solid var(--pl-border, #e2e8f0);
    border-radius: var(--pl-radius, 12px);
    background: var(--pl-white, #fff);
    transition: all .2s;
    box-shadow: var(--pl-shadow-sm, 0 1px 3px rgba(15,23,42,.06));
}
.comparativa-toggle:hover {
    background: var(--pl-surface, #f8fafc);
    box-shadow: var(--pl-shadow-md, 0 4px 16px rgba(15,23,42,.08));
}
.comparativa-toggle .arrow {
    transition: transform .3s ease;
    font-size: .75rem;
    color: var(--pl-text-3, #94a3b8);
}
.comparativa-toggle.open .arrow {
    transform: rotate(180deg);
}
.comparativa-toggle.open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.comparativa-tabla {
    overflow-x: auto;
    max-height: 0;
    opacity: 0;
    transition: max-height .4s ease, opacity .3s ease;
    margin-top: -1px;
    border: 1px solid var(--pl-border, #e2e8f0);
    border-top: none;
    border-radius: 0 0 var(--pl-radius, 12px) var(--pl-radius, 12px);
}
.comparativa-tabla.visible {
    max-height: 2000px;
    opacity: 1;
}

.tabla-planes {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.tabla-planes thead th {
    background: var(--pl-dark, #0f172a);
    color: #fff;
    padding: .85rem .75rem;
    text-align: center;
    font-weight: 600;
    font-size: .82rem;
}
.tabla-planes thead th:first-child {
    text-align: left;
    padding-left: 1.25rem;
}
.tabla-planes tbody td {
    padding: .65rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    color: var(--pl-text-2, #475569);
}
.tabla-planes tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--pl-text, #0f172a);
    padding-left: 1.25rem;
}
.tabla-planes tbody tr:hover td {
    background: #f8fafc;
}
.tabla-planes .cat-row td {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--pl-text, #0f172a);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .55rem .75rem;
}
.check-si {
    color: var(--pl-green, #10b981);
    font-weight: 700;
    font-size: .95rem;
}
.check-no {
    color: #e2e8f0;
    font-size: .95rem;
}

/* --- FAQ Section --- */
.planes-faq {
    max-width: 720px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}
.planes-faq h2 {
    text-align: center;
    font-weight: 800;
    font-size: 1.6rem;
    margin-bottom: 1.75rem;
    color: var(--pl-text, #0f172a);
    letter-spacing: -0.02em;
}
.faq-item {
    border: 1px solid var(--pl-border, #e2e8f0);
    border-radius: var(--pl-radius, 12px);
    margin-bottom: .6rem;
    overflow: hidden;
    transition: box-shadow .2s;
}
.faq-item:hover {
    box-shadow: var(--pl-shadow-sm, 0 1px 3px rgba(15,23,42,.06));
}
.faq-question {
    padding: 1.1rem 1.25rem;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--pl-white, #fff);
    transition: background .2s;
    color: var(--pl-text, #0f172a);
}
.faq-question:hover {
    background: var(--pl-surface, #f8fafc);
}
.faq-question .faq-arrow {
    transition: transform .3s ease;
    font-size: .75rem;
    color: var(--pl-text-3, #94a3b8);
    flex-shrink: 0;
    margin-left: 1rem;
}
.faq-item.open .faq-arrow {
    transform: rotate(180deg);
}
.faq-item.open .faq-question {
    border-bottom: 1px solid var(--pl-border, #e2e8f0);
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.faq-answer-inner {
    padding: 1rem 1.25rem 1.15rem;
    font-size: .88rem;
    color: var(--pl-text-2, #475569);
    line-height: 1.6;
}

/* --- CTA Section --- */
.planes-cta {
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
    padding: clamp(2.5rem, 5vw, 4rem) 1.5rem;
    text-align: center;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}
.planes-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(99,102,241,.06) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}
.planes-cta > * {
    position: relative;
    z-index: 1;
}
.planes-cta h2 {
    font-weight: 800;
    font-size: clamp(1.3rem, 3vw, 1.75rem);
    margin-bottom: .75rem;
    color: #fff;
    letter-spacing: -0.02em;
}
.planes-cta p {
    color: rgba(255,255,255,.6);
    margin-bottom: 1.75rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    font-size: .95rem;
    line-height: 1.5;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .planes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .plan-card.plan-popular {
        transform: none;
    }
    .plan-card.plan-popular:hover {
        transform: translateY(-6px);
    }
}
@media (max-width: 640px) {
    .planes-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    .planes-hero h1 {
        font-size: 1.6rem;
    }
    .plan-precio {
        font-size: 2rem;
    }
    .tabla-planes {
        font-size: .78rem;
    }
    .hero-stats {
        gap: 1rem;
    }
    .planes-toggle span {
        padding: .5rem 1rem;
        font-size: .82rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .plan-card,
    .btn-plan,
    .planes-toggle span,
    .faq-item {
        transition: none;
    }
}

/* ============================================================
   TABLA COMPARATIVA PRINCIPAL (nuevo layout unico)
   ============================================================ */

.tabla-comparativa-wrapper {
    max-width: 1160px;
    margin: 2.5rem auto 0;
    padding: 0 1.5rem 3rem;
}

.tabla-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--pl-radius);
    box-shadow: 0 4px 24px rgba(15,23,42,.08);
}

.tabla-planes-principal {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: .9rem;
    min-width: 700px;
}

/* ---------- Cabecera con planes ---------- */
.thead-planes-header th {
    padding: 1.75rem 1rem 1.5rem;
    vertical-align: top;
    border-bottom: 2px solid var(--pl-border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.col-feature {
    min-width: 220px;
    text-align: left;
    font-weight: 600;
    color: var(--pl-dark);
}

.col-plan {
    min-width: 170px;
    text-align: center;
    border-left: 1px solid var(--pl-border);
}

.col-plan-popular {
    background: #eef2ff;
    border-left: 2px solid var(--pl-indigo);
    /* border-top: 3px solid var(--pl-indigo); */
}

.col-plan-actual {
    /* background: #ecfdf5; */
    border-left: 2px solid var(--pl-green);
    /* border-top: 3px solid var(--pl-green); */
}

.col-plan-enterprise {
    background: #fefce8;
    border-left: 2px solid #ca8a04;
    /* border-top: 3px solid #ca8a04; */
}

.badge-popular {
    display: inline-block;
    background: var(--pl-indigo);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .55rem;
    border-radius: 99px;
    margin-bottom: .6rem;
}

.th-plan-nombre {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--pl-dark);
    line-height: 1.2;
}

.th-plan-descripcion {
    font-size: .72rem;
    color: #64748b;
    margin: .35rem 0 .75rem;
    line-height: 1.4;
}

.th-plan-precio {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--pl-dark);
    line-height: 1;
    margin-bottom: .2rem;
}

.th-plan-precio .precio-periodo {
    font-size: .8rem;
    font-weight: 500;
    color: #64748b;
}

.th-plan-cta {
    margin-top: .85rem;
}

.th-plan-cta .btn-plan {
    width: 100%;
}

/* ---------- Cuerpo de la tabla ---------- */
.tabla-planes-principal tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}

.tabla-planes-principal tbody tr:hover {
    background: #f8fafc;
}

.tabla-planes-principal td {
    padding: .7rem 1rem;
    vertical-align: middle;
    color: var(--pl-dark);
}

.tabla-planes-principal td:not(.feat-name) {
    text-align: center;
    border-left: 1px solid #f1f5f9;
}

/* Columna popular/actual en body — tinte de fondo */
.thead-planes-header .col-plan-popular ~ .col-plan-popular,
.tabla-planes-principal tr td:nth-child(4) {
    background: inherit;
}

/* Alinear columnas body con thead (nth-child por posicion de columna) */
.col-plan-popular ~ td { background: transparent; }

/* Resaltar columna popular en filas del body */
.tabla-planes-principal tbody tr td:nth-child(4) {
    background: rgba(99,102,241,.03);
}

.cat-row-tabla td {
    background: var(--pl-surface) !important;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    padding: .9rem 1rem .5rem;
    border-bottom: 1px solid var(--pl-border);
}

.feat-name {
    font-weight: 500;
    color: var(--pl-dark);
}

.feat-hint {
    font-size: .75rem;
    font-weight: 400;
    color: #94a3b8;
}

.val-num {
    font-weight: 700;
    color: var(--pl-dark);
}

.val-sub {
    display: block;
    font-size: .7rem;
    color: #94a3b8;
    font-weight: 400;
}

.val-dash {
    color: #cbd5e1;
    font-size: 1rem;
}

/* Fila CTA de cierre */
.tr-cta-cierre td {
    padding: 1.25rem 1rem;
    border-top: 2px solid var(--pl-border);
    background: #fff !important;
}

.tr-cta-cierre .btn-plan {
    width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .tabla-comparativa-wrapper {
        padding: 0 .5rem 2.5rem;
    }

    .tabla-planes-principal {
        font-size: .82rem;
    }

    .col-feature {
        min-width: 160px;
    }

    .col-plan {
        min-width: 130px;
    }

    .th-plan-nombre {
        font-size: .95rem;
    }

    .th-plan-precio {
        font-size: 1.3rem;
    }
}

@media (max-width: 600px) {
    .col-feature {
        min-width: 130px;
    }

    .col-plan {
        min-width: 110px;
    }

    .thead-planes-header th {
        padding: 1.25rem .6rem 1rem;
    }

    .tabla-planes-principal td {
        padding: .55rem .6rem;
    }
}
