/**
 * Exit Intent Overlay Styling
 * Verwendet Tabler.io Framework - keine custom CSS außer Animationen
 */

/* ==================== BACKDROP ==================== */
.exit-intent-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    animation: fadeIn 0.3s ease-out;
}

/* Dark Mode Support */
[data-bs-theme="dark"] .exit-intent-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

/* ==================== MODAL ==================== */
.exit-intent-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--tblr-bg-surface);
    border-radius: var(--tblr-border-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 9999;
    animation: slideUp 0.4s ease-out;
}

/* Mobile: Fullscreen modal (no gray backdrop visible) */
@media (max-width: 576px) {
    .exit-intent-modal {
        max-width: 100vw;
        max-height: 100vh;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }

    /* Hide backdrop on mobile since modal is fullscreen */
    .exit-intent-backdrop {
        display: none;
    }
}

/* Dark Mode Support */
[data-bs-theme="dark"] .exit-intent-modal {
    background: var(--tblr-dark);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* ==================== RESPONSIVE WIDTHS ==================== */
@media (min-width: 576px) and (max-width: 767px) {
    .exit-intent-modal {
        max-width: 85vw;
        max-height: 82vh;
    }

    /* Tablet: Slightly smaller H1 */
    .exit-intent-modal h1.display-5 {
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    .exit-intent-modal {
        max-width: 700px;
    }
}

@media (min-width: 992px) {
    .exit-intent-modal {
        max-width: 750px;
    }
}

/* ==================== CLOSE BUTTON ==================== */
.exit-intent-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--tblr-muted);
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--tblr-border-radius);
    transition: all 0.2s ease;
    z-index: 10000;
}

.exit-intent-close:hover {
    background: var(--tblr-bg-surface-secondary);
    color: var(--tblr-body-color);
    transform: rotate(90deg);
}

[data-bs-theme="dark"] .exit-intent-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

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

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
}

/* Closing Animations */
.exit-intent-backdrop.closing {
    animation: fadeOut 0.3s ease-out forwards;
}

.exit-intent-modal.closing {
    animation: slideDown 0.3s ease-out forwards;
}

/* ==================== CARD LINK HOVER ==================== */
.card-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.card-link:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .card-link:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ==================== PROGRESS BAR STYLING ==================== */
.exit-intent-modal .progress {
    height: 1.5rem;
    border-radius: var(--tblr-border-radius);
    overflow: hidden;
}

.exit-intent-modal .progress-bar {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.6s ease;
}

/* ==================== MOBILE OPTIMIZATIONS ==================== */
@media (max-width: 576px) {
    /* Smaller padding on mobile */
    .exit-intent-modal .p-5 {
        padding: 1.5rem !important;
    }

    .exit-intent-modal .p-4 {
        padding: 1.25rem !important;
    }

    /* H1 smaller on mobile (like homepage) */
    .exit-intent-modal h1.display-5 {
        font-size: 1.5rem !important;
    }

    /* Lead text smaller */
    .exit-intent-modal .lead {
        font-size: 1rem !important;
    }

    /* Stack buttons vertically on mobile */
    .exit-intent-modal .d-flex.gap-3 {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .exit-intent-modal .btn-lg {
        width: 100%;
        padding: 0.75rem 1.5rem;
    }

    /* Smaller gradient icons in H1 */
    .exit-intent-modal .gradient-text i {
        font-size: 1em !important;
    }

    /* Smaller standalone icons */
    .exit-intent-modal i[style*="font-size: 96px"] {
        font-size: 48px !important;
    }

    .exit-intent-modal i[style*="font-size: 64px"] {
        font-size: 40px !important;
    }

    .exit-intent-modal i[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }

    /* Cards max-width on mobile */
    .exit-intent-modal .card[style*="max-width"] {
        max-width: 100% !important;
    }

    /* Smaller text in cards */
    .exit-intent-modal .card-body {
        padding: 1rem !important;
    }

    /* Price display smaller */
    .exit-intent-modal .h2 {
        font-size: 1.5rem !important;
    }

    /* Row spacing on mobile */
    .exit-intent-modal .row.g-3 {
        gap: 0.75rem !important;
    }
}

/* ==================== ACCESSIBILITY ==================== */
.exit-intent-modal:focus {
    outline: 2px solid var(--tblr-primary);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .exit-intent-backdrop,
    .exit-intent-modal,
    .exit-intent-close,
    .card-link {
        animation: none;
        transition: none;
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
.exit-intent-modal::-webkit-scrollbar {
    width: 8px;
}

.exit-intent-modal::-webkit-scrollbar-track {
    background: var(--tblr-bg-surface-secondary);
    border-radius: var(--tblr-border-radius);
}

.exit-intent-modal::-webkit-scrollbar-thumb {
    background: var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
}

.exit-intent-modal::-webkit-scrollbar-thumb:hover {
    background: var(--tblr-muted);
}

/* ==================== CTA BUTTON TRACKING ==================== */
/* Diese Klassen werden für Matomo-Tracking verwendet */
.exit-intent-cta-primary {
    /* Hauptaktion (Quiz starten, Programm kaufen, etc.) */
}

.exit-intent-cta-secondary {
    /* Sekundäre Aktion (Zurück, Vielleicht später, etc.) */
}

/* ==================== TEST MODE INDICATOR ==================== */
.exit-intent-test-mode {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #f59f00;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.exit-intent-test-mode::before {
    content: "🧪 ";
}
