/* ============================================================
   Crédit Info — Design system des modals / pop-ups
   ============================================================ */

@keyframes ciModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ciModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---- Overlay ---- */
.ci-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: ciModalFadeIn 0.22s ease-out;
}

.ci-modal-overlay.hidden {
    display: none !important;
}

.ci-modal-overlay--scroll {
    align-items: flex-start;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* Panneau auto-stylé (enfant direct) */
.ci-modal-overlay > div {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow:
        0 25px 50px -12px rgba(15, 23, 42, 0.28),
        0 0 0 1px rgba(148, 163, 184, 0.12);
    animation: ciModalSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* ---- Panneaux explicites ---- */
.ci-modal-panel {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow:
        0 25px 50px -12px rgba(15, 23, 42, 0.28),
        0 0 0 1px rgba(148, 163, 184, 0.12);
    animation: ciModalSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.ci-modal-panel--sm { max-width: 28rem; }
.ci-modal-panel--md { max-width: 32rem; }
.ci-modal-panel--lg { max-width: 56rem; }
.ci-modal-panel--xl { max-width: 72rem; }

/* ---- En-tête / corps / pied ---- */
.ci-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.ci-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.ci-modal-body {
    padding: 1.25rem 1.5rem;
}

.ci-modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.ci-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ci-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

/* ---- Icônes contextuelles ---- */
.ci-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ci-modal-icon.hidden {
    display: none !important;
}

.ci-modal-icon--warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.18);
}

.ci-modal-icon--success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18);
}

.ci-modal-icon--danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #b91c1c;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.16);
}

.ci-modal-icon--info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.16);
}

.ci-modal-icon--loading {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.16);
}

/* Renfort visuel des icônes rondes existantes dans les modals */
.ci-modal-overlay .rounded-full.flex.items-center.justify-center[class*="w-10"],
.ci-modal-overlay .rounded-full.flex.items-center.justify-center[class*="h-10"],
.ci-modal-overlay .rounded-full.flex.items-center.justify-center[class*="w-12"],
.ci-modal-overlay .rounded-full.flex.items-center.justify-center[class*="h-12"] {
    width: 3rem !important;
    height: 3rem !important;
    font-size: 1.15rem;
}

.ci-modal-overlay .bg-amber-100.rounded-full { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.18); }
.ci-modal-overlay .bg-green-100.rounded-full { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18); }
.ci-modal-overlay .bg-red-100.rounded-full { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.16); }
.ci-modal-overlay .bg-blue-100.rounded-full { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.16); }

/* ---- Boutons ---- */
.ci-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ci-modal-btn--secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.ci-modal-btn--secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.ci-modal-btn--primary {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.ci-modal-btn--primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.42);
    transform: translateY(-1px);
}

.ci-modal-btn--danger {
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.32);
}

.ci-modal-btn--danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-1px);
}

.ci-modal-btn--warning {
    color: #ffffff;
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.32);
}

.ci-modal-btn--warning:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    transform: translateY(-1px);
}

.ci-modal-btn--success {
    color: #ffffff;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.32);
}

.ci-modal-btn--success:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
}

/* Amélioration des boutons Tailwind existants dans les modals */
.ci-modal-overlay button.bg-blue-600,
.ci-modal-overlay a.bg-blue-600 {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    border: none;
    transition: all 0.2s ease;
}

.ci-modal-overlay button.bg-blue-600:hover,
.ci-modal-overlay a.bg-blue-600:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38);
}

.ci-modal-overlay button.bg-red-600,
.ci-modal-overlay button.bg-orange-600,
.ci-modal-overlay button.bg-green-600,
.ci-modal-overlay button.bg-amber-600 {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    transition: all 0.2s ease;
}

.ci-modal-overlay button.bg-red-600:hover,
.ci-modal-overlay button.bg-orange-600:hover,
.ci-modal-overlay button.bg-green-600:hover,
.ci-modal-overlay button.bg-amber-600:hover {
    transform: translateY(-1px);
}

.ci-modal-overlay button.bg-gray-300,
.ci-modal-overlay button.border-gray-300 {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

.ci-modal-overlay button.bg-gray-300:hover,
.ci-modal-overlay button.border-gray-300:hover {
    background: #f1f5f9 !important;
}

/* Texte des modals de confirmation */
.ci-modal-message {
    color: #475569;
    font-size: 0.925rem;
    line-height: 1.6;
}
