/* FC Tabs Block */
.wp-block-fca-course-blocks-tabs {
    margin-bottom: var(--fcom-block-spacing, 20px);
    width: 100%;
}

/* ========== TAB NAVIGATION ========== */
.tabs-nav {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

/* Horizontal layout */
.layout-horizontal .tabs-nav {
    flex-direction: row;
    border-bottom: 2px solid var(--fcom-primary-border, #e5e7eb);
    overflow-x: auto;
}

/* Vertical layout */
.layout-vertical {
    display: flex;
    gap: 20px;
}

.layout-vertical .tabs-nav {
    flex-direction: column;
    border-bottom: none;
    border-right: 2px solid var(--fcom-primary-border, #e5e7eb);
    min-width: 180px;
    flex-shrink: 0;
}

.layout-vertical .tabs-content,
.layout-vertical .tabs-content-editor {
    flex: 1;
    min-width: 0;
}

/* Tab buttons */
.tab-button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--fcom-secondary-text, #6b7280);
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.tab-button:hover {
    color: var(--fcom-primary-button, #1877F2);
    background-color: var(--fcom-highlight-bg, rgba(24, 119, 242, 0.05));
}

.tab-button.is-active {
    color: var(--fcom-primary-button, #1877F2);
    font-weight: 600;
}

/* Horizontal active indicator */
.layout-horizontal .tab-button.is-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--fcom-primary-button, #1877F2);
}

/* Vertical active indicator */
.layout-vertical .tab-button {
    text-align: left;
    padding: 10px 16px;
}

.layout-vertical .tab-button.is-active::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--fcom-primary-button, #1877F2);
}

/* ========== TAB CONTENT ========== */
.tabs-content {
    padding: 20px 0;
}

.layout-vertical .tabs-content {
    padding: 0;
}

/* Tab panels (core/group blocks) */
.tabs-content > .wp-block-group {
    display: none;
}

.tabs-content > .wp-block-group.is-active {
    display: block;
}

/* ========== STYLE VARIATIONS ========== */

/* Pills style */
.tab-style-pills .tabs-nav {
    gap: 8px;
    border-bottom: none;
    padding-bottom: 16px;
}

.tab-style-pills .tab-button {
    border-radius: 20px;
    padding: 8px 18px;
    border: 1px solid var(--fcom-primary-border, #e5e7eb);
    background: var(--fcom-card-bg, var(--fcom-primary-bg, #fff));
}

.tab-style-pills .tab-button:hover {
    border-color: var(--fcom-primary-button, #1877F2);
}

.tab-style-pills .tab-button.is-active {
    background: var(--fcom-primary-button, #1877F2);
    color: var(--fcom-primary-button-text, #fff);
    border-color: var(--fcom-primary-button, #1877F2);
}

.tab-style-pills .tab-button.is-active::after {
    display: none;
}

/* Underline style */
.tab-style-underline .tabs-nav {
    border-bottom: 1px solid var(--fcom-primary-border, #e5e7eb);
}

.tab-style-underline .tab-button.is-active::after {
    height: 3px;
    bottom: -1px;
}

/* Boxed style */
.tab-style-boxed .tabs-nav {
    background: var(--fcom-active-bg, #f6f7f7);
    border-radius: 8px;
    padding: 4px;
    border-bottom: none;
    margin-bottom: 16px;
}

.tab-style-boxed .tab-button {
    border-radius: 6px;
    padding: 10px 16px;
}

.tab-style-boxed .tab-button.is-active {
    background: var(--fcom-card-bg, var(--fcom-primary-bg, #fff));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-style-boxed .tab-button.is-active::after {
    display: none;
}

/* Block alignment support */
.wp-block-fca-course-blocks-tabs.alignwide {
    max-width: var(--wp--style--global--wide-size, 1000px);
    margin-left: auto;
    margin-right: auto;
}

.wp-block-fca-course-blocks-tabs.alignfull {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* ========== EDITOR STYLES ========== */
.tabs-content-editor {
    padding: 20px 0;
}

.layout-vertical .tabs-content-editor {
    padding: 0;
}

/* Hide all panels by default in editor */
.tabs-content-editor > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group {
    display: none;
    border: 1px solid var(--fcom-primary-border, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
    background: var(--fcom-card-bg, var(--fcom-primary-bg, #fff));
    min-height: 100px;
}

/* Show only the active panel based on data-active-index */
.tabs-content-editor[data-active-index="0"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(1),
.tabs-content-editor[data-active-index="1"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(2),
.tabs-content-editor[data-active-index="2"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(3),
.tabs-content-editor[data-active-index="3"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(4),
.tabs-content-editor[data-active-index="4"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(5),
.tabs-content-editor[data-active-index="5"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(6),
.tabs-content-editor[data-active-index="6"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(7),
.tabs-content-editor[data-active-index="7"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(8),
.tabs-content-editor[data-active-index="8"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(9),
.tabs-content-editor[data-active-index="9"] > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block-group:nth-child(10) {
    display: block;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .layout-vertical {
        flex-direction: column;
    }
    
    .layout-vertical .tabs-nav {
        flex-direction: row;
        border-right: none;
        border-bottom: 2px solid var(--fcom-primary-border, #e5e7eb);
        min-width: 0;
        overflow-x: auto;
    }
    
    .layout-vertical .tab-button.is-active::after {
        right: auto;
        top: auto;
        bottom: -2px;
        left: 0;
        width: auto;
        height: 2px;
    }
    
    .tab-button {
        padding: 10px 14px;
        font-size: 13px;
    }
}
