/* Custom Site Modal Theme (Fantasy Tunisie) */
#custom-site-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 4, 20, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100000;
    display: none;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

#custom-site-modal-overlay.active {
    display: flex !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

.custom-site-modal {
    --cm-accent: linear-gradient(90deg, #a855f7, #6d28d9);
    --cm-tint: rgba(168, 85, 247, 0.16);
    --cm-ring: rgba(168, 85, 247, 0.35);
    --cm-icon: #d8b4fe;
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 30px 24px 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    background: linear-gradient(180deg, #1d0f3c, #140a2c);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    color: #ffffff;
    text-align: center;
    box-sizing: border-box;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Accent strip across the top, coloured by dialog type */
.custom-site-modal::before {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cm-accent);
    content: '';
}

/* Soft glow behind the icon */
.custom-site-modal::after {
    position: absolute;
    top: -90px;
    left: 50%;
    width: 240px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--cm-tint), transparent);
    transform: translateX(-50%);
    content: '';
    pointer-events: none;
}

.custom-site-modal.is-info {
    --cm-accent: linear-gradient(90deg, #22d3ee, #3b82f6);
    --cm-tint: rgba(34, 211, 238, 0.18);
    --cm-ring: rgba(34, 211, 238, 0.35);
    --cm-icon: #67e8f9;
}

.custom-site-modal.is-warning {
    --cm-accent: linear-gradient(90deg, #fbbf24, #f97316);
    --cm-tint: rgba(251, 191, 36, 0.18);
    --cm-ring: rgba(251, 191, 36, 0.35);
    --cm-icon: #fcd34d;
}

#custom-site-modal-overlay.active .custom-site-modal {
    transform: scale(1) translateY(0);
}

.custom-site-modal > * {
    position: relative;
    z-index: 1;
}

.custom-modal-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border: 1px solid var(--cm-ring);
    border-radius: 18px;
    background: var(--cm-tint);
    color: var(--cm-icon);
    font-size: 1.45rem;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.03), 0 10px 26px rgba(0, 0, 0, 0.35);
}

/* Legacy icon classes keep working, the colours now come from the dialog type */
.custom-modal-icon.confirm-icon,
.custom-modal-icon.warning-icon,
.custom-modal-icon.info-icon {
    border-color: var(--cm-ring);
    background: var(--cm-tint);
    color: var(--cm-icon);
}

.custom-modal-title {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 1.18rem;
    font-weight: 900;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.custom-modal-body {
    margin: 0 auto 22px;
    max-width: 320px;
    color: rgba(236, 226, 255, 0.72);
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
}

.custom-modal-input {
    width: 100%;
    height: 48px;
    margin-bottom: 18px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.custom-modal-input:focus {
    border-color: #c77dff;
    background: rgba(199, 125, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(199, 125, 255, 0.2);
}

.custom-modal-input::placeholder {
    color: rgba(236, 226, 255, 0.4);
    font-weight: 500;
}

.custom-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.custom-modal-btn {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.custom-modal-btn:focus-visible {
    outline: 2px solid #7ff0ff;
    outline-offset: 2px;
}

.custom-modal-btn.btn-cancel {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: rgba(236, 226, 255, 0.85);
}

.custom-modal-btn.btn-cancel:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.custom-modal-btn.btn-confirm {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: var(--ft-banner-gradient, linear-gradient(120deg, #7a1d4a 0%, #5b2a9a 55%, #3b1580 100%));
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(122, 29, 74, 0.4);
}

.custom-modal-btn.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(122, 29, 74, 0.5);
    filter: brightness(1.08);
}

@media (max-width: 480px) {
    .custom-site-modal {
        padding: 26px 18px 18px;
        border-radius: 20px;
    }
    .custom-modal-title {
        font-size: 1.08rem;
    }
    .custom-modal-body {
        font-size: 0.86rem;
    }
    .custom-modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}
