/* Formulaire création / modification / copie d'équipement */

.creation-form-container {
    position: relative;
    min-width: 350px;
    margin: 0 auto;
    background-color: white;
    padding: 40px 20px 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
    .creation-form-container {
        min-width: 700px;
        padding: 44px 40px 30px 40px;
    }
}

.creation-form-container .page-title {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.creation-form-container h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #4f46e5;
    margin-top: 30px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.grid-info-generale {
    grid-template-columns: 1fr;
}

.grid-specs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
}

.metrology-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    margin: 0 0 12px;
}

.metrology-section-header h3 {
    margin: 0;
}

.creation-form-container .metrology-section-header h3 {
    margin: 0;
    margin-top: 0;
    margin-bottom: 0;
}

.metrology-extras {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin: 0;
}

.metrology-check {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    margin: 0 !important;
}

.metrology-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.metrology-check-label-short {
    display: none;
}

.metrology-specs-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.metrology-specs-stack .grid-specs {
    margin: 0;
}

.metrology-extent-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 8px;
}

#extent2Block,
#multiEchelonBlock {
    background: #e8f0f7;
    border: 1px solid #c5d6e6;
}

#extent3Block {
    background: #dde3ea;
    border: 1px solid #b0bac6;
}

.metrology-extent-title {
    font-weight: 700;
    color: #1e293b;
    font-size: 1rem;
    line-height: 1.2;
}

.grid-specs-bare {
    align-items: stretch;
}

.spec-locked-wrap .spec-control select.is-locked,
.spec-locked-wrap .spec-control select:disabled {
    background-color: #e5e7eb;
    color: #6b7280;
    cursor: not-allowed;
    pointer-events: none;
}

.spec-locked-wrap .spec-back-to-list {
    display: none !important;
}

@media (max-width: 767.98px) {
    .grid-specs {
        grid-template-columns: 1fr;
    }

    .metrology-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin: 0 0 8px;
    }

    .creation-form-container .metrology-section-header h3 {
        margin: 0;
    }

    .metrology-extras {
        width: 100%;
        gap: 8px 14px;
        flex-wrap: nowrap;
    }

    .metrology-check-label-full {
        display: none;
    }

    .metrology-check-label-short {
        display: inline;
    }

    .metrology-specs-stack {
        gap: 8px;
        margin-bottom: 0;
    }

    .metrology-specs-stack .form-grid.grid-specs {
        gap: 8px;
        margin-bottom: 0;
    }

    .metrology-specs-stack .form-grid.grid-specs > label {
        margin: 0;
    }

    .metrology-extent-row {
        gap: 8px;
    }

    .metrology-extent-title {
        margin: 0;
    }
}

.spec-control {
    display: flex;
    flex-direction: column;
}

.spec-back-to-list {
    display: none;
    margin-top: 6px;
    padding: 0;
    border: none;
    background: none;
    color: #4f46e5;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.spec-control--custom .spec-back-to-list {
    display: inline-block;
}

.spec-control--custom select {
    display: none;
}

.form-page-header {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 18px;
    padding: 8px 10px 12px;
    box-sizing: border-box;
}

@media screen and (max-width: 767.98px) {
    .form-page-header {
        margin-bottom: 14px;
        padding: 16px 8px 14px;
    }

    .form-page-header .header-title {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    .creation-form-container {
        min-width: 0;
        width: 100%;
        padding: 36px 14px 14px 14px;
    }
}

.form-page-header .header-title {
    display: block;
    width: 100%;
    margin: 0;
    text-align: center;
    color: #1f2937;
    font-size: 1.8rem;
    font-weight: 700;
}

.creation-form-container .back-link {
    position: absolute;
    top: 14px;
    right: 18px;
    color: #0cb166;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    z-index: 2;
}

.creation-form-container .back-link:hover {
    text-decoration: underline;
}

.grid-localisation,
.grid-localisation-suite {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-grid label {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: #374151;
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-top: 5px;
    background-color: white;
}

.form-grid input:disabled {
    background-color: #e5e7eb;
    cursor: not-allowed;
}

.form-grid input.is-locked {
    background-color: #f3f4f6;
}

.field-with-unlock {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: #374151;
}

.field-with-unlock-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.field-with-unlock-row input[type="text"],
.field-with-unlock-row input[type="date"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 280px;
}

.unlock-toggle {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-top: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.unlock-toggle input {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0 !important;
}

.unlock-toggle-ui {
    display: block;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #d1d5db;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.unlock-toggle-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.unlock-toggle input:checked + .unlock-toggle-ui {
    background: #4f46e5;
}

.unlock-toggle input:checked + .unlock-toggle-ui::after {
    transform: translateX(18px);
}

.unlock-toggle input:focus-visible + .unlock-toggle-ui {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.unlock-toggle input:checked ~ .unlock-toggle-text {
    color: #4f46e5;
}

@media (max-width: 767.98px) {
    .field-with-unlock-row input[type="text"],
    .field-with-unlock-row input[type="date"] {
        max-width: none;
    }
}

#logoPreviewContainer,
#logoSitePreviewContainer {
    width: 80px;
    height: 80px;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

#logoPreview,
#logoSitePreview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.form-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-principal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 25px;
    background-color: #478ac9;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.btn-principal:hover {
    background-color: #2d6ca8;
}

.btn-principal:active {
    transform: translateY(1px);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 25px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-danger:active {
    transform: translateY(1px);
}

.action-btn-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.btn-principal:disabled,
.btn-danger:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

@media (min-width: 768px) {
    .btn-principal,
    .btn-danger {
        width: auto;
        min-width: 300px;
        padding: 12px 40px;
    }
}
