/* Formulaires modals magasin (pièces, catégories, fournisseurs, …) */
:root {
    --mf-primary: var(--mag-primary, #f97316);
    --mf-primary-deep: #ea580c;
    --mf-primary-dark: #c2410c;
    --mf-accent: #dc2626;
    --mf-bg: #fff7ed;
    --mf-border: #fed7aa;
    --mf-muted: #78716c;
    --mf-text: #1c1917;
    --mf-radius: 14px;
}

.mag-form-modal .modal-content {
    border: none;
    border-radius: var(--mf-radius);
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(194, 65, 12, 0.18);
}
.mag-form-modal .modal-header {
    background: #fff;
    color: var(--mf-text);
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.35rem;
    align-items: center;
}
.mag-form-modal .modal-header .modal-title,
.mag-form-modal .modal-header .title {
    color: var(--mf-text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    margin: 0;
}
.mag-form-modal .modal-header .close {
    color: #78716c;
    opacity: 0.85;
    text-shadow: none;
    font-size: 1.6rem;
    font-weight: 400;
    padding: 0;
    margin: 0;
    line-height: 1;
}
.mag-form-modal .modal-header .close:hover {
    opacity: 1;
    color: var(--mf-text);
}
.mag-form-modal .modal-body {
    padding: 1.25rem 1.35rem 0.75rem;
    background: #fff;
}
.mag-form-modal .modal-footer {
    border-top: 1px solid #f1f5f9;
    background: #fff;
    padding: 0.9rem 1.35rem 1.1rem;
    gap: 0.5rem;
}

.mf-section {
    margin-bottom: 1.15rem;
}
.mf-section__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.95rem;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid var(--mf-border);
    color: var(--mf-primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.mf-section__title i {
    color: var(--mf-primary);
    font-size: 0.95rem;
}

.mf-field {
    margin-bottom: 0.95rem;
}
.mf-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #44403c;
}
.mf-field .form-control,
.mag-form-modal .form-control {
    border: 1.5px solid #e7e5e4;
    border-radius: 10px;
    min-height: 42px;
    padding: 0.5rem 0.85rem;
    font-size: 0.92rem;
    color: var(--mf-text);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mf-field textarea.form-control,
.mag-form-modal textarea.form-control {
    min-height: 88px;
}
.mf-field .form-control:focus,
.mag-form-modal .form-control:focus {
    border-color: var(--mf-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
    outline: none;
}
.mf-field .mf-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    margin: 0;
    padding: 0;
}
.mf-field .mf-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--mf-primary);
    cursor: pointer;
}
.mf-field .mf-check .mf-hint {
    margin: 0;
}
.mf-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--mf-muted);
}

.mf-field--readonly label {
    color: var(--mf-muted);
}

.mf-field .form-control.mf-control-readonly,
.mf-field .form-control[readonly] {
    background-color: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

.mf-field .form-control.mf-control-readonly:focus,
.mf-field .form-control[readonly]:focus {
    border-color: #e2e8f0;
    box-shadow: none;
}

.mf-req {
    color: var(--mf-accent);
    font-weight: 700;
}
.mf-info {
    border: 1px solid var(--mf-border);
    background: var(--mf-bg);
    border-radius: 10px;
    padding: 0.75rem 0.95rem;
    font-size: 0.85rem;
    color: #44403c;
    margin-bottom: 1rem;
}

.mag-form-modal .btn-mf-cancel {
    border-radius: 999px;
    font-weight: 600;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    background: #fff;
    padding: 0.45rem 1.15rem;
}
.mag-form-modal .btn-mf-cancel:hover {
    background: #f8fafc;
    color: #334155;
    border-color: #94a3b8;
}
.mag-form-modal .btn-mf-save {
    border-radius: 999px;
    font-weight: 700;
    border: none;
    color: #fff;
    background: var(--mf-primary);
    padding: 0.45rem 1.25rem;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.28);
}
.mag-form-modal .btn-mf-save:hover {
    color: #fff;
    background: var(--mf-primary-deep);
}

/* Infos pièce (entrée en stock) */
.mf-piece-info {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid var(--mf-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.15rem;
}
.mf-piece-info__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mf-text);
    margin: 0 0 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--mf-border);
    word-break: break-word;
}
.mf-piece-info__ref {
    color: var(--mf-primary-deep);
    font-weight: 700;
}
.mf-piece-info__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem 0.75rem;
}
@media (min-width: 576px) {
    .mf-piece-info__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.mf-piece-info__item {
    background: #fff;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    min-width: 0;
}
.mf-piece-info__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mf-muted);
    margin-bottom: 0.2rem;
}
.mf-piece-info__value {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mf-text);
    word-break: break-word;
}
.mf-piece-info__value--accent {
    color: var(--mf-primary-deep);
}
.mf-piece-info__value--ok {
    color: #16a34a;
}

.mf-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.mf-gallery__item {
    width: 88px;
    border: 1px solid var(--mf-border);
    border-radius: 10px;
    background: #fff;
    padding: 0.45rem;
    text-align: center;
}

.mf-gallery__item img {
    display: block;
    width: 100%;
    height: 64px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8fafc;
    margin-bottom: 0.35rem;
}

.mf-gallery__delete {
    justify-content: center;
    font-size: 0.72rem;
}

.mf-gallery__delete label {
    cursor: pointer;
    color: #b45309;
    font-weight: 600;
}
