/* popup.css */
.popup,.popup-edit-design,.popup-export {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fond semi-transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    
}
.popup-more-options {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Fond semi-transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 11;
    
}

.div-transactions {
            position: fixed;
            top:5px;
            left:50%;
            background-color: rgba(0, 0, 0, 0.5); /* Fond semi-transparent */
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 10px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 5;
            display: flex;
            left: 50%;
    		transform: translateX(-50%); /* Centre horizontalement seulement */
            flex-wrap: wrap;
            gap: 5px;
            width: 350px;
            height: 120px;
            overflow:auto;
            /*transform: translateX(-50%);*/
        }

.popup.hidden,.popup-edit-design.hidden,.popup-export.hidden,.popup-more-options.hidden {
    display: none;
}



#dynamic-content-popup-edit-design,#dynamic-content-popup-export,
#dynamic-content-popup-more-options {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 5px;
}


/* Styles pour le popup de chargement */
#loadingPopup {
    display: none; /* Caché par défaut */
}
.loadingPopup-content {
    background-color: white;
    padding: 5px;
    border: 4mm ridge cyan;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position:relative;
    border-radius: 20px;
    width: 220px;
    height: 120px;
    text-align: center;
    position:relative;
    }
    
.loading-cadre {
    border: 4px solid cyan;
    position:relative;
    border-radius: 20px;
    width: 100%;
    height: 150px;
}
.loadingPopup-content img {
    position:relative;
    top: -30px;
    height: 100%;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid cyan;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingPopup .popup-content {
    text-align: center;
    padding: 20px;
}

#loadingPopup p {
    margin-top: 10px;
    font-size: 16px;
}


.overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
           background-image: url('/assets/icons/background/background_1.png');
           
        }


/* =========================================================
   POPUP DE MESSAGE (Succès / Erreur / Info / Warning)
   ========================================================= */

/* =========================================================
   POPUP DE MESSAGE — Design centré avec bouton OK
   ========================================================= */

.message-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: 90%;
    max-width: 360px;
    animation: messagePopupIn 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.message-popup.hidden {
    display: none;
}

@keyframes messagePopupIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes messagePopupOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.message-popup.closing {
    animation: messagePopupOut 0.2s ease-in forwards;
}

/* --- Conteneur --- */
.message-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 20px;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* --- Bandeau coloré en haut --- */
.message-popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
}

.message-popup.success .message-popup-content::before {
    background: linear-gradient(90deg, #3D8A5C, #4ADE80);
}

.message-popup.error .message-popup-content::before {
    background: linear-gradient(90deg, #DC2626, #F87171);
}

.message-popup.info .message-popup-content::before {
    background: linear-gradient(90deg, #0E7C86, #22D3EE);
}

.message-popup.warning .message-popup-content::before {
    background: linear-gradient(90deg, #F5941F, #FBBF24);
}

/* --- Icône centrée --- */
.message-popup-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    animation: iconPop 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.message-popup.success .message-popup-icon {
    background: #D1FAE5;
    color: #3D8A5C;
}

.message-popup.error .message-popup-icon {
    background: #FEE2E2;
    color: #DC2626;
    animation: iconShake 0.5s ease-out;
}

.message-popup.info .message-popup-icon {
    background: #E0F2FE;
    color: #0E7C86;
}

.message-popup.warning .message-popup-icon {
    background: #FEF3C7;
    color: #F5941F;
    animation: iconShake 0.5s ease-out;
}

@keyframes iconPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes iconShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* --- Titre --- */
.message-popup-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 8px;
}

/* --- Texte --- */
.message-popup-text {
    font-size: 13px;
    color: var(--color-gray-medium);
    line-height: 1.5;
    margin-bottom: 20px;
    word-wrap: break-word;
}

/* --- Bouton OK --- */
.message-popup-ok {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.message-popup.success .message-popup-ok {
    background: #3D8A5C;
    color: white;
}

.message-popup.success .message-popup-ok:hover {
    background: #2F6E48;
}

.message-popup.error .message-popup-ok {
    background: #DC2626;
    color: white;
}

.message-popup.error .message-popup-ok:hover {
    background: #B91C1C;
}

.message-popup.info .message-popup-ok {
    background: #0E7C86;
    color: white;
}

.message-popup.info .message-popup-ok:hover {
    background: #0A5F68;
}

.message-popup.warning .message-popup-ok {
    background: #F5941F;
    color: white;
}

.message-popup.warning .message-popup-ok:hover {
    background: #D97706;
}

.message-popup-ok i {
    font-size: 14px;
}

/* --- Barre de progression --- */
.message-popup-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--color-teal);
    border-radius: 0 0 0 var(--radius-lg);
    animation: messageProgress linear forwards;
}

.message-popup.success .message-popup-progress {
    background: #3D8A5C;
}

.message-popup.error .message-popup-progress {
    background: #DC2626;
}

.message-popup.warning .message-popup-progress {
    background: #F5941F;
}

@keyframes messageProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .message-popup {
        width: 92%;
        max-width: 340px;
    }
    
    .message-popup-content {
        padding: 28px 20px 18px;
    }
    
    .message-popup-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    
    .message-popup-title {
        font-size: 16px;
    }
}
        
/* =========================================================
   POPUP PRINCIPAL — Styles
   Conteneur de tous les popups de l'application.
   ========================================================= */

/* --- Overlay (fond sombre) --- */
@keyframes popupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Conteneur du popup --- */
.popup-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: popupSlideUp 0.25s ease-out;
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Bouton de fermeture --- */
.close-popup {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gray-light);
    color: var(--color-gray-medium);
    border-radius: 50%;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.close-popup:hover {
    background: #FEE2E2;
    color: #DC2626;
    transform: rotate(90deg);
}

/* --- Contenu dynamique --- */
#dynamic-content-popup {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-teal) var(--color-gray-light);
}

#dynamic-content-popup::-webkit-scrollbar {
    width: 6px;
}

#dynamic-content-popup::-webkit-scrollbar-track {
    background: var(--color-gray-light);
}

#dynamic-content-popup::-webkit-scrollbar-thumb {
    background: var(--color-teal);
    border-radius: 3px;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
    #popup {
        padding: 0;
        align-items: flex-end;
    }

    .popup-content {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: popupSlideUpMobile 0.3s ease-out;
    }

    @keyframes popupSlideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .close-popup {
        top: 10px;
        right: 10px;
    }
}

/* =========================================================
   STRUCTURE INTERNE DES VUES POPUP
   ========================================================= */

/* Header fixe */
.popup-view-header {
    flex-shrink: 0; /* Ne rétrécit pas */
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--color-gray-border);
    background: var(--color-white);
    z-index: 2;
}

.popup-view-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 2px;
}

.popup-view-subtitle {
    font-size: 12px;
    color: var(--color-gray-medium);
}

/* Body scrollable */
.popup-view-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Footer fixe (collé en bas) */
.popup-view-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid var(--color-gray-border);
    background: var(--color-gray-light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}


/* =========================================================
   POPUP DE CONFIRMATION
   ========================================================= */

.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    width: 90%;
    max-width: 380px;
    animation: confirmPopupIn 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.confirm-dialog.hidden {
    display: none;
}

@keyframes confirmPopupIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes confirmPopupOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.confirm-dialog.closing {
    animation: confirmPopupOut 0.2s ease-in forwards;
}

/* --- Conteneur --- */
.confirm-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 20px;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* --- Bandeau coloré en haut --- */
.confirm-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #F5941F, #FBBF24);
}

/* --- Icône --- */
.confirm-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #FEF3C7;
    color: #F5941F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
    animation: iconPop 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes iconPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* --- Titre --- */
.confirm-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 8px;
}

/* --- Message --- */
.confirm-message {
    font-size: 13px;
    color: var(--color-gray-medium);
    line-height: 1.5;
    margin-bottom: 24px;
    word-wrap: break-word;
}

/* --- Boutons --- */
.confirm-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.confirm-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.confirm-btn i {
    font-size: 13px;
}

/* --- Bouton Annuler --- */
.cancel-btn {
    background: var(--color-gray-light);
    color: var(--color-ink);
}

.cancel-btn:hover {
    background: #E5E7EB;
}

/* --- Bouton Confirmer (par défaut : teal) --- */
.ok-btn {
    background: var(--color-teal);
    color: white;
}

.ok-btn:hover {
    background: #0A5F68;
}

/* --- Variante "danger" (rouge pour suppression) --- */
.confirm-dialog.danger .confirm-content::before {
    background: linear-gradient(90deg, #DC2626, #F87171);
}

.confirm-dialog.danger .confirm-icon {
    background: #FEE2E2;
    color: #DC2626;
}

.confirm-dialog.danger .ok-btn {
    background: #DC2626;
}

.confirm-dialog.danger .ok-btn:hover {
    background: #B91C1C;
}

/* --- Variante "success" (vert pour validation) --- */
.confirm-dialog.success .confirm-content::before {
    background: linear-gradient(90deg, #3D8A5C, #4ADE80);
}

.confirm-dialog.success .confirm-icon {
    background: #D1FAE5;
    color: #3D8A5C;
}

.confirm-dialog.success .ok-btn {
    background: #3D8A5C;
}

.confirm-dialog.success .ok-btn:hover {
    background: #2F6E48;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .confirm-dialog {
        width: 92%;
        max-width: 340px;
    }
    
    .confirm-content {
        padding: 28px 20px 18px;
    }
    
    .confirm-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }
    
    .confirm-title {
        font-size: 16px;
    }
}

/* =========================================================
   POPUP GLOBAL (saisie / formulaire)
   ========================================================= */
   #popup-content:has(#dynamic-content-global-popup .popup-view-body) {
    max-width: 400px;
    height: 85vh; /* Hauteur fixe pour forcer le scroll */
    display: flex;
    flex-direction: column;
}

#dynamic-content-global-popup {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden; /* Empêche le parent de scroller */
    height: 100%;
}

/* Le body du popup global est celui qui scrolle */
#dynamic-content-global-popup .popup-view-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important pour que le flex fonctionne */
}

/* =========================================================
   POPUP GLOBAL — Styles généraux pour inputs / boutons
   ========================================================= */


/* --- Labels --- */
.popup-view-body label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-ink);
    margin-bottom: 4px;
}

/* --- Inputs / Selects / Textarea --- */
.popup-view-body input,
.popup-view-body select,
.popup-view-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-gray-border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--color-ink);
    background: var(--color-white);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.popup-view-body input:focus,
.popup-view-body select:focus,
.popup-view-body textarea:focus {
    outline: none;
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.1);
}

.popup-view-body input::placeholder,
.popup-view-body textarea::placeholder {
    color: var(--color-gray-medium);
}

.popup-view-body input[dir="rtl"] {
    text-align: right;
}

/* --- Footer --- */
.popup-view-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-gray-border);
    background: var(--color-gray-light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* --- Boutons génériques --- */
.popup-view-footer .btn-primary,
.popup-view-footer .btn-secondary,
.popup-view-footer .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.popup-view-footer .btn-primary {
    background: var(--color-teal);
    color: white;
}

.popup-view-footer .btn-primary:hover {
    background: #0A5F68;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.popup-view-footer .btn-secondary {
    background: var(--color-white);
    color: var(--color-ink);
    border: 1px solid var(--color-gray-border);
}

.popup-view-footer .btn-secondary:hover {
    background: var(--color-gray-light);
    border-color: var(--color-teal);
    color: var(--color-teal);
}

.popup-view-footer .btn-danger {
    background: #DC2626;
    color: white;
}

.popup-view-footer .btn-danger:hover {
    background: #B91C1C;
    transform: translateY(-1px);
}

/* --- Gestion des erreurs de saisie --- */
.popup-view-body input.input-error,
.popup-view-body select.input-error {
    border-color: #DC2626;
    background-color: #FEF2F2;
}

.popup-view-body input.input-error:focus,
.popup-view-body select.input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-error-message {
    color: #DC2626;
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

.required {
    color: #DC2626;
    font-weight: bold;
    margin-left: 2px;
}
