/* ===================================
   SECTION EDITOR - Modal & Button Styles
   =================================== */

/* Section positioning - all sections must have position context for absolute-positioned edit button */
section[data-section] {
    position: relative;
}

/* EDIT BUTTON - Coin haut droit */
.section-edit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-link);
    color: var(--color-bg);
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.section-edit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.section-edit-btn:active {
    transform: scale(0.95);
}

/* Afficher le bouton si la section est marquée comme éditable */
section.can-edit .section-edit-btn {
    display: flex;
}

/* MODAL - Conteneur principal */
.section-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.section-editor-modal.active {
    display: flex;
}

/* Contenu de la modale */
.section-editor-content {
    background: var(--color-bg);
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-editor-content h2 {
    margin: 0 0 25px 0;
    color: var(--color-link);
    font-size: 24px;
    font-weight: 600;
}

.section-editor-content p {
    margin: 0 0 20px 0;
    color: var(--color-text);
    opacity: 0.8;
    font-size: 14px;
}

/* FORMULAIRE */
.section-editor-form {
    margin-bottom: 25px;
}

.section-editor-field {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.section-editor-field label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
    font-size: 14px;
}

.section-editor-field input,
.section-editor-field textarea {
    padding: 10px 12px;
    border: 1px solid var(--color-surface);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.2s;
}

.section-editor-field input:focus,
.section-editor-field textarea:focus {
    outline: none;
    border-color: var(--color-link);
    box-shadow: 0 0 0 2px rgba(var(--color-link-rgb), 0.1);
}

.section-editor-field textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
}

/* BOUTONS */
.section-editor-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    border-top: 1px solid var(--color-surface);
    padding-top: 20px;
}

.section-editor-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-save {
    background: var(--color-link);
    color: var(--color-bg);
}

.btn-save:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-save:active {
    transform: translateY(0);
}

.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    background: var(--color-surface);
    color: var(--color-text);
}

.btn-cancel:hover {
    opacity: 0.8;
    background: var(--color-surface);
}

/* MESSAGES */
.section-editor-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.section-editor-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border-left: 4px solid #4CAF50;
    display: block;
}

.section-editor-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
    border-left: 4px solid #F44336;
    display: block;
}

/* LOADING STATE */
.section-editor-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--color-text);
    opacity: 0.6;
}

.section-editor-loading.active {
    display: block;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .section-editor-content {
        max-width: 95%;
        padding: 20px;
    }

    .section-editor-buttons {
        flex-direction: column-reverse;
    }

    .section-editor-buttons button {
        width: 100%;
    }

    .section-edit-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}