/**
 * Popup Block - Frontend Styles
 * Version 1.0
 */

/* ===== Popup Block Container ===== */
.cpc-popup-block {
    position: relative;
}

/* Trigger Wrapper - Klickbar machen */
.cpc-popup-trigger-wrapper {
    cursor: pointer;
    display: inline-block;
}

.cpc-popup-trigger-wrapper:hover {
    opacity: 0.9;
}

/* Trigger innerer Content */
.cpc-popup-trigger-wrapper .cpc-popup-trigger {
    pointer-events: none;
}

/* Content Wrapper - versteckt bis Popup öffnet */
.cpc-popup-content-wrapper {
    display: none !important;
}

/* ===== Popup Overlay ===== */
.cpc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cpc-popup-overlay.cpc-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* ===== Popup Container ===== */
.cpc-popup-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.3s ease;
}

.cpc-popup-overlay.cpc-popup-visible .cpc-popup-container {
    transform: scale(1) translateY(0);
}

/* ===== Close Button ===== */
.cpc-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: #666;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.cpc-popup-close:hover {
    background: #e8e8e8;
    color: #333;
    transform: scale(1.05);
}

.cpc-popup-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ===== Popup Content Styling ===== */
.cpc-popup-container .cpc-popup-content-inner {
    padding-top: 8px;
}

.cpc-popup-container h1,
.cpc-popup-container h2,
.cpc-popup-container h3,
.cpc-popup-container h4,
.cpc-popup-container h5,
.cpc-popup-container h6 {
    margin-top: 0;
    margin-bottom: 0.75em;
}

.cpc-popup-container p {
    margin-bottom: 1em;
    line-height: 1.7;
}

.cpc-popup-container p:last-child {
    margin-bottom: 0;
}

.cpc-popup-container ul,
.cpc-popup-container ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.cpc-popup-container li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.cpc-popup-container img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.cpc-popup-container a {
    color: #0073aa;
    text-decoration: underline;
}

.cpc-popup-container a:hover {
    color: #005177;
}

/* ===== Scrollbar Styling ===== */
.cpc-popup-container::-webkit-scrollbar {
    width: 8px;
}

.cpc-popup-container::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.cpc-popup-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.cpc-popup-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ===== Body Lock ===== */
body.cpc-popup-open {
    overflow: hidden;
}

/* ===== Responsive Anpassungen ===== */
@media (max-width: 768px) {
    .cpc-popup-overlay {
        padding: 16px;
    }
    
    .cpc-popup-container {
        padding: 24px;
        max-height: 90vh;
        border-radius: 8px;
    }
    
    .cpc-popup-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .cpc-popup-overlay {
        padding: 12px;
    }
    
    .cpc-popup-container {
        padding: 20px;
        padding-top: 48px;
    }
}

/* ===== Animationen ===== */
@keyframes cpc-popup-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes cpc-popup-scaleIn {
    from {
        transform: scale(0.92) translateY(20px);
    }
    to {
        transform: scale(1) translateY(0);
    }
}

/* ===== Fokus-Trap für Accessibility ===== */
.cpc-popup-container:focus {
    outline: none;
}

.cpc-popup-container [tabindex="-1"]:focus {
    outline: none;
}
