/* ============================================
   PANEL TABS
   Tab navigation for right panel
   ============================================ */

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    padding: 4px;
    gap: 4px;
}

.panel-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.panel-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.panel-tab.active {
    background: var(--accent-gradient);
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.tab-icon {
    margin-right: 8px;
    vertical-align: middle;
}

/* Deck count badge */
.deck-count {
    margin-left: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8em;
}

.extra-count-badge {
    margin-left: 4px;
    background: rgba(139, 92, 246, 0.6);
    /* Purple tint for distinction */
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
}

.panel-tab.active .deck-count {
    background: rgba(0, 0, 0, 0.2);
}

/* Warning badge */
.warning-badge {
    margin-right: 6px;
    font-size: 1.1em;
    cursor: help;
}

/* Invalid State for Deck Tab */
.panel-tab.invalid {
    border-color: rgba(255, 68, 68, 0.5);
    background: rgba(255, 68, 68, 0.1);
}

.panel-tab.invalid:hover {
    background: rgba(255, 68, 68, 0.15);
}

.panel-tab.invalid.active {
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.2) 0%, rgba(200, 50, 50, 0.3) 100%);
}

/* View Mode Toggles */
.deck-view-toggles {
    display: flex;
    gap: 4px;
}

/* Tab Panel Container (for CSS-based visibility) */
.tab-panel {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
    overflow: hidden;
}

.tab-panel.active {
    /* Ensure active panel takes full space */
    flex: 1;
}

/* Mobile: Enable scrolling on the tab panel itself */
@media (max-width: 768px) {

    /* Tab bar - horizontal scroll, no wrap */
    .panel-tabs {
        width: 100%;
        max-width: 100vw;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar on Firefox */
        -ms-overflow-style: none;
        /* Hide scrollbar on IE/Edge */
        padding: 4px;
        gap: 6px;
        display: flex;
        flex-wrap: nowrap !important;
    }

    .panel-tabs::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar on Chrome/Safari */
    }

    /* Individual tabs - optimized for space */
    .panel-tab {
        min-width: 44px;
        min-height: 40px;
        padding: 6px 8px;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        font-size: 0;
        /* Hide text nodes */
    }

    /* Active tab shows text */
    .panel-tab.active {
        flex: 1 1 auto;
        min-width: 80px;
        font-size: 14px;
        /* Restore font size for active tab */
    }

    /* Tab icons - explicit px size with !important */
    .panel-tab .tab-icon {
        margin: 0;
        font-size: 20px !important;
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .panel-tab.active .tab-icon {
        margin-right: 6px;
    }

    /* Deck count badge - positioned top-right corner */
    .panel-tab .deck-count {
        position: absolute;
        top: 4px;
        right: 4px;
        font-size: 10px !important;
        /* px not em */
        padding: 2px 5px;
        margin: 0;
        min-width: 16px;
        text-align: center;
    }

    .panel-tab.active .deck-count {
        position: relative;
        top: auto;
        right: auto;
        margin-left: 4px;
        font-size: 11px !important;
        /* px not em */
    }

    /* Extra count badge */
    .extra-count-badge {
        position: absolute;
        top: 4px;
        right: 24px;
        font-size: 9px !important;
        /* px not em */
        padding: 1px 4px;
        margin: 0;
    }

    .panel-tab.active .extra-count-badge {
        position: relative;
        top: auto;
        right: auto;
        margin-left: 2px;
        font-size: 0.7em;
    }

    /* Warning badge */
    .warning-badge {
        position: absolute;
        top: 2px;
        left: 2px;
        margin: 0;
        font-size: 0.85em;
    }

    .panel-tab.active .warning-badge {
        position: relative;
        top: auto;
        left: auto;
        margin-right: 4px;
    }

    /* Tab panel content */
    .tab-panel {
        overflow: visible;
    }

    .tab-panel.active {
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
        overflow: visible !important;
        min-height: 100%;
    }
}