/* SystemConfig Tab and Checkbox CSS Fixes */

/* ===== TAB NAVIGATION FIXES ===== */
.config-tabs {
    display: flex !important;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
    flex-wrap: nowrap !important;
    min-height: 60px;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

.config-tabs::-webkit-scrollbar {
    height: 6px;
}

.config-tabs::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.config-tabs::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.config-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.tab-button {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap !important;
    font-weight: 500;
    flex-shrink: 0 !important;
    min-width: fit-content;
    height: 60px;
    position: relative;
}

.tab-button:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.tab-button.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
    background: white;
}

.tab-button .material-icons {
    font-size: 1.25rem;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.tab-button span {
    flex-shrink: 0 !important;
    margin: 0 !important;
    line-height: 1.2;
}

/* ===== CHECKBOX FIXES ===== */
.checkbox-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    width: 100%;
}

.checkbox-group input[type="checkbox"] {
    margin: 0 !important;
    flex-shrink: 0 !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0 !important;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    flex: 1;
    line-height: 1.4;
    padding-left: 0.25rem;
}

/* ===== RESPONSIVE FIXES ===== */
@media (max-width: 768px) {
    .config-tabs {
        flex-direction: row !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        min-height: 50px;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        height: 50px;
        min-width: auto;
        flex-shrink: 0 !important;
    }

    .tab-button .material-icons {
        font-size: 1.125rem;
    }

    .tab-button span {
        font-size: 0.875rem;
    }

    /* Hide text on very small screens, show only icons */
    @media (max-width: 480px) {
        .tab-button span {
            display: none;
        }
        
        .tab-button {
            padding: 0.75rem;
            min-width: 50px;
            justify-content: center;
        }
        
        .tab-button .material-icons {
            font-size: 1.25rem;
        }
    }
}

@media (max-width: 480px) {
    .checkbox-group {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.25rem;
    }
    
    .checkbox-group input[type="checkbox"] {
        align-self: flex-start;
    }
    
    .checkbox-group label {
        flex: none;
        padding-left: 0;
    }
}

/* ===== FORM GRID FIXES ===== */
.form-grid.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .form-grid.two-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ===== SECTION FIXES ===== */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 2px solid var(--primary-100);
    padding-bottom: 0.5rem;
}

/* ===== ENHANCED CHECKBOX STYLING ===== */
.checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 3px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-group input[type="checkbox"]:checked {
    background: var(--primary-600);
    border-color: var(--primary-600);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-group input[type="checkbox"]:hover {
    border-color: var(--primary-400);
}

.checkbox-group input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-200);
    outline-offset: 2px;
}

/* ===== LOADING STATES ===== */
.tab-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.checkbox-group input[type="checkbox"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.tab-button:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.checkbox-group label:focus-within {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .tab-button {
        border: 1px solid var(--gray-400);
    }
    
    .tab-button.active {
        border: 2px solid var(--primary-600);
    }
    
    .checkbox-group input[type="checkbox"] {
        border: 2px solid var(--gray-600);
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .tab-button {
        transition: none;
    }
    
    .checkbox-group input[type="checkbox"] {
        transition: none;
    }
}
