/**
 * Frontend styles for Custom Schedulable Popup
 */

/* Overlay Container */
.csp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999; /* Ensure it is above headers, chats, menus, etc. */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.csp-overlay.csp-active {
    opacity: 1;
    visibility: visible;
}

/* Popup Box */
.csp-popup {
    position: relative;
    width: 90%;
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 
                0 0 40px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.csp-overlay.csp-active .csp-popup {
    transform: scale(1) translateY(0);
}

/* Image Column */
.csp-image-col {
    flex: 1 1 50%;
    position: relative;
    overflow: hidden;
    min-height: 100%;
}

.csp-image-col img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Content Column */
.csp-content-col {
    flex: 1 1 50%;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

/* Layout variation when there is no image */
.csp-popup.csp-no-image {
    max-width: 580px;
}

.csp-popup.csp-no-image .csp-content-col {
    flex: 1 1 100%;
    align-items: center;
    text-align: center;
    padding: 50px 40px;
}

/* Text elements styling */
.csp-title {
    font-size: 28px;
    font-weight: 750;
    margin: 0 0 16px 0;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.csp-message {
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 28px 0;
}

.csp-message p {
    margin: 0 0 12px 0;
}

.csp-message p:last-child {
    margin-bottom: 0;
}

.csp-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* CTA Button */
.csp-cta {
    display: inline-block;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.csp-popup.csp-no-image .csp-cta {
    align-self: center;
}

.csp-cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.csp-cta:active {
    transform: translateY(0);
}

/* Close Button styling */
.csp-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.csp-close-btn:hover {
    background: rgba(15, 23, 42, 0.12);
    transform: scale(1.05);
}

/* Adapt close button when background is dark or floats over image on mobile */
.csp-close-btn-light {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.csp-close-btn-light:hover {
    background: rgba(255, 255, 255, 0.35);
}

.csp-close-icon {
    width: 20px;
    height: 20px;
}

/* Responsive queries */
@media (max-width: 768px) {
    .csp-popup {
        flex-direction: column;
        width: 88%;
        max-width: 450px !important; /* Force smaller size on mobile */
    }

    .csp-image-col {
        flex: 0 0 180px;
        min-height: 180px;
    }
    
    .csp-content-col {
        flex: 1 1 auto;
        padding: 30px 24px;
        align-items: center;
        text-align: center;
    }

    .csp-popup.csp-no-image .csp-content-col {
        padding: 40px 24px;
    }

    .csp-title {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .csp-message {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .csp-cta {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 24px;
    }

    .csp-close-btn {
        top: 12px;
        right: 12px;
        /* Make close button clear and visible over image or text */
        background: rgba(255, 255, 255, 0.9);
        color: #0f172a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .csp-close-btn:hover {
        background: #ffffff;
    }
}

/* Small devices optimization */
@media (max-width: 480px) {
    .csp-image-col {
        flex: 0 0 140px;
        min-height: 140px;
    }
    
    .csp-title {
        font-size: 20px;
    }
}
