/* --- Main Widget --- */
#ssaw-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}
.sprout-body {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: pointer;
    filter: drop-shadow(0px 0px 10px #2e7d32);
    transition: transform 0.3s ease, filter 0.3s ease;
}
.sprout-body::after {
    content: '';
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    filter: blur(8px);
    z-index: -1;
    transition: opacity 0.3s ease;
}
.sprout-video {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; opacity: 0; transition: opacity 0.2s ease-in-out;
}
.sprout-video.is-visible { opacity: 1; }

/* --- Easter Egg State --- */
#ssaw-widget.easter .sprout-body {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px #ffd700);
}

/* --- Small Chat Bubble --- */
.ssaw-bubble {
    background: white;
    color: black;
    padding: 12px 18px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    font-size: 16px;
    max-width: 220px;
    margin-right: 10px;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    position: relative;
    margin-bottom: 20px;
}
.ssaw-bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    margin-top: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

/* --- Modal Styles --- */
.ssaw-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 10000;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.ssaw-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 400px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    opacity: 0; pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.ssaw-modal-overlay.is-open,
.ssaw-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}
.ssaw-modal.is-open {
    transform: translateY(0) scale(1);
}

/* --- UPDATED: Improved styling for the modal close button --- */
.ssaw-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;   
    border: none;
    border-radius: 0%;
    width: 32px;       
    height: 32px;
    font-size: 18px;   
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;

    /* --- FIX: Use Flexbox for robust centering --- */
    display: flex;
    align-items: center;    /* Vertical centering */
    justify-content: center; /* Horizontal centering */
    
    /* Nudge the 'X' up slightly for better optical alignment */
    padding-bottom: 11px; 
}

.ssaw-modal-close:hover {
    background: #27AE60; /* Darker background on hover */
}

.ssaw-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}
.ssaw-modal-header h2 {
    margin: 0;
    font-size: 18px;
}
.ssaw-modal-content {
    padding: 20px;
    overflow-y: auto;
}
.ssaw-contextual-box {
    background: #e7f5ff; border: 1px solid #b3d9ff;
    padding: 15px; border-radius: 8px; margin-bottom: 20px;
}
.ssaw-contextual-box h3 { margin-top: 0; }
.ssaw-qa-item {
    border-bottom: 1px solid #eee;
}
.ssaw-qa-question {
    padding: 15px 0;
    cursor: pointer;
    font-weight: bold;
    position: relative;
    padding-right: 20px;
}
.ssaw-qa-question::after {
    content: '▼';
    position: absolute; right: 0; top: 15px;
    font-size: 10px; color: #888;
    transition: transform 0.2s ease;
}
.ssaw-qa-item.active .ssaw-qa-question::after {
    transform: rotate(180deg);
}
.ssaw-qa-answer {
    display: none;
    padding-bottom: 15px;
    line-height: 1.6;
}
.ssaw-qa-answer a {
    display: inline-block;
    margin-top: 10px;
    background: #0073aa; color: #fff;
    padding: 5px 10px; border-radius: 5px; text-decoration: none;
}

/* --- Mobile & Tablet Styles --- */
@media (max-width: 768px) {
    .ssaw-bubble {
        display: none;
    }
    .ssaw-modal {
        bottom: 0; right: 0;
        width: 100%; height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}