.form-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: #5da8ae;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.registration-form {
    margin-top: 1rem;
}


.form-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: #5da8ae;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.registration-form {
    margin-top: 1rem;
}

/* Styles pour les références STEG */
.steg-references-group {
    margin-bottom: 1.5rem;
}

.steg-reference-item {
    margin-bottom: 1rem;
    position: relative;
}

.btn-add-reference {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-add-reference:hover {
    background: #e9ecef;
    border-color: #e1a625ff;
    color: #e1a625ff;
}

.btn-remove-reference {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-remove-reference:hover {
    background: #dc3545;
    color: white;
}

/* Styles pour les districts avec checkboxes */
.districts-group {
    margin-bottom: 1.5rem;
}

.districts-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.districts-scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.district-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.district-checkbox-item:hover {
    background-color: #f8f9fa;
}

.district-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #e1a625ff;
}

.district-label {
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    margin: 0;
    user-select: none;
}

.district-checkbox:checked + .district-label {
    font-weight: 600;
    color: #e1a625ff;
}

/* Scrollbar styling */
.districts-scrollable::-webkit-scrollbar {
    width: 6px;
}

.districts-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.districts-scrollable::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.districts-scrollable::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    display: block;
}

.form-text {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Assurer que les groupes de formulaires avec icônes ont une position relative */
.form-icon-group {
    position: relative;
}

/* Styles pour les inputs des références STEG dynamiques */
.steg-reference-input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.steg-reference-input:focus {
    outline: none;
    border-color: #e1a625ff;
    box-shadow: 0 0 0 3px rgba(225, 166, 37, 0.1);
}

/* Style cohérent pour tous les inputs */
.form-icon-group input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-icon-group input:focus {
    outline: none;
    border-color: #5da8ae;
    box-shadow: 0 0 0 3px rgba(225, 166, 37, 0.1);
}

.form-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 2;
}

/* Responsive styles for screens <= 400px */
@media (max-width: 400px) {
    /* Container adjustments */
    .container {
        padding: 0 15px;
    }
    
    /* Login container layout */
    .login-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    /* Form tabs - stack vertically */
    .form-tabs {
        flex-direction: column;
        border-radius: 8px;
    }
    
    .tab-btn {
        padding: 1rem;
        justify-content: flex-start;
    }
    
    .tab-btn:not(:last-child) {
        border-bottom: 1px solid #e9ecef;
    }
    
    /* Form header */
    .form-header h2 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .form-header p {
        text-align: center;
        font-size: 0.9rem;
    }
    
    /* Horizontal form groups - stack vertically */
    .form-row.horizontal-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Form icon groups */
    .form-icon-group {
        margin-bottom: 1rem;
    }
    
    .form-icon-group input,
    .form-icon-group select {
        padding: 14px 45px 14px 45px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* STEG references */
    .steg-references-group {
        margin-bottom: 1rem;
    }
    
    .steg-reference-item {
        margin-bottom: 0.75rem;
    }
    
    .btn-add-reference {
        padding: 1rem;
        font-size: 0.85rem;
    }
    
    .btn-remove-reference {
        right: 8px;
        width: 25px;
        height: 25px;
    }
    
    /* Districts checkboxes */
    .districts-group {
        margin-bottom: 1rem;
    }
    
    .districts-scrollable {
        max-height: 150px;
        padding: 0.75rem;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .district-checkbox-item {
        padding: 0.4rem;
    }
    
    .district-label {
        font-size: 0.85rem;
    }
    
    /* Form labels and text */
    .form-label {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
    
    .form-text {
        font-size: 0.8rem;
    }
    
    /* Agree terms group */
    .agree-group {
        margin: 1.5rem 0;
    }
    
    .agree-group .form-check-label {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    /* Buttons */
    .btn-primary {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Login link */
    .login-link {
        text-align: center;
        font-size: 0.9rem;
    }
    
    /* Login side section */
    .login-side {
        order: -1; /* Move to top on mobile */
        text-align: center;
    }
    
    .side-content h3 {
        font-size: 1.4rem;
    }
    
    .side-content p {
        font-size: 0.9rem;
    }
    
    .btn-secondary {
        width: 100%;
        padding: 0.875rem;
    }
    
    /* Hero section adjustments */
    .login-hero .container {
        padding: 2rem 1rem;
    }
    
    .login-hero h1 {
        font-size: 2rem;
    }
    
    .login-hero p {
        font-size: 1rem;
    }
    
    /* Form sections spacing */
    .login-section {
        padding: 2rem 0;
    }
    
    /* Ensure proper spacing between form elements */
    .registration-form {
        margin-top: 0.5rem;
    }
    
    /* Improve touch targets */
    .tab-btn,
    .district-checkbox-item,
    .btn-remove-reference,
    .form-check-input {
        min-height: 44px; /* Minimum touch target size */
    }
    
    /* Adjust icon sizes for better visibility */
    .form-icon {
        font-size: 1.1rem;
    }
    
    /* SweetAlert adjustments for mobile */
    .swal2-popup {
        width: 90% !important;
        max-width: 350px !important;
    }
}

/* Additional optimizations for very small screens */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .tab-btn {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    .form-icon-group input,
    .form-icon-group select {
        padding: 12px 40px 12px 40px;
    }
    
    .districts-scrollable {
        max-height: 120px;
    }
}