/* ============================================================
   THP Tabs  —  Widget Elementor + Shortcode [thp_tabs]
   ============================================================ */

/* ── Base ── */
.thp-tabs {
    width: 100%;
    margin: 0 0 2em;
}

/* ════════════════════════════════════════════════════════════
   HORIZONTAL (por defecto)
════════════════════════════════════════════════════════════ */

.thp-tabs--horizontal {
    display: block;
}

/* Nav */
.thp-tabs--horizontal > .thp-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 0;
}

.thp-tabs--horizontal > .thp-tabs__nav.thp-tabs__nav--center { justify-content: center; }
.thp-tabs--horizontal > .thp-tabs__nav.thp-tabs__nav--full   { gap: 0; }
.thp-tabs--horizontal > .thp-tabs__nav.thp-tabs__nav--full > .thp-tab-btn { flex: 1; }

/* Botones */
.thp-tabs--horizontal > .thp-tabs__nav > .thp-tab-btn {
    flex-direction: column;
    align-items: center;
    border-bottom: 3px solid transparent;
    border-right: none;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    text-align: center;
}

.thp-tabs--horizontal > .thp-tabs__nav > .thp-tab-btn.is-active {
    border-bottom-color: currentColor;
}

/* Cuerpo */
.thp-tabs--horizontal > .thp-tabs__body {
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #fff;
}

/* ════════════════════════════════════════════════════════════
   VERTICAL
════════════════════════════════════════════════════════════ */

.thp-tabs--vertical {
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* Menú lateral izquierda (por defecto) */
.thp-tabs--vertical.thp-tabs--nav-left {
    flex-direction: row;
}

/* Menú lateral derecha */
.thp-tabs--vertical.thp-tabs--nav-right {
    flex-direction: row-reverse;
}

/* Nav vertical */
.thp-tabs--vertical > .thp-tabs__nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 3px;
    width: 200px;
    flex-shrink: 0;
    padding: 6px 0;
}

.thp-tabs--vertical.thp-tabs--nav-left > .thp-tabs__nav {
    border-right: 2px solid #e0e0e0;
    border-bottom: none;
}

.thp-tabs--vertical.thp-tabs--nav-right > .thp-tabs__nav {
    border-left: 2px solid #e0e0e0;
    border-bottom: none;
}

/* Botones verticales */
.thp-tabs--vertical > .thp-tabs__nav > .thp-tab-btn {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    border-bottom: none;
    border-inline-end: 3px solid transparent;
    margin-bottom: 0;
    border-radius: 6px 0 0 6px;
    white-space: normal;
    text-align: left;
    width: 100%;
}

.thp-tabs--vertical.thp-tabs--nav-right > .thp-tabs__nav > .thp-tab-btn {
    flex-direction: row-reverse;
    border-radius: 0 6px 6px 0;
    border-inline-end: none;
    border-inline-start: 3px solid transparent;
    text-align: right;
    justify-content: flex-end;
}

.thp-tabs--vertical.thp-tabs--nav-left > .thp-tabs__nav > .thp-tab-btn.is-active {
    border-inline-end-color: currentColor;
    margin-right: -2px;
}

.thp-tabs--vertical.thp-tabs--nav-right > .thp-tabs__nav > .thp-tab-btn.is-active {
    border-inline-start-color: currentColor;
    margin-left: -2px;
}

/* Cuerpo vertical */
.thp-tabs--vertical > .thp-tabs__body {
    flex: 1;
    min-width: 0;
    background: #fff;
}

.thp-tabs--vertical.thp-tabs--nav-left > .thp-tabs__body {
    border: 1px solid #e0e0e0;
    border-left: none;
    border-radius: 0 6px 6px 6px;
}

.thp-tabs--vertical.thp-tabs--nav-right > .thp-tabs__body {
    border: 1px solid #e0e0e0;
    border-right: none;
    border-radius: 6px 0 6px 6px;
}

/* ════════════════════════════════════════════════════════════
   BOTONES (común a ambas orientaciones)
════════════════════════════════════════════════════════════ */

.thp-tab-btn {
    display: inline-flex;
    gap: 10px;
    padding: 10px 20px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: color .18s, border-color .18s, background .18s;
    /* Área de clic cubre todo el botón incluida la imagen */
    user-select: none;
    -webkit-user-select: none;
}

.thp-tab-btn * {
    pointer-events: none; /* el click lo gestiona el <button>, no los hijos */
}

.thp-tab-btn:hover {
    color: #222;
    background: #f5f5f5;
}

.thp-tab-btn.is-active {
    color: #1a1a1a;
    font-weight: 600;
}

/* Imagen */
.thp-tab-btn__img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    flex-shrink: 0;
}

/* Icono */
.thp-tab-btn__icon {
    display: flex;
    align-items: center;
    font-size: 1.1em;
    flex-shrink: 0;
}

.thp-tab-btn__label {
    display: block;
    line-height: 1.3;
}

/* ════════════════════════════════════════════════════════════
   PANELES
════════════════════════════════════════════════════════════ */

.thp-tab-panel {
    padding: 28px 32px;
    animation: thp-fade-in .2s ease;
}

.thp-tab-panel[hidden] {
    display: none;
}

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

/* ════════════════════════════════════════════════════════════
   TABS ANIDADOS
════════════════════════════════════════════════════════════ */

.thp-tabs .thp-tabs {
    margin: 0.75em 0 0;
}

.thp-tabs .thp-tabs > .thp-tabs__nav {
    border-color: #eaeaea;
    gap: 2px;
}

.thp-tabs .thp-tabs > .thp-tabs__nav > .thp-tab-btn {
    font-size: 13px;
    padding: 7px 14px 9px;
    border-radius: 4px 4px 0 0;
}

.thp-tabs .thp-tabs > .thp-tabs__body {
    background: #fafafa;
    border-color: #eaeaea;
}

.thp-tabs .thp-tabs .thp-tab-panel {
    padding: 16px 20px;
}

/* ════════════════════════════════════════════════════════════
   EDITOR ELEMENTOR
════════════════════════════════════════════════════════════ */

/* En el editor las pestañas son clicables normalmente en el preview */
body.elementor-editor-active .thp-tab-panel {
    animation: none;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    /* Vertical colapsa a horizontal en móvil */
    .thp-tabs--vertical {
        flex-direction: column !important;
    }

    .thp-tabs--vertical > .thp-tabs__nav {
        flex-direction: row !important;
        flex-wrap: wrap;
        width: auto !important;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 2px solid #e0e0e0 !important;
        padding: 0;
        gap: 3px;
    }

    .thp-tabs--vertical > .thp-tabs__nav > .thp-tab-btn {
        flex-direction: column;
        align-items: center;
        border-inline-end: none !important;
        border-inline-start: none !important;
        border-bottom: 3px solid transparent;
        margin-right: 0 !important;
        margin-left: 0 !important;
        border-radius: 4px 4px 0 0;
        width: auto;
        text-align: center;
    }

    .thp-tabs--vertical > .thp-tabs__nav > .thp-tab-btn.is-active {
        border-bottom-color: currentColor !important;
    }

    .thp-tabs--vertical > .thp-tabs__body {
        border: 1px solid #e0e0e0 !important;
        border-top: none !important;
        border-radius: 0 0 6px 6px !important;
    }

    .thp-tabs__nav {
        gap: 2px;
    }

    .thp-tab-btn {
        padding: 8px 12px 10px;
        font-size: 13px;
    }

    .thp-tab-btn__img {
        width: 36px;
        height: 36px;
    }

    .thp-tab-panel {
        padding: 16px;
    }
}
