/* Popup utilisateur (messages, erreurs, etc.) */
.user-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 2100;
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.user-popup-overlay.open {
    display: flex;
}

.user-popup {
    background: #fff;
    border-radius: 14px;
    width: min(92vw, 560px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.user-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.user-popup-head h3 {
    font-size: .95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color-dark, #111827);
}

.user-popup-close {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #6b7280;
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.user-popup-close:hover {
    background: #f3f4f6;
}

.user-popup-body {
    padding: 1rem 1.2rem;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.user-popup-message {
    width: 100%;
    min-height: 180px;
    max-height: 50vh;
    resize: vertical;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .75rem .85rem;
    font-family: Inconsolata, Consolas, monospace;
    font-size: .82rem;
    line-height: 1.45;
    color: #1f2937;
    background: #f9fafb;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

.user-popup-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
    padding: .85rem 1.2rem 1rem;
    border-top: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.user-popup-btn {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .5rem 1rem;
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    color: #374151;
    transition: background .15s, border-color .15s;
}

.user-popup-btn:hover {
    background: #f9fafb;
}

.user-popup-btn-copy {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.user-popup-btn-copy:hover {
    background: #dbeafe;
}

.user-popup-btn-copy.copied {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.user-popup-overlay.is-error .user-popup-head h3 {
    color: #b91c1c;
}

[data-theme="dark"] .user-popup {
    background: #1f2937;
}

[data-theme="dark"] .user-popup-head {
    border-bottom-color: #374151;
}

[data-theme="dark"] .user-popup-head h3 {
    color: #f9fafb;
}

[data-theme="dark"] .user-popup-message {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .user-popup-foot {
    border-top-color: #374151;
}

[data-theme="dark"] .user-popup-btn {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] .user-popup-btn-copy {
    background: #1e3a5f;
    border-color: #2563eb;
    color: #bfdbfe;
}
