/**
 * Slinky Menu Widget Styles
 */

/* Container */
.tbp-slinky {
    position: relative;
    width: 100%;
    background: #ffffff;
    overflow: hidden;
}

.tbp-slinky *,
.tbp-slinky *::before,
.tbp-slinky *::after {
    box-sizing: border-box;
}

/* Header */
.tbp-slinky__header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tbp-slinky__header-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

/* Tabs */
.tbp-slinky__tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tbp-slinky--tabs-fill .tbp-slinky__tabs {
    width: 100%;
}

.tbp-slinky--tabs-fill .tbp-slinky__tab {
    flex: 1;
}

.tbp-slinky__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    margin: 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.tbp-slinky__tab:hover {
    color: #374151;
    background: #f3f4f6;
}

.tbp-slinky__tab:focus {
    outline: none;
    background: #eef2ff;
}

.tbp-slinky__tab:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

.tbp-slinky__tab--active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    background: #ffffff;
}

.tbp-slinky__tab--active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366f1;
}

.tbp-slinky__tab-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    font-size: 14px;
}

.tbp-slinky__tab-icon svg {
    width: 14px;
    height: 14px;
}

.tbp-slinky__tab-label {
    white-space: nowrap;
}

/* Panels (for tabbed mode) */
.tbp-slinky__panels {
    position: relative;
}

.tbp-slinky__panel {
    display: none;
}

.tbp-slinky__panel--active {
    display: block;
}

.tbp-slinky__panel[hidden] {
    display: none;
}

/* Empty state */
.tbp-slinky__empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* Wrapper - This handles the sliding viewport */
.tbp-slinky__wrapper {
    position: relative;
    overflow: hidden;
    transition: height 0.3s ease;
}

/* Lists */
.tbp-slinky__list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.tbp-slinky__list--root {
    transition: transform 0.3s ease;
}

.tbp-slinky__list--sub {
    position: absolute;
    top: 0;
    left: 100%;
    width: 100%;
    visibility: hidden;
    opacity: 0;
    transition: transform 0.3s ease, visibility 0s linear 0.3s, opacity 0.3s ease;
}

/* Active states for sliding */
.tbp-slinky__list--active {
    visibility: visible;
    opacity: 1;
    transition: transform 0.3s ease, visibility 0s linear 0s, opacity 0.3s ease;
}

.tbp-slinky__list--slide-left {
    transform: translateX(-100%);
}

/* Menu Items */
.tbp-slinky__item {
    position: relative;
    border-bottom: 1px solid #f3f4f6;
}

.tbp-slinky__item:last-child {
    border-bottom: none;
}

.tbp-slinky__item--back {
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.tbp-slinky__item-inner {
    display: flex;
    align-items: center;
    min-height: 48px;
}

/* Links and Text */
.tbp-slinky__item-link,
.tbp-slinky__item-text {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.tbp-slinky__item-link:hover,
.tbp-slinky__item-text:hover {
    color: #111827;
    text-decoration: none;
}

.tbp-slinky__item:hover {
    background: #f9fafb;
}

/* Current/Active item */
.tbp-slinky__item--current > .tbp-slinky__item-inner .tbp-slinky__item-link,
.tbp-slinky__item--current > .tbp-slinky__item-inner .tbp-slinky__item-text {
    color: #6366f1;
    font-weight: 600;
}

.tbp-slinky__item--current > .tbp-slinky__item-inner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: #6366f1;
    border-radius: 0 2px 2px 0;
}

/* Next Button (arrow to submenu) */
.tbp-slinky__next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-left: 1px solid #f3f4f6;
    color: #9ca3af;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.tbp-slinky__next:hover {
    background: #f3f4f6;
    color: #6366f1;
}

.tbp-slinky__next:focus {
    outline: none;
    background: #eef2ff;
    color: #6366f1;
}

.tbp-slinky__next:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

.tbp-slinky__next-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.tbp-slinky__next-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Back Button */
.tbp-slinky__back {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    margin: 0;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tbp-slinky__back:hover {
    background: #f3f4f6;
    color: #374151;
}

.tbp-slinky__back:focus {
    outline: none;
    background: #eef2ff;
    color: #6366f1;
}

.tbp-slinky__back:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

.tbp-slinky__back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.tbp-slinky__back-icon svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.tbp-slinky__back-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Has Children indicator */
.tbp-slinky__item--has-children > .tbp-slinky__item-inner .tbp-slinky__item-link,
.tbp-slinky__item--has-children > .tbp-slinky__item-inner .tbp-slinky__item-text {
    padding-right: 0;
}

/* Focus styles for accessibility */
.tbp-slinky__item-link:focus,
.tbp-slinky__item-text:focus {
    outline: none;
    background: #eef2ff;
    color: #6366f1;
}

.tbp-slinky__item-link:focus-visible,
.tbp-slinky__item-text:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

/* Smooth transitions for interactive states */
.tbp-slinky__item {
    transition: background-color 0.2s ease;
}

/* Animation state classes */
.tbp-slinky--animating {
    pointer-events: none;
}

.tbp-slinky--animating .tbp-slinky__wrapper {
    overflow: hidden;
}

/* Device visibility classes */
.tbp-slinky__tab--mobile-only,
.tbp-slinky__panel--mobile-only {
    display: none;
}

.tbp-slinky__tab--tablet-only,
.tbp-slinky__panel--tablet-only {
    display: none;
}

.tbp-slinky__tab--desktop-only,
.tbp-slinky__panel--desktop-only {
    display: inline-flex;
}

@media (max-width: 1024px) {
    .tbp-slinky__tab--desktop-only,
    .tbp-slinky__panel--desktop-only {
        display: none;
    }

    .tbp-slinky__tab--tablet-only {
        display: inline-flex;
    }

    .tbp-slinky__panel--tablet-only.tbp-slinky__panel--active {
        display: block;
    }
}

@media (max-width: 767px) {
    .tbp-slinky__tab--tablet-only,
    .tbp-slinky__panel--tablet-only {
        display: none;
    }

    .tbp-slinky__tab--mobile-only {
        display: inline-flex;
    }

    .tbp-slinky__panel--mobile-only.tbp-slinky__panel--active {
        display: block;
    }
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .tbp-slinky__header {
        padding: 14px 16px;
    }

    .tbp-slinky__header-title {
        font-size: 15px;
    }

    .tbp-slinky__tab {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tbp-slinky__item-link,
    .tbp-slinky__item-text {
        padding: 12px 16px;
        font-size: 14px;
    }

    .tbp-slinky__next {
        width: 44px;
        height: 44px;
    }

    .tbp-slinky__back {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tbp-slinky__header {
        padding: 12px 14px;
    }

    .tbp-slinky__tab {
        padding: 10px 10px;
        font-size: 12px;
    }

    .tbp-slinky__tab-icon {
        margin-right: 4px;
    }

    .tbp-slinky__item-link,
    .tbp-slinky__item-text {
        padding: 11px 14px;
        font-size: 14px;
    }

    .tbp-slinky__next {
        width: 40px;
        height: 40px;
    }

    .tbp-slinky__back {
        padding: 11px 14px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .tbp-slinky__item-link,
    .tbp-slinky__item-text {
        min-height: 44px;
    }

    .tbp-slinky__next {
        min-width: 44px;
        min-height: 44px;
    }

    .tbp-slinky__back {
        min-height: 44px;
    }

    .tbp-slinky__tab {
        min-height: 44px;
    }
}

/* Placeholder/Editor styles */
.tbp-slinky--placeholder {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .tbp-slinky__wrapper,
    .tbp-slinky__list,
    .tbp-slinky__list--root,
    .tbp-slinky__list--sub,
    .tbp-slinky__item,
    .tbp-slinky__item-link,
    .tbp-slinky__item-text,
    .tbp-slinky__next,
    .tbp-slinky__back,
    .tbp-slinky__tab {
        transition: none;
    }
}

/* Print styles */
@media print {
    .tbp-slinky {
        display: none;
    }
}
