/* MM SEO Block — módulo CSS (requiere mmb-shared.css) */

/* ── Contenedor raíz ─────────────────── */
.mmseo-root {
    width: 100%;
    padding: 40px 24px;
    box-sizing: border-box;
    font-family: var(--mmb-font);
}

/* Fondos */
.mmseo-bg--white { background: #fff; }
.mmseo-bg--light { background: var(--mmb-bg-light); }
.mmseo-bg--dark  {
    background: var(--mmb-primary);
    color: #fff;
}

/* ── Layout interior ─────────────────── */
.mmseo-inner {
    max-width: var(--mmb-max-width);
    margin: 0 auto;
    display: grid;
    gap: 2.5rem;
    align-items: start;
}

/* Layouts */
.mmseo-layout--full         .mmseo-inner { grid-template-columns: 1fr; }
.mmseo-layout--sidebar-right .mmseo-inner { grid-template-columns: 1fr 300px; }
.mmseo-layout--sidebar-left  .mmseo-inner { grid-template-columns: 300px 1fr; }

/* Sidebar left: invertir orden visual */
.mmseo-layout--sidebar-left .mmseo-main    { order: 2; }
.mmseo-layout--sidebar-left .mmseo-sidebar { order: 1; }

/* ── Tipografía del cuerpo (prose) ─── */
.mmseo-prose { line-height: 1.75; color: inherit; }

.mmseo-prose h2 {
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    font-weight: 700;
    color: var(--mmb-primary);
    margin: 0 0 .6em;
    line-height: 1.25;
}
.mmseo-bg--dark .mmseo-prose h2 { color: #fff; }

.mmseo-prose h3 {
    font-size: clamp(1.05rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: var(--mmb-primary);
    margin: 1.4em 0 .4em;
    line-height: 1.3;
}
.mmseo-bg--dark .mmseo-prose h3 { color: rgba(255,255,255,.9); }

.mmseo-prose h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--mmb-text-main);
    margin: 1.2em 0 .3em;
}
.mmseo-bg--dark .mmseo-prose h4 { color: rgba(255,255,255,.85); }

.mmseo-prose p {
    margin: 0 0 1em;
    font-size: .97rem;
    color: var(--mmb-text-main);
}
.mmseo-bg--dark .mmseo-prose p { color: rgba(255,255,255,.85); }

.mmseo-prose p:last-child { margin-bottom: 0; }

.mmseo-prose strong { color: var(--mmb-primary); font-weight: 700; }
.mmseo-bg--dark .mmseo-prose strong { color: var(--mmb-accent-alt); }

.mmseo-prose a { color: var(--mmb-primary); text-decoration: underline; }
.mmseo-prose a:hover { color: var(--mmb-accent); }
.mmseo-bg--dark .mmseo-prose a { color: var(--mmb-accent-alt); }

/* Listas del TinyMCE */
.mmseo-prose ul,
.mmseo-prose ol {
    margin: 0 0 1em 1.2em;
    padding: 0;
    font-size: .97rem;
    color: var(--mmb-text-main);
}
.mmseo-bg--dark .mmseo-prose ul,
.mmseo-bg--dark .mmseo-prose ol { color: rgba(255,255,255,.85); }
.mmseo-prose li { margin-bottom: .35em; }

/* Tablas del TinyMCE */
.mmseo-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
    margin: 0 0 1.2em;
    border-radius: var(--mmb-radius-md);
    overflow: hidden;
}
.mmseo-prose table th,
.mmseo-prose table td {
    padding: .6em .85em;
    border: 1px solid var(--mmb-border);
    text-align: left;
    vertical-align: top;
}
.mmseo-prose table th {
    background: var(--mmb-primary);
    color: #fff;
    font-weight: 700;
}
.mmseo-prose table tr:nth-child(even) td { background: var(--mmb-bg-light); }

/* ── Sidebar card ────────────────────── */
.mmseo-card {
    background: #fff;
    border: 1px solid var(--mmb-border-soft);
    border-radius: var(--mmb-radius-lg);
    box-shadow: var(--mmb-shadow-sm);
    overflow: hidden;
    position: sticky;
    top: 24px;
}
.mmseo-bg--dark .mmseo-card {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.15);
}

.mmseo-card__title {
    margin: 0;
    padding: .75rem 1rem;
    background: var(--mmb-primary);
    color: #fff;
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* ── Tabla sidebar ───────────────────── */
.mmseo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.mmseo-table tr { border-bottom: 1px solid var(--mmb-border); }
.mmseo-table tr:last-child { border-bottom: none; }
.mmseo-table th {
    padding: .6rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--mmb-text-main);
    background: var(--mmb-bg-light);
    width: 50%;
}
.mmseo-table td {
    padding: .6rem 1rem;
    color: var(--mmb-text-sub);
    font-weight: 500;
}
.mmseo-table tr:hover th,
.mmseo-table tr:hover td { background: #f0f0f8; }

/* ── Lista sidebar ───────────────────── */
.mmseo-list {
    list-style: none;
    margin: 0;
    padding: .5rem 0;
}
.mmseo-list__item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .55rem 1rem;
    font-size: .9rem;
    color: var(--mmb-text-main);
    border-bottom: 1px solid var(--mmb-border);
    line-height: 1.4;
}
.mmseo-list__item:last-child { border-bottom: none; }

/* Iconos lista */
.mmseo-li-icon {
    flex-shrink: 0;
    width: 16px; height: 16px;
    margin-top: 2px;
    color: var(--mmb-primary);
}
.mmseo-li-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--mmb-primary);
    margin-top: 5px;
}
.mmseo-li--star   .mmseo-li-icon { color: var(--mmb-accent-alt); }
.mmseo-li--cross  .mmseo-li-icon { color: #c0392b; }
.mmseo-li--arrow  .mmseo-li-icon { color: var(--mmb-accent); }

/* ── Responsive ──────────────────────── */
@media (max-width: 768px) {
    .mmseo-root { padding: 28px 16px; }

    .mmseo-layout--sidebar-right .mmseo-inner,
    .mmseo-layout--sidebar-left  .mmseo-inner {
        grid-template-columns: 1fr;
    }
    /* En móvil el sidebar va siempre abajo */
    .mmseo-layout--sidebar-left .mmseo-main    { order: 1; }
    .mmseo-layout--sidebar-left .mmseo-sidebar { order: 2; }

    .mmseo-card { position: static; }
    .mmseo-prose h2 { font-size: 1.25rem; }
    .mmseo-prose h3 { font-size: 1.05rem; }
}

/* ── Colapsable ──────────────────────── */
.mmseo-collapsible-wrap { position: relative; }

/* Estado colapsado: limitar altura del bloque */
.mmseo-root.is-collapsible {
    max-height: var(--mmseo-collapsed, 10.5rem);
    overflow: hidden;
    transition: max-height .45s ease;
    /* Máscara de fade en el borde inferior */
    -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
    mask-image:         linear-gradient(to bottom, #000 60%, transparent 100%);
}
.mmseo-root.is-collapsible.is-expanded {
    max-height: 9999px; /* valor alto para que la transición funcione */
    -webkit-mask-image: none;
    mask-image: none;
}

/* Barra del botón */
.mmseo-expand-bar {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}

.mmseo-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent !important;
    border: 2px solid var(--mmb-primary) !important;
    color: var(--mmb-primary) !important;
    font-family: var(--mmb-font);
    font-weight: 700;
    font-size: .88rem;
    padding: .5rem 1.25rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    transition: background .2s, color .2s;
}
.mmseo-expand-btn:hover {
    background: var(--mmb-primary) !important;
    color: #fff !important;
}
.mmseo-expand-icon {
    width: 16px; height: 16px;
    transition: transform .3s ease;
    flex-shrink: 0;
}
.mmseo-expand-btn[aria-expanded="true"] .mmseo-expand-icon {
    transform: rotate(180deg);
}

/* Fondo oscuro */
.mmseo-bg--dark + .mmseo-expand-bar .mmseo-expand-btn {
    border-color: rgba(255,255,255,.5);
    color: #fff;
}
.mmseo-bg--dark + .mmseo-expand-bar .mmseo-expand-btn:hover {
    background: rgba(255,255,255,.15);
}

@media (prefers-reduced-motion: reduce) {
    .mmseo-root.is-collapsible { transition: none !important; }
    .mmseo-expand-icon          { transition: none !important; }
}
