/* Tab Bar with Search Field */

.tab-bar-container {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-bar-title {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin: 0 0 1rem 0;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding-bottom: 0.5rem;
}

/* Search field */
.search-field-container {
    position: relative;
    flex: 1;
    min-width: 150px;
    max-width: 400px;
    margin-right: 1rem;
}

.search-field {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    pointer-events: none;
}

/* Tabs */
.tab-group {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
    flex: 1;
    min-width: 0; /* Allows the flex item to shrink below content size */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.tab-group::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tab {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    background-color: #f1f5fb;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.tab:hover {
    background-color: #e3eaf4;
}

.tab.active {
    background-color: var(--primary-color);
    color: white;
}

/* Add client button */
.add-client-btn {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-client-btn:hover {
    background-color: #3a5a8a;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .tab-bar {
        flex-wrap: wrap;
    }
    
    .search-field-container {
        flex: 1 0 100%;
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .tab-group {
        flex: 1 0 calc(100% - 120px); /* Leave space for add button */
    }
    
    .add-client-btn {
        margin-left: auto;
    }
}

@media (max-width: 576px) {
    .tab-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .search-field-container {
        margin-bottom: 0.5rem;
    }
    
    .tab-group {
        flex: 1 0 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem; /* Space for scrollbar */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        display: flex;
        justify-content: flex-start; /* Ensure tabs start from the left */
        width: 100%;
    }
    
    .tab {
        flex: 0 0 auto;
        padding: 0.6rem 0.75rem; /* Slightly smaller padding on small screens */
    }
    
    .add-client-btn {
        margin-left: 0;
        justify-content: center;
    }
    
    /* Show abbreviated text on small screens */
    .tab-text-long {
        display: none;
    }
    
    .tab-text-short {
        display: inline;
    }
}

/* Extra small screens (below 430px) */
@media (max-width: 430px) {
    .add-client-btn {
        width: 100%;
        padding: 0.75rem;
    }
    
    .add-client-btn span {
        display: inline-block; /* Ensure text is always visible */
        margin-left: 0.5rem;
    }
    
    /* Make tabs more compact on very small screens */
    .tab {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }
    
    /* Add visual indicator for horizontal scrolling */
    .tab-group {
        position: relative;
    }
    
    .tab-group::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.8));
        pointer-events: none;
        opacity: 0.8;
    }
}

/* For larger screens, show full text */
.tab-text-short {
    display: none;
}

.tab-text-long {
    display: inline;
}
