/* ═════════════════════════════════════════════════════════════
   Forminator Djomy Integration – Waiting Overlay Styles (v2)
   Popup strategy: Djomy opens in a popup window, this overlay
   shows on the form page while polling for payment status.
   ═════════════════════════════════════════════════════════════ */

/* ── Overlay backdrop ── */
#fdi-waiting-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fdi-fade-in 0.3s ease;
    padding: 20px;
}

@keyframes fdi-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Card ── */
#fdi-waiting-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 40px 36px 32px;
    text-align: center;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 40px 100px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    animation: fdi-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

@keyframes fdi-slide-up {
    from { transform: translateY(50px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Success / error state modifiers */
#fdi-waiting-card.fdi-card-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #bbf7d0;
}

#fdi-waiting-card.fdi-card-error {
    background: linear-gradient(135deg, #fff1f2 0%, #fff5f5 100%);
    border: 2px solid #fecdd3;
}

/* ── Top accent bar ── */
#fdi-waiting-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f6af5, #8b5cf6, #ec4899);
    border-radius: 24px 24px 0 0;
    transition: background 0.4s ease;
}

#fdi-waiting-card.fdi-card-success::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

#fdi-waiting-card.fdi-card-error::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* ── Animated payment icon ── */
.fdi-payment-icon {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fdi-icon-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: fdi-spin-ring linear infinite;
}

.fdi-ring-1 {
    inset: 0;
    border-top-color: #4f6af5;
    border-right-color: #4f6af530;
    animation-duration: 1.2s;
}

.fdi-ring-2 {
    inset: 8px;
    border-top-color: #8b5cf6;
    border-right-color: #8b5cf630;
    animation-duration: 1.8s;
    animation-direction: reverse;
}

.fdi-ring-3 {
    inset: 16px;
    border-top-color: #ec4899;
    border-right-color: #ec489930;
    animation-duration: 2.4s;
}

@keyframes fdi-spin-ring {
    to { transform: rotate(360deg); }
}

.fdi-icon-inner {
    position: relative;
    z-index: 1;
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: all 0.4s ease;
}

/* Success state stops the rings */
.fdi-card-success .fdi-icon-ring {
    animation: none;
    border-color: transparent;
}

.fdi-card-success .fdi-icon-inner,
.fdi-card-error .fdi-icon-inner {
    font-size: 36px;
    font-style: normal;
}

/* ── Title ── */
#fdi-wait-title {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 700;
    color: #1a1f3a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.02em;
}

.fdi-card-success #fdi-wait-title { color: #14532d; }
.fdi-card-error   #fdi-wait-title { color: #9f1239; }

/* ── Description ── */
#fdi-wait-desc {
    margin: 0 0 20px;
    font-size: 14px;
    color: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
}

.fdi-card-success #fdi-wait-desc { color: #166534; }
.fdi-card-error   #fdi-wait-desc { color: #be123c; }

/* ── Amount badge ── */
.fdi-amount-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #eef0ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    padding: 10px 24px;
    margin-bottom: 24px;
}

.fdi-amount-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6366f1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
}

.fdi-amount-value {
    font-size: 24px;
    font-weight: 700;
    color: #312e81;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.02em;
}

/* ── Animated dots ── */
.fdi-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.fdi-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4f6af5;
    animation: fdi-dot-pulse 1.4s ease-in-out infinite;
}

.fdi-dots span:nth-child(2) { animation-delay: 0.2s; }
.fdi-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes fdi-dot-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* ── Poll text ── */
.fdi-poll-text {
    font-size: 12px;
    color: #9ca3af;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0 0 24px;
    min-height: 1.4em;
}

/* ── Action buttons ── */
.fdi-wait-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.fdi-btn-secondary {
    background: linear-gradient(135deg, #4f6af5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79,106,245,0.35);
}

.fdi-btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,106,245,0.45);
}

.fdi-btn-secondary:active {
    transform: translateY(0);
}

.fdi-btn-cancel {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fdi-btn-cancel:hover {
    color: #ef4444;
    border-color: #fca5a5;
    background: #fff5f5;
}

/* ── Djomy branding footer ── */
.fdi-djomy-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
    font-size: 11px;
    color: #d1d5db;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ── Submit button loading state ("Paiement en cours…") ── */
.fdi-btn-loading {
    cursor: not-allowed !important;
    position: relative;
    background: linear-gradient(135deg, #3b5bdb 0%, #4f6af5 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    animation: fdi-btn-pulse 2s ease-in-out infinite !important;
    box-shadow: 0 4px 18px rgba(79, 106, 245, 0.45) !important;
    transform: none !important;
}

@keyframes fdi-btn-pulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(79, 106, 245, 0.45); }
    50%       { box-shadow: 0 4px 28px rgba(79, 106, 245, 0.70); }
}

.fdi-btn-loading::after {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fdi-spin 0.7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes fdi-spin {
    to { transform: rotate(360deg); }
}

/* Hide username and password fields if logged in */
body.logged-in .forminator-row:has(input[name*="username"]),
body.logged-in .forminator-row:has(input[name*="utilisateur"]),
body.logged-in .forminator-row:has(input[placeholder*="Jacques"]),
body.logged-in .forminator-row:has(input[name*="password"]),
body.logged-in .forminator-row:has(input[name*="confirm_password"]),
body.logged-in .forminator-field:has(input[name*="username"]),
body.logged-in .forminator-field:has(input[name*="utilisateur"]),
body.logged-in .forminator-field:has(input[placeholder*="Jacques"]),
body.logged-in .forminator-field:has(input[name*="password"]),
body.logged-in .forminator-field:has(input[name*="confirm_password"]) {
    display: none !important;
}
