/* ── FORM WRAPPER ──────────────────────────────────────────────── */
.form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    width: 100%;
}

.form-wrapper__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-wrapper__col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-wrapper__row-line {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .form-wrapper__row-line {
    border-color: var(--border-dark);
}

/* ── GROUPES ───────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-light);
    transition: color var(--duration-slow);
}

[data-theme="dark"] .form-label {
    color: var(--muted-dark);
}

/* ── INPUTS ────────────────────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background-color: var(--nav-bg-light);
    color: var(--text-light);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--duration-normal), box-shadow var(--duration-normal), background var(--duration-slow), color var(--duration-slow);
    appearance: none;
}

[data-theme="dark"] .form-input {
    background-color: var(--nav-bg-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

.form-input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px var(--violet-glow);
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%237C3AED' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.75rem;
    padding-right: 2.5rem;
}

[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23A78BFA' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

/* ── FILE INPUT ────────────────────────────────────────────────── */
.form-file {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px dashed var(--border-light);
    background-color: var(--nav-bg-light);
    color: var(--text-light);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--duration-normal),
    box-shadow var(--duration-normal),
    background var(--duration-slow),
    color var(--duration-slow);
}

[data-theme="dark"] .form-file {
    background-color: var(--nav-bg-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}

.form-file:hover {
    border-color: var(--violet-light);
    background-color: var(--pill-bg-light);
}

[data-theme="dark"] .form-file:hover {
    background-color: var(--pill-bg-dark);
    border-color: var(--violet-light);
}

.form-file:focus {
    border-color: var(--violet);
    border-style: solid;
    box-shadow: 0 0 0 3px var(--violet-glow);
}

.form-file:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Bouton natif "Choisir un fichier" */
.form-file::file-selector-button {
    padding: 0.3rem 0.85rem;
    border-radius: 7px;
    border: none;
    background: var(--pill-bg-light);
    color: var(--violet);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background var(--duration-fast), color var(--duration-fast);
}

[data-theme="dark"] .form-file::file-selector-button {
    background: var(--pill-bg-dark);
    color: var(--violet-light);
}

.form-file:hover::file-selector-button,
.form-file:focus::file-selector-button {
    background: var(--violet);
    color: white;
}

/* ── HELP TEXT ─────────────────────────────────────────────────── */
.form-helper {
    font-size: 0.76rem;
    color: var(--muted-light);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.3rem;
    transition: color var(--duration-slow);
}

[data-theme="dark"] .form-helper {
    color: var(--muted-dark);
}

/* Petite pastille d'info devant le texte */
.form-helper::before {
    content: 'ℹ';
    font-size: 0.7rem;
    color: var(--violet-light);
    flex-shrink: 0;
}

/* ── FOOTER ────────────────────────────────────────────────────── */
.form-wrapper__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.form-btn {
    padding: 0.6rem 1.75rem;
    border-radius: 10px;
    border: none;
    background: var(--violet);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--duration-fast), box-shadow var(--duration-fast);
}

.form-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 20px var(--violet-glow);
}

.form-btn--cancel {
    background: transparent;
    color: var(--muted-light);
    border: 1px solid var(--border-light);
}

[data-theme="dark"] .form-btn--cancel {
    color: var(--muted-dark);
    border-color: var(--border-dark);
}

.form-btn--cancel:hover {
    background: var(--pill-bg-light);
    box-shadow: none;
    opacity: 1;
    text-decoration: none;
}

[data-theme="dark"] .form-btn--cancel:hover {
    background: var(--pill-bg-dark);
}

/* ── ERREURS ───────────────────────────────────────────────────── */
.form-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.form-group ul li {
    font-size: 0.78rem;
    color: #ef4444;
    margin-top: 0.2rem;
}

/* ── CHECKBOX ─────────────────────────────────────────────────────── */
.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-checkbox-group-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: color var(--duration-slow);
}

[data-theme="dark"] .form-checkbox-group-item {
    color: var(--text-dark);
}

.form-checkbox-group-item input[type="checkbox"] {
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    border: 1.5px solid var(--border-light);
    border-radius: 4px;
    background: var(--nav-bg-light);
    cursor: pointer;
    transition: background var(--duration-normal), border-color var(--duration-normal);
    flex-shrink: 0;
    position: relative;
}

[data-theme="dark"] .form-checkbox-group-item input[type="checkbox"] {
    border-color: var(--border-dark);
    background: var(--nav-bg-dark);
}

.form-checkbox-group-item input[type="checkbox"]:checked {
    background: var(--violet);
    border-color: var(--violet);
}

.form-checkbox-group-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 8px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -60%) rotate(45deg);
}

/* ── TOGGLE THEME ──────────────────────────────────────────────── */
.form-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.form-toggle input[type="checkbox"] {
    display: none;
}

.form-toggle__track {
    width: 2.4rem;
    height: 1.3rem;
    border-radius: 999px;
    background: var(--border-light);
    position: relative;
    flex-shrink: 0;
    transition: background var(--duration-normal);
}

.form-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(1.3rem - 6px);
    height: calc(1.3rem - 6px);
    border-radius: 50%;
    background: white;
    transition: transform var(--duration-normal);
}

.form-toggle input:checked ~ .form-toggle__track {
    background: var(--violet);
}

.form-toggle input:checked ~ .form-toggle__track::after {
    transform: translateX(1.1rem);
}

.form-toggle__label {
    font-size: 0.9rem;
    color: var(--text-light);
    transition: color var(--duration-slow);
}

.form-toggle__label.disabled {
    color: var(--muted-light);
}

[data-theme="dark"] .form-toggle__label {
    color: var(--text-dark);
}

[data-theme="dark"] .form-toggle__label.disabled  {
    color: var(--muted-dark);
}

/* ── TOM SELECT — FULL CUSTOM (sans CDN) ──────────────────────── */
.form-tom-select {
    position: relative;
    width: 100%;
}

.form-tom-select .ts-control {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.35rem !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-light) !important;
    background: var(--nav-bg-light) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.9rem !important;
    padding: 0.4rem 0.6rem !important;
    min-height: 2.5rem !important;
    cursor: text !important;
    box-shadow: none !important;
}

[data-theme="dark"] .form-tom-select .ts-control {
    background: var(--nav-bg-dark) !important;
    border-color: var(--border-dark) !important;
    color: var(--text-dark) !important;
}

.form-tom-select.focus .ts-control {
    border-color: var(--violet) !important;
    box-shadow: 0 0 0 3px var(--violet-glow) !important;
    outline: none !important;
}

/* ── Input de recherche ── */
.form-tom-select .ts-control input {
    flex: 1 !important;
    min-width: 120px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.9rem !important;
    color: var(--text-light) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
}

[data-theme="dark"] .form-tom-select .ts-control input {
    color: var(--text-dark) !important;
}

.form-tom-select .ts-control input::placeholder {
    color: var(--muted-light) !important;
    opacity: 1 !important;
}

[data-theme="dark"] .form-tom-select .ts-control input::placeholder {
    color: var(--muted-dark) !important;
}

/* ── Tags sélectionnés ── */
.form-tom-select .ts-control .item {
    display: inline-flex !important;
    align-items: center !important;
    background: var(--violet) !important;
    color: white !important;
    border-radius: 6px !important;
    padding: 0.2rem 0.5rem !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    margin: 2px !important;
}

.form-tom-select .ts-control .item .remove {
    display: inline-flex !important;
    align-items: center !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    margin-left: 0.4rem !important;
    padding-left: 0.4rem !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    background: none !important;
}

.form-tom-select .ts-control .item .remove:hover {
    color: white !important;
    background: none !important;
}

/* ── Dropdown ── */
.form-tom-select .ts-dropdown {
    position: absolute !important;
    z-index: 1050 !important;
    width: 100% !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-light) !important;
    background: var(--nav-bg-light) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.9rem !important;
    margin-top: 4px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
    overflow: hidden !important;
}

[data-theme="dark"] .form-tom-select .ts-dropdown {
    background: var(--nav-bg-dark) !important;
    border-color: var(--border-dark) !important;
    color: var(--text-dark) !important;
}

.form-tom-select .ts-dropdown .ts-dropdown-content {
    padding: 0.25rem !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.form-tom-select .ts-dropdown .option {
    padding: 0.5rem 0.75rem !important;
    border-radius: 7px !important;
    cursor: pointer !important;
    color: var(--text-light) !important;
    background: transparent !important;
    transition: background var(--duration-fast), color var(--duration-fast) !important;
}

[data-theme="dark"] .form-tom-select .ts-dropdown .option {
    color: var(--text-dark) !important;
}

.form-tom-select .ts-dropdown .option:hover,
.form-tom-select .ts-dropdown .option.active {
    background: var(--violet) !important;
    color: white !important;
}

.form-tom-select .ts-dropdown .option.selected {
    opacity: 0.4 !important;
    pointer-events: none !important;
}
