/* =================================================================
   STEP 2 - CONFIGURATION DU COURS
   Formulaire épuré et moderne
   ================================================================= */

/* =================================================================
   FORMULAIRE DE PARAMÈTRES
   ================================================================= */
.parameters-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* Sections du formulaire */
.moodia-form-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.moodia-form-section__title {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 1.375rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-black);
    margin-bottom: var(--spacing-sm);
}

.moodia-form-section__title svg {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    color: var(--color-primary);
}

/* Couche secondaire (background) en bleu primary */
.moodia-form-section__title svg .svg-secondary,
.moodia-form-section__title svg .duoicon-secondary-layer {
    color: var(--color-primary);
    fill: var(--color-primary);
    opacity: 0.2;
}

/* Couche primaire (foreground) en bleu primary opaque */
.moodia-form-section__title svg .svg-primary,
.moodia-form-section__title svg .duoicon-primary-layer {
    color: var(--color-primary);
    fill: var(--color-primary);
    opacity: 1;
}

/* Ligne de formulaire (2 colonnes) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

/* Groupe de formulaire */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-group--full {
    grid-column: 1 / -1;
}

/* Label avec astérisque required */
.form-group label {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-black);
}

.required {
    color: var(--color-error);
    font-size: 0.875rem;
    line-height: 1;
    margin-top: 1px;
}

/* Badge optionnel */
.optional-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--spacing-sm);
    background: var(--color-gray);
    color: var(--color-gray-dark);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--border-radius-full);
    margin-left: var(--spacing-xs);
    vertical-align: middle;
}

/* Input help text */
.input-help {
    font-size: var(--font-size-sm);
    color: var(--color-gray-dark);
    margin-top: calc(var(--spacing-xs) * -1);
    line-height: 1.4;
}

/* Inputs et selects */
.form-group input,
.form-group select,
.form-group textarea {
    transition: all 200ms ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(12, 129, 228, 0.08);
}

/* Select personnalisé */
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    background-size: 16px;
    padding-right: calc(var(--spacing-md) + 24px);
    cursor: pointer;
}

/* Textarea */
.form-group textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

/* =================================================================
   AUTOCOMPLETE UTILISATEURS
   ================================================================= */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-item {
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--color-gray-light);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(12, 129, 228, 0.05);
}

.autocomplete-item-text {
    color: var(--color-black);
    font-size: var(--font-size-base);
}

.autocomplete-loading,
.autocomplete-no-results,
.autocomplete-error {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--color-gray-dark);
    font-size: var(--font-size-sm);
}

.autocomplete-error {
    color: var(--color-error);
}

/* Utilisateur sélectionné */
.selected-teacher {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(12, 129, 228, 0.08), rgba(12, 129, 228, 0.02));
    border: 1px solid rgba(12, 129, 228, 0.2);
    border-radius: var(--border-radius-lg);
    margin-top: var(--spacing-xs);
}

.selected-teacher-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.selected-teacher-name {
    font-weight: var(--font-weight-semibold);
    color: var(--color-black);
    font-size: var(--font-size-base);
}

.selected-teacher-email {
    color: var(--color-gray-dark);
    font-size: var(--font-size-sm);
}

.selected-teacher-remove {
    background: var(--color-white);
    border: 1px solid var(--color-gray);
    border-radius: var(--border-radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-gray-dark);
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.selected-teacher-remove:hover {
    background: var(--color-error);
    border-color: var(--color-error);
    color: var(--color-white);
}


/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .parameters-form {
        gap: var(--spacing-lg);
    }

    .moodia-form-section__title {
        font-size: 1.125rem;
    }

    .moodia-form-section__title svg {
        width: 24px;
        height: 24px;
    }
}
