/* tab-manager.css - Tab system styles */
.tab-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(180deg, var(--dark), var(--black));
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    z-index: 1000;
    padding: 0 0.5rem;
    gap: 0.5rem;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 1px rgba(139, 92, 246, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    box-sizing: border-box;
}

.tab-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        var(--glow-color, rgba(139, 92, 246, 0.3)),
        transparent
    );
    opacity: 0.5;
}

.tabs-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    min-width: 0;
}

.tabs-container::-webkit-scrollbar {
    height: 4px;
}

.tabs-container::-webkit-scrollbar-track {
    background: transparent;
}

.tabs-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, var(--gray), var(--dark));
    border: 1px solid var(--light-gray);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 100px;
    max-width: 220px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.tab-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(139, 92, 246, 0.1), 
        transparent
    );
    transition: left 0.5s ease;
    z-index: 0;
}

.tab-item:hover::before {
    left: 100%;
}

.tab-item:hover {
    background: linear-gradient(135deg, var(--light-gray), var(--gray));
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.tab-item.active {
    background: linear-gradient(135deg, var(--black), var(--dark));
    border-bottom-color: var(--black);
    border-color: var(--primary);
    box-shadow: 
        0 -4px 20px var(--glow-color, rgba(139, 92, 246, 0.5)),
        0 -2px 8px var(--glow-color, rgba(139, 92, 246, 0.3)),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    transform: translateY(-1px);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent,
        var(--primary),
        var(--glow-color, var(--primary)),
        var(--primary),
        transparent
    );
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 10px var(--glow-color, rgba(139, 92, 246, 0.8));
    animation: glow-pulse 2s ease-in-out infinite;
}

.tab-item.active::before {
    left: 0;
    background: linear-gradient(90deg, 
        transparent, 
        var(--glow-color, rgba(139, 92, 246, 0.15)), 
        transparent
    );
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px var(--glow-color, rgba(139, 92, 246, 0.8));
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 20px var(--glow-color, rgba(139, 92, 246, 1));
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

.tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    color: var(--text);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    min-width: 0;
}

.tab-item:hover .tab-name {
    color: var(--primary);
}

.tab-item.active .tab-name {
    color: var(--primary);
    font-weight: 600;
    text-shadow: 0 0 10px var(--glow-color, rgba(139, 92, 246, 0.5));
}

.tab-close {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
    position: relative;
    z-index: 1;
}

.tab-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.tab-close:hover::before {
    width: 100%;
    height: 100%;
}

.tab-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    opacity: 1;
    transform: scale(1.1) rotate(90deg);
}

.tab-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--light-gray);
    flex-shrink: 0;
    margin-left: 0.25rem;
    min-width: fit-content;
}

.tab-toolbar-btn {
    background: var(--gray);
    border: 1px solid var(--light-gray);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.tab-toolbar-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.2;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.tab-toolbar-btn:hover::before {
    width: 100%;
    height: 100%;
}

.tab-toolbar-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(139, 92, 246, 0.2),
        0 0 20px var(--glow-color, rgba(139, 92, 246, 0.3));
}

.tab-toolbar-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.15);
}

.tab-toolbar-btn i {
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.tab-toolbar-btn:hover i {
    transform: scale(1.1);
}

.tab-toolbar-btn#reload-btn:hover i {
    animation: spin 0.6s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tab-notification {
    position: fixed;
    top: 60px;
    right: 20px;
    background: var(--dark);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 10001;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.tab-notification.show {
    transform: translateX(0);
}

.tab-notification.info {
    border-left: 3px solid var(--primary);
}

.tab-notification.success {
    border-left: 3px solid #22c55e;
}

.tab-notification.error {
    border-left: 3px solid #ef4444;
}

.tab-content-area {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--black);
    z-index: 999;
    margin: 0;
    padding: 0;
}

.tab-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--black);
}

/* Adjust body padding when tabs are active */
body.has-tabs {
    padding-top: 0;
    margin-top: 0;
}

body.has-tabs .tab-content-area {
    top: 48px;
}

/* Hide tab bar when no tabs */
.tab-bar:has(.tabs-container:empty) {
    display: none !important;
}

/* Adjust main content when tabs are active */
body.has-tabs .container,
body.has-tabs .games-container,
body.has-tabs .themes-container,
body.has-tabs .tools-container,
body.has-tabs .roadmap-container {
    display: none;
}

@media (max-width: 768px) {
    .tab-bar {
        height: 40px;
        padding: 0 0.375rem;
    }
    
    .tab-item {
        min-width: 80px;
        max-width: 140px;
        padding: 0.375rem 0.625rem;
        gap: 0.375rem;
    }
    
    .tab-name {
        font-size: 0.75rem;
    }
    
    .tab-close {
        width: 18px;
        height: 18px;
        padding: 0.2rem;
    }
    
    .tab-toolbar {
        gap: 0.375rem;
        padding-left: 0.5rem;
    }
    
    .tab-toolbar-btn {
        width: 32px;
        height: 32px;
    }
    
    .tab-content-area {
        top: 40px;
    }
    
    body.has-tabs {
        padding-top: 0;
        margin-top: 0;
    }
    
    body.has-tabs .tab-content-area {
        top: 40px;
    }
}

