/**
 * THP Off-Canvas Drill-Down Menu
 * Layout A: drill-down (all screens)
 * Layout B: side-by-side panels on desktop, drill-down on mobile
 * Version: 1.1.0
 */

/* ─── CSS Custom Properties ────────────────────────────────────── */

.thp-oc {
    --thp-oc-bg: #ffffff;
    --thp-oc-text: #333333;
    --thp-oc-text-hover: #c0392b;
    --thp-oc-border: #eeeeee;
    --thp-oc-icon-size: 36px;
    --thp-oc-arrow-color: #999999;
    --thp-oc-back-color: #666666;
    --thp-oc-all-color: #c0392b;
    --thp-oc-badge-bg: #e74c3c;
    --thp-oc-badge-text: #ffffff;
    --thp-oc-transition: 300ms ease;
    --thp-oc-font-size: 15px;
    --thp-oc-item-padding: 14px 16px;
    --thp-oc-active-bg: rgba(0, 0, 0, 0.04);

    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--thp-oc-bg);
    color: var(--thp-oc-text);
    font-family: inherit;
    font-size: var(--thp-oc-font-size);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

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

/* ─── Slider Container ─────────────────────────────────────────── */

.thp-oc__slider {
    position: relative;
    width: 100%;
    min-height: 200px;
}

/* ─── Levels (Panels) ── Layout A default ──────────────────────── */

.thp-oc__level {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    visibility: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: transform var(--thp-oc-transition),
                opacity var(--thp-oc-transition),
                visibility 0s linear var(--thp-oc-transition);
    padding-bottom: 20px;
}

.thp-oc__level--active {
    position: relative;
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
    transition: transform var(--thp-oc-transition),
                opacity var(--thp-oc-transition),
                visibility 0s linear 0s;
}

/* ── Drill-down animations ── */

.thp-oc__level--enter-right {
    animation: thp-oc-enter-right var(--thp-oc-transition) forwards;
}
@keyframes thp-oc-enter-right {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.thp-oc__level--exit-left {
    animation: thp-oc-exit-left var(--thp-oc-transition) forwards;
}
@keyframes thp-oc-exit-left {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(-30%); opacity: 0; }
}

.thp-oc__level--enter-left {
    animation: thp-oc-enter-left var(--thp-oc-transition) forwards;
}
@keyframes thp-oc-enter-left {
    from { transform: translateX(-30%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.thp-oc__level--exit-right {
    animation: thp-oc-exit-right var(--thp-oc-transition) forwards;
}
@keyframes thp-oc-exit-right {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

/* ─── Logo ─────────────────────────────────────────────────────── */

.thp-oc__logo {
    padding: 20px 16px 12px;
    text-align: center;
}

.thp-oc__logo img {
    max-width: 180px;
    max-height: 80px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* ─── Extra Links ──────────────────────────────────────────────── */

.thp-oc__extra-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: var(--thp-oc-item-padding);
    color: var(--thp-oc-text);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

.thp-oc__extra-link:hover {
    color: var(--thp-oc-text-hover);
}

.thp-oc__extra-link .thp-oc__item-icon {
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

/* ─── Category List ────────────────────────────────────────────── */

.thp-oc__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ─── Category Item ────────────────────────────────────────────── */

.thp-oc__item {
    border: none;
}

.thp-oc__item-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: var(--thp-oc-item-padding);
    background: transparent;
    border: none;
    color: var(--thp-oc-text);
    text-decoration: none;
    font-family: inherit;
    font-size: var(--thp-oc-font-size);
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s ease, background 0.2s ease;
}

.thp-oc__item-btn:hover,
.thp-oc__item-btn:focus-visible {
    color: var(--thp-oc-text-hover);
    background: rgba(0, 0, 0, 0.02);
}

.thp-oc__item-btn:focus {
    outline: none;
}

/* Active item highlight (Layout B desktop) */
.thp-oc__item-btn--active {
    background: var(--thp-oc-active-bg);
    color: var(--thp-oc-text-hover);
}

/* ─── Item Icon ────────────────────────────────────────────────── */

.thp-oc__item-icon {
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.thp-oc__item-icon img,
.thp-oc__item-icon .thp-oc__icon-img {
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
    object-fit: contain;
    border-radius: 4px;
}

.thp-oc__icon-svg {
    display: inline-block;
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
}

/* ─── Item Label ───────────────────────────────────────────────── */

.thp-oc__item-label {
    flex: 1 1 auto;
    min-width: 0;
}

/* ─── Arrow ────────────────────────────────────────────────────── */

.thp-oc__arrow {
    flex-shrink: 0;
    color: var(--thp-oc-arrow-color);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.thp-oc__item-btn:hover .thp-oc__arrow {
    transform: translateX(3px);
}

.thp-oc__arrow svg {
    width: 8px;
    height: 14px;
}

/* ─── Badge (only element that keeps uppercase) ───────────────── */

.thp-oc__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
    white-space: nowrap;
    background-color: var(--thp-oc-badge-bg);
    color: var(--thp-oc-badge-text);
    flex-shrink: 0;
}

/* ── A: Ribbon Corner ── */

.thp-oc__badge--ribbon {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 72px;
    height: 72px;
    overflow: hidden;
    background: none;
    padding: 0;
    border-radius: 0;
    pointer-events: none;
    z-index: 2;
}

.thp-oc__badge-ribbon-inner {
    position: absolute;
    top: 14px;
    right: -18px;
    width: 100px;
    text-align: center;
    padding: 2px 0;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transform: rotate(45deg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ── B: Floating Cloud ── */

.thp-oc__badge--cloud {
    position: absolute;
    top: -4px;
    left: 12px;
    transform: translateY(-100%);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
    pointer-events: none;
    background: none; /* overridden by inline style */
}

.thp-oc__badge-cloud-arrow {
    position: absolute;
    bottom: -4px;
    left: 16px;
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
    border-radius: 0 0 2px 0;
}

/* ── C: Superscript Dot ── */

.thp-oc__badge--dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    line-height: 0;
    vertical-align: super;
    margin-left: 4px;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.4);
    cursor: help;
}

/* ── D: Accent Underline ── */

.thp-oc__badge--underline {
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    padding: 0;
    border-radius: 0;
    pointer-events: none;
}

.thp-oc__badge-underline-line {
    flex: 1;
    height: 1px;
    opacity: 0.3;
}

.thp-oc__badge-underline-text {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* ── E: Sticker / Stamp ── */

.thp-oc__badge--sticker {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    transform: rotate(-6deg);
    border: 1px dashed rgba(255,255,255,0.5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── F: Glowing Pill ── */

.thp-oc__badge--glow {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    /* box-shadow set via inline style for dynamic color */
}

/* ── Position adjustments for absolute badges inside items ── */

.thp-oc__item-btn {
    position: relative;
}

/* Ribbon and cloud need extra padding-top in item. */
.thp-oc__item-btn:has(.thp-oc__badge--ribbon),
.thp-oc__item-btn:has(.thp-oc__badge--cloud) {
    overflow: visible;
}

/* Cloud badge: give item extra top space. */
.thp-oc__item:has(.thp-oc__badge--cloud) {
    padding-top: 18px;
}

/* Ribbon: clip only within the item area. */
.thp-oc__item:has(.thp-oc__badge--ribbon) {
    overflow: hidden;
}

/* Underline: give item extra bottom space. */
.thp-oc__item:has(.thp-oc__badge--underline) .thp-oc__item-btn {
    padding-bottom: 22px;
}

/* ─── Back Button ──────────────────────────────────────────────── */

.thp-oc__back {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--thp-oc-back-color);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s ease;
}

.thp-oc__back:hover {
    color: var(--thp-oc-text);
}

.thp-oc__back:focus {
    outline: none;
}

.thp-oc__back svg {
    width: 8px;
    height: 14px;
    flex-shrink: 0;
}

/* ─── Level Header ─────────────────────────────────────────────── */

.thp-oc__level-header {
    padding: 0;
}

.thp-oc__level-image {
    width: 100%;
    overflow: hidden;
}

.thp-oc__level-image img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    padding: 0;
}

.thp-oc__level-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.thp-oc__level-title > span {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--thp-oc-text);
}

/* ─── "All" Link ───────────────────────────────────────────────── */

.thp-oc__all-link {
    display: inline-flex;
    align-items: center;
    color: var(--thp-oc-all-color);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.thp-oc__all-link:hover {
    opacity: 0.7;
}

/* ─── Popular Links ────────────────────────────────────────────── */

.thp-oc__popular {
    margin-top: 8px;
    border-top: 1px solid var(--thp-oc-border);
    padding-top: 4px;
}

.thp-oc__popular-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: var(--thp-oc-item-padding);
    color: var(--thp-oc-text);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--thp-oc-font-size);
    letter-spacing: 0.02em;
    border: none !important;
    transition: color 0.2s ease, background 0.2s ease;
}

.thp-oc__popular-link:hover {
    color: var(--thp-oc-text-hover);
    background: rgba(0, 0, 0, 0.02);
}

.thp-oc__popular-icon {
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 4px;
}

.thp-oc__popular-icon--svg {
    display: inline-block;
    width: var(--thp-oc-icon-size);
    height: var(--thp-oc-icon-size);
}

.thp-oc__popular-label {
    flex: 1 1 auto;
    min-width: 0;
}

.thp-oc__popular-cta {
    display: block;
    margin: 12px 16px;
    padding: 10px 16px;
    text-align: center;
    background: var(--thp-oc-text-hover);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.2s ease;
}

.thp-oc__popular-cta:hover {
    opacity: 0.85;
    color: #fff;
}

/* ─── Bottom Links ─────────────────────────────────────────────── */

.thp-oc__bottom-links {
    border-top: 1px solid var(--thp-oc-border);
    margin-top: 4px;
}

/* ─── DCE off-canvas compatibility ─────────────────────────────── */

.dce-offcanvas .thp-oc,
.elementor-widget-dce-dynamic-offcanvas .thp-oc {
    width: 100%;
}

/* ─── Responsive ───────────────────────────────────────────────── */

@media (min-width: 481px) {
    .thp-oc {
        --thp-oc-font-size: 15px;
        --thp-oc-icon-size: 40px;
    }

    .thp-oc__level-image img {
        height: 180px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT B — Side-by-side panels on desktop (≥769px)
   On mobile (<769px) it uses Layout A drill-down automatically.
   ═══════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) {

    /* Layout B inside DCE: ensure container doesn't clip expanding panels.
       MUST be inside this media query — otherwise mobile off-canvas breaks. */
    .dce-menu-aocm:has(.thp-oc--layout-b),
    .dce-menu-aocm.thp-oc-dce-layout-b {
        overflow: visible;
        transition: width 0.3s ease;
    }

    .dce-menu-aocm:has(.thp-oc--layout-b) .dce-nav,
    .dce-menu-aocm:has(.thp-oc--layout-b) .dce-nav-menu,
    .dce-menu-aocm:has(.thp-oc--layout-b) .dce-template-before,
    .dce-menu-aocm:has(.thp-oc--layout-b) .dce-template-before > .elementor,
    .dce-menu-aocm:has(.thp-oc--layout-b) .dce-template-before .e-con,
    .thp-oc-dce-layout-b .dce-nav,
    .thp-oc-dce-layout-b .dce-nav-menu,
    .thp-oc-dce-layout-b .dce-template-before,
    .thp-oc-dce-layout-b .dce-template-before > .elementor,
    .thp-oc-dce-layout-b .dce-template-before .e-con {
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }

    /* Container: no overflow hidden, allow panels to expand. */
    .thp-oc--layout-b {
        overflow: visible;
    }

    /* Slider: flex row so panels sit side-by-side. */
    .thp-oc--layout-b .thp-oc__slider {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        min-height: 400px;
    }

    /* Root panel: always visible, slightly wider to fit icons + badges. */
    .thp-oc--layout-b .thp-oc__level[data-level="0"] {
        position: relative !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        flex: 1.2 1 0%;
        min-width: 260px;
        border-right: 1px solid var(--thp-oc-border);
        transition: none !important;
        animation: none !important;
        padding-bottom: 0;
        overflow-y: auto;
    }

    /* Sub-panels: hidden by default, expand when active. */
    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]) {
        position: relative !important;
        width: 0;
        min-width: 0;
        flex: 0 0 0%;
        overflow: hidden;
        visibility: hidden;
        opacity: 0;
        transform: none !important;
        transition: flex var(--thp-oc-transition),
                    min-width var(--thp-oc-transition),
                    opacity var(--thp-oc-transition),
                    visibility 0s linear var(--thp-oc-transition);
        animation: none !important;
        padding-bottom: 0;
        border-right: none;
    }

    /* Active sub-panel: expand. */
    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]).thp-oc__level--active {
        flex: 1 1 0%;
        min-width: 200px;
        overflow-y: auto;
        visibility: visible;
        opacity: 1;
        border-right: 1px solid var(--thp-oc-border);
        transition: flex var(--thp-oc-transition),
                    min-width var(--thp-oc-transition),
                    opacity var(--thp-oc-transition),
                    visibility 0s linear 0s;
    }

    /* Prevent text wrapping in sub-panel items (no icons, more space). */
    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]) .thp-oc__item-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]) .thp-oc__popular-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Badges in sub-panels: adjust for narrow space. */
    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]) .thp-oc__item-btn {
        overflow: visible;
    }

    /* Cloud: smaller offset in narrow panels. */
    .thp-oc--layout-b .thp-oc__badge--cloud {
        left: 8px;
    }

    /* Ribbon: smaller in narrow panels. */
    .thp-oc--layout-b .thp-oc__badge--ribbon {
        width: 64px;
        height: 64px;
    }

    .thp-oc--layout-b .thp-oc__badge-ribbon-inner {
        top: 12px;
        right: -20px;
        font-size: 7px;
    }

    /* Underline: adjust right offset for no-arrow items. */
    .thp-oc--layout-b .thp-oc__badge--underline {
        right: 16px;
    }

    /* Arrow stays on the first row. */
    .thp-oc--layout-b .thp-oc__level:not([data-level="0"]) .thp-oc__arrow {
        margin-left: auto;
    }

    /* Hide back button on desktop layout B. */
    .thp-oc--layout-b .thp-oc__back {
        display: none;
    }

    /* Images in Layout B: contain instead of cover (panels are narrow). */
    .thp-oc--layout-b .thp-oc__level-image {
        background: #ffffff;
    }

    .thp-oc--layout-b .thp-oc__level-image img {
        height: 150px;
        object-fit: contain;
    }
}

/* ─── Reduced motion ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .thp-oc__level,
    .thp-oc__level--enter-right,
    .thp-oc__level--exit-left,
    .thp-oc__level--enter-left,
    .thp-oc__level--exit-right {
        animation: none !important;
        transition: none !important;
    }
}
