/**
 * Tabs Block Styles - GitBook Style
 */

/* Base Tabs Container */
.docsy-tabs-block {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bs-white);
    border: 1px solid var(--bs-gray-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    background: var(--bs-gray-100);
    border-bottom: 1px solid var(--bs-gray-300);
    padding: 0.75rem 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.tabs-nav::-webkit-scrollbar-track {
    background: var(--bs-gray-100);
}

.tabs-nav::-webkit-scrollbar-thumb {
    background: var(--bs-gray-300);
    border-radius: 2px;
}

/* Tab Buttons */
.tab-button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--bs-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    white-space: nowrap;
    position: relative;
}

.tab-button:hover {
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.tab-button.active {
    color: var(--bs-primary);
    background: var(--bs-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.tab-button:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Add Tab Button (Editor Only) */
.tab-button-add {
    padding: 0.75rem 1rem;
    border: 1px dashed var(--bs-gray-300);
    background: transparent;
    color: var(--bs-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-button-add:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

/* Tabs Content */
.tabs-content {
    padding: 2rem;
    min-height: 200px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-panel p:first-child {
    margin-top: 0;
}

.tab-panel p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Tab Style Variations
======================================== */

/* Pills Style */
.docsy-tabs-block.tab-style-pills .tabs-nav {
    background: var(--bs-white);
    border-bottom: none;
    padding: 1rem;
}

.docsy-tabs-block.tab-style-pills .tab-button {
    border-radius: 50px;
    padding: 0.65rem 1.5rem;
}

.docsy-tabs-block.tab-style-pills .tab-button.active {
    background: var(--bs-primary);
    color: var(--bs-white);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

.docsy-tabs-block.tab-style-pills .tab-button:hover:not(.active) {
    background: rgba(var(--bs-primary-rgb), 0.1);
}

/* Underline Style */
.docsy-tabs-block.tab-style-underline .tabs-nav {
    background: transparent;
    border-bottom: 2px solid var(--bs-gray-300);
    padding: 0 1rem;
    gap: 0;
}

.docsy-tabs-block.tab-style-underline .tab-button {
    border-radius: 0;
    padding: 1rem 1.5rem;
    background: transparent;
    position: relative;
}

.docsy-tabs-block.tab-style-underline .tab-button::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.docsy-tabs-block.tab-style-underline .tab-button.active::after {
    background: var(--bs-primary);
}

.docsy-tabs-block.tab-style-underline .tab-button.active {
    background: transparent;
    box-shadow: none;
}

.docsy-tabs-block.tab-style-underline .tab-button:hover:not(.active) {
    background: rgba(var(--bs-primary-rgb), 0.03);
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 768px) {
    .tabs-nav {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .tab-button {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }

    .tabs-content {
        padding: 1.5rem;
    }

    .docsy-tabs-block.tab-style-pills .tab-button {
        padding: 0.5rem 1rem;
    }

    .docsy-tabs-block.tab-style-underline .tab-button {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .tab-button {
        flex-shrink: 0;
    }

    .tabs-content {
        padding: 1rem;
    }
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .docsy-tabs-block {
        box-shadow: none;
        border: 1px solid var(--bs-gray-400);
    }

    .tabs-nav {
        display: none;
    }

    .tab-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    .tab-panel::before {
        content: attr(aria-labelledby);
        display: block;
        font-weight: bold;
        margin-bottom: 0.5rem;
        text-transform: capitalize;
    }
}

/* ========================================
   Accessibility
======================================== */
.tab-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tab-panel {
        animation: none;
    }

    .tab-button,
    .tab-button::after {
        transition: none;
    }
}
