/* ===========================================
   FORM-MODIFIER.CSS
   Styles mutualisés pour pages de modification
   (personnage, instance, article, etc.)
   
   Utilisé par :
   - apps/personnage/templates/personnage/pages/modifier.html
   - apps/geopolitique/politique/templates/politique/pages/modifier.html
   - apps/home/templates/home/article/modif.html
   =========================================== */

/* === RESPONSIVE LAYOUT POUR INFO BOX === */
@media (min-width: 769px) {
    .article-flow {
        position: relative;
        padding-right: calc(22rem + 12px);
    }

    #info_box {
        position: absolute;
        top: 0;
        right: 0;
        width: 22rem;
        margin: 0;
        float: none;
    }
}

/* === CHAMPS PRINCIPAUX (Nom, Type, etc.) === */
.main-selects {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.main-selects>div {
    flex: 1;
    min-width: 150px;
}

.main-selects label,
.main-selects .field label {
    font-weight: bold;
    color: #835a2b;
    display: block;
    margin-bottom: 0.3rem;
}

.main-selects select,
.main-selects input,
.main-selects textarea,
.main-selects .field input,
.main-selects .field select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.main-selects select:focus,
.main-selects input:focus,
.main-selects textarea:focus,
.main-selects .field input:focus,
.main-selects .field select:focus {
    outline: none;
    border-color: #835a2b;
    box-shadow: 0 0 0 2px rgba(131, 90, 43, 0.1);
}

.main-selects .field {
    flex: 1;
    min-width: 180px;
    font-size: 0.9rem;
}

/* === FAVORI TOGGLE === */
.favorite-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.favorite-toggle {
    color: #835a2b;
    font-size: 1.2rem;
    cursor: pointer;
}

/* === TAGS === */
.tags-container {
    margin: 0.5rem 0 1rem 0;
}

.tags-container label {
    font-weight: bold;
    color: #835a2b;
    display: block;
    margin-bottom: 0.3rem;
}

.tags-grid {
    column-count: 3;
    column-gap: 1.5rem;
    font-size: 0.9rem;
}

.tags-grid ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tags-grid li {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 0.2rem;
}

.tags-grid label {
    font-weight: normal;
    cursor: pointer;
}

@media (max-width: 768px) {
    .tags-grid {
        column-count: 1;
    }
}

/* === CONTENU MANUEL (TINYMCE) === */
.manual-content {
    margin: 2rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.manual-content textarea {
    width: 100%;
    min-height: 400px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
}

.manual-content textarea:focus {
    outline: none;
    border-color: #835a2b;
    box-shadow: 0 0 0 2px rgba(131, 90, 43, 0.1);
}

/* === SECTIONS D'ÉVÉNEMENTS/CHRYSANCES === */
.event-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.event-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.event-card h3,
.poste-card h3,
.event-card-compact h3 {
    color: #835a2b;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

.poste-card,
.event-card-compact {
    padding: 0.9rem;
    min-height: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.poste-card h3,
.event-card-compact h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.poste-card h3 button,
.event-card-compact h3 button {
    white-space: nowrap;
}

/* === GRILLE DATE === */
.date-grid {
    display: grid;
    grid-template-columns: 45% 50%;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 1rem;
}

.date-inputs-group {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
    grid-column: 1 / -1;
    margin-top: 0.5rem;
}

.date-field {
    flex: 1;
}

.date-field label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.2rem;
}

.date-field input,
.date-field select {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #f8f9fa;
}

.date-field input:focus,
.date-field select:focus {
    outline: none;
    border-color: #835a2b;
    box-shadow: 0 0 0 2px rgba(131, 90, 43, 0.1);
}

.year-input {
    max-width: 100px;
}

/* === BOUTONS === */
.generate-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    color: #fff;
    background: #6c757d;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.generate-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.generate-btn i {
    font-size: 0.9rem;
}

.add-btn {
    background-color: var(--Or3);
    color: white;
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-btn:hover {
    background-color: var(--Or1);
    opacity: 0.9;
    transform: translateY(-1px);
}

.add-event-card,
.add-poste-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

/* === INTERRUPTEURS TOGGLE === */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.9rem;
    color: #666;
}

.toggle-button {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: var(--Rouge3);
    border-radius: 20px;
    transition: background-color 0.3s;
    cursor: pointer;
    appearance: none;
    outline: none;
    border: 1px solid #ccc;
}

.toggle-button:checked {
    background-color: var(--Vert3);
    border: 1px solid #4CAF50;
}

.toggle-button::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-button:checked::before {
    transform: translateX(20px);
}

.toggle-input {
    display: none;
}

/* === FICHES === */
.grid-4-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.champ-wrapper {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
}

.champ-wrapper.active {
    font-size: 1rem;
}

.champ-wrapper label {
    color: #666;
    cursor: pointer;
}

.champ-wrapper.active label {
    color: #835a2b;
}

.champ-wrapper input {
    display: none;
}

.champ-wrapper.active input {
    display: block;
    margin-top: 0.3rem;
}

.fiche-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 1000px) {
    .fiche-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === FORMULAIRES D'ÉDITION === */
.poste-edit-form,
.event-edit-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.poste-edit-form label,
.event-edit-form label {
    font-size: 0.85rem;
    color: #666;
    font-weight: bold;
    margin-top: 0.5rem;
    display: block;
}

.poste-edit-form select,
.poste-edit-form input,
.event-edit-form select,
.event-edit-form input {
    margin-bottom: 0.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .date-grid {
        grid-template-columns: 1fr;
    }

    .date-inputs-group {
        flex-direction: column;
        align-items: stretch;
    }

    .generate-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

    .toggle-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-selects {
        flex-direction: column;
    }

    .main-selects>div {
        width: 100%;
    }
}