/* ---------- Bandeau du mode édition ---------- */
/* top:32px est une valeur de secours : le script ajuste dynamiquement cette position
   selon la vraie hauteur de la barre noire de WordPress (32px ou 46px sur mobile). */
.ttp-banner {
    position: fixed;
    top: 32px;
    left: 0;
    right: 0;
    background: #1d2327;
    color: #fff;
    text-align: center;
    padding: 8px 12px;
    font-size: 13px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ttp-banner-warning {
    background: #b32d2e;
}

.ttp-ai-banner-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.ttp-ai-banner-btn:hover:not(:disabled) {
    background: #6d28d9;
}

.ttp-ai-banner-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.ttp-rescan-btn {
    background: #2271b1;
}

.ttp-rescan-btn:hover:not(:disabled) {
    background: #135e96;
}

/* ---------- Texte traduit (indicateur visible en mode édition uniquement) ---------- */
body.ttp-edit-active .ttp-text.ttp-translated {
    box-shadow: inset 0 -2px 0 #46b450;
}

/* Contour pointillé au survol, pour bien voir quel élément est traduisible (admin uniquement) */
body.ttp-edit-active .ttp-text:hover {
    outline: 2px dashed #2271b1;
    outline-offset: 2px;
    background-color: rgba(34, 113, 177, 0.08);
    border-radius: 2px;
}

/* ---------- Ancrage du stylo : tout élément traduisible (texte, champ, liste...) ---------- */
.ttp-pencil-anchor {
    position: relative;
}

body.ttp-edit-active .ttp-pencil-anchor:hover {
    outline: 2px dashed #2271b1;
    outline-offset: 2px;
    border-radius: 2px;
}

.ttp-pencil-anchor:hover > .ttp-pencil {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Encadrement serré autour d'un champ (input, select...) ---------- */
/* Épouse la taille exacte du champ, pour que le crayon reste collé à son coin */
.ttp-field-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

body.ttp-edit-active .ttp-field-wrap:hover {
    outline: 2px dashed #2271b1;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---------- Le stylo lui-même : coin haut-droit de l'élément survolé ---------- */
/* Légèrement À L'INTÉRIEUR du cadre (pas en dehors) : certains boutons ont
   overflow:hidden (ex: pilules arrondies avec avatar) qui couperait un stylo
   positionné en dehors de leurs limites, le rendant invisible. */
.ttp-pencil {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    padding: 0;
    border: 1px solid #2271b1;
    background: #fff;
    color: #2271b1;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.ttp-field-wrap:hover > .ttp-pencil {
    opacity: 1;
    pointer-events: auto;
}

.ttp-pencil {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttp-pencil:hover,
.ttp-pencil:focus {
    background: #2271b1;
    color: #fff;
    outline: none;
}

/* ---------- Champ "Choisir un fichier" personnalisé ---------- */
.ttp-file-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.ttp-file-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.ttp-file-label {
    display: inline-block;
    padding: 6px 14px;
    background: #f0f0f1;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.ttp-file-label:hover {
    background: #e0e0e1;
}

.ttp-file-name {
    font-size: 13px;
    color: #666;
}

/* ---------- Sélecteur de langue public ---------- */
.ttp-switcher {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
}

.ttp-switcher-btn {
    background: #1d2327;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.ttp-switcher-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-width: 160px;
}

.ttp-switcher.ttp-switcher-open .ttp-switcher-menu {
    display: block;
}

.ttp-switcher-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: none;
    background: #fff;
    cursor: pointer;
    color: #1d2327;
}

.ttp-switcher-option:hover {
    background: #f0f0f1;
}

.ttp-switcher-option.ttp-switcher-active {
    font-weight: 600;
    color: #2271b1;
}

/* ---------- Fenêtres modales ---------- */
.ttp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.ttp-modal.ttp-modal-open {
    display: flex;
}

.ttp-modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d2327;
    line-height: 1.5;
}

.ttp-modal-box-wide {
    max-width: 600px;
}

.ttp-modal-lang {
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    margin-bottom: 10px;
}

.ttp-modal-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ttp-modal-original {
    font-size: 13px;
    color: #444;
    margin-bottom: 14px;
    padding: 8px 10px;
    background: #f6f7f7;
    border-radius: 4px;
    max-height: 100px;
    overflow-y: auto;
}

.ttp-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.ttp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.ttp-modal-actions .ttp-btn-ai {
    margin-right: auto;
}

.ttp-btn {
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
    background: #f6f7f7;
    color: #1d2327;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
}

.ttp-btn-cancel:hover {
    background: #e0e0e1;
    border-color: #646970;
}

.ttp-btn-save {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.ttp-btn-save:hover {
    background: #135e96;
}

.ttp-btn-ai {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.ttp-btn-ai:hover:not(:disabled) {
    background: #6d28d9;
}

.ttp-btn-ai:disabled {
    opacity: 0.6;
    cursor: default;
}

.ttp-ai-status {
    font-size: 13px;
    color: #7c3aed;
    margin: 10px 0;
}

/* ---------- Liste d'options (select) dans la modale ---------- */
.ttp-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
}

.ttp-options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: center;
}

.ttp-options-original {
    font-size: 13px;
    color: #444;
    padding: 8px 10px;
    background: #f6f7f7;
    border-radius: 4px;
}

.ttp-options-input {
    box-sizing: border-box;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}
