/* WDialog Styles */

.w-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
}

.w-dialog {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: none;
    flex-direction: column;
    min-width: 300px;
    /* size to content by default ; capped to the viewport so a dialog never
       overflows the screen - .w-dialog-content (flex:1, overflow:auto) then
       becomes the part that scrolls once the cap is hit */
    height: auto;
    max-width: 95vw;
    max-height: 95vh;
    transition: opacity 0.2s;
}

.w-dialog-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    cursor: move;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;  /* Ne pas réduire */

}

.w-dialog-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.w-dialog-controls {
    display: flex;
    gap: 5px;
}

.w-dialog-minimize,
.w-dialog-maximize,
.w-dialog-close {
    background: #b47eed;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.w-dialog-minimize:hover,
.w-dialog-maximize:hover,
.w-dialog-close:hover {
    background: #e0e0e0;
}

.w-dialog-close:hover {
    background: #ff4444;
    color: white;
}

.w-dialog-content {
    padding: 20px;
    flex: 1;
    overflow: auto;
    min-height: 0;   /* ← Important pour overflow */
    min-width: 0;   /* ← Important pour overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* messages d'erreur ajax bruts (ex. ajaxclass.js "error()") sont rendus dans un <pre> :
   sans ceci le texte garde son retour à ligne "white-space: pre" par défaut et déborde
   hors du dialogue au lieu de s'adapter à sa largeur (trouvé 2026-09-09) */
.w-dialog-content pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.w-dialog-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;  /* Ne pas réduire */    
}

.w-btn-ok,
.w-btn-cancel {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background: white;
    font-size: 14px;
    transition: all 0.2s;
}

.w-btn-ok {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.w-btn-ok:hover {
    background: #764ba2;
    border-color: #764ba2;
}

.w-btn-cancel {
    background: white;
    color: #333;
}

.w-btn-cancel:hover {
    background: #f0f0f0;
}

.w-prompt-input {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.w-dialog.minimized {
    height: auto !important;
}

.w-dialog.maximized {
    border-radius: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .w-dialog {
        max-width: 99vw !important;
        max-height: 99vh !important;
    }
    .w-dialog-content {
        padding: 5px;
        overflow: auto;
        max-height: none;
        min-height: 0;   /* ← Important pour overflow */
    }    
    
}

.w-btn-custom {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background: white;
    font-size: 14px;
    transition: all 0.2s;
    color: #333;
}

.w-btn-custom:hover {
    background: #f0f0f0;
    border-color: #999;
}

.w-btn-custom:active {
    background: #e0e0e0;
}

/* Dialogs inactifs (bloqués par un modal) */
.w-dialog:disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* Prompt input */
.w-prompt-input {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.w-btn-custom {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    background: white;
    font-size: 14px;
    transition: all 0.2s;
    color: #333;
}

.w-btn-custom:hover {
    background: #f0f0f0;
    border-color: #999;
}

.w-btn-custom:active {
    background: #e0e0e0;
}

/* print() forms */
.w-print-row {
    margin-bottom: 12px;
}

.w-print-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

/* checkbox rows : label left, checkbox pinned to the right edge (2026-08-31, à la
   demande de l'utilisateur - "Paramètres" a plusieurs libellés longs qui poussaient leur
   case juste après le texte, plutôt que sur une colonne commune) */
.w-print-row-boolean,
.w-print-row-boolON {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.w-print-row-boolean .w-print-label,
.w-print-row-boolON .w-print-label {
    display: inline;
    margin-bottom: 0;
    flex: 1 1 auto;
}

input.w-print-input,
select.w-print-input,
textarea.w-print-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

input[type="checkbox"].w-print-input {
    width: auto;
    flex: none;
}

.w-print-info {
    font-size: 14px;
    color: #7e71fa;
}

.w-print-error {
    font-size: 13px;
    color: #f59e95;
}

/* Resize handle */
.w-dialog-resizer {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #667eea 50%);
    border-radius: 0 0 8px 0;
}

.w-dialog-resizer:hover {
    background: linear-gradient(135deg, transparent 50%, #764ba2 50%);
}