/* --- Main Overlay --- */
#ai-demo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Main Headline (Styling moved inline to PHP) --- */
.iad-main-headline {
    /* Styles are now in the PHP file to ensure they override theme defaults */
}

/* --- Input Area --- */
#ai-demo-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
}

#ai-demo-input-area input {
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #ccc;
    font-size: 15px;
    width: 100%;
    max-width: 200px; /* Controls input width */
}

#ai-demo-input-area button {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 15px;
    background-color: #ff8c00; /* Bright orange */
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#ai-demo-input-area button:hover {
    background-color: #e07b00; /* Darker orange */
}

/* --- Main Container --- */
#ai-demo-container {
    background-color: #E3CA94; /* Darker Tan/Beige */
    border-radius: 8px;
    position: relative;
    padding: 10px;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

/* --- Content Box (with white border) --- */
#ai-demo-content-box {
    border: 2px solid white;
    margin: 5px;
    height: 350px;
    overflow: hidden;
    position: relative;
}

/* --- Slider Wrapper --- */
#ai-demo-slider-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* --- Content Panels --- */
.ai-demo-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Styles for the top headers */
.ai-demo-panel .panel-header {
    color: white !important;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Inject emojis using CSS to bypass HTML encoding issues */
#header-after::before {
    content: '🎯 '; /* Target emoji + a space */
}
#header-before::before {
    content: '😴 '; /* Snoozing Face emoji + a space */
}

.ai-demo-panel h4 {
    margin-top: 0;
    color: #000080 !important; /* Navy Blue */
    font-size: 1.4em;
}

.ai-demo-panel p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #000000; /* Black */
}

/* Specific panel styles for static text effect */
.panel-after {
    z-index: 1; /* Base layer */
}

.panel-before {
    z-index: 3;
    background-color: #E3CA94;
    width: 100%; /* Panel is always full width */
    clip-path: inset(0 50% 0 0); /* Reveals the left 50% */
}

/* --- Slider Mechanism --- */
#ai-demo-slider-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: white;
    left: 50%;
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 4;
    pointer-events: none;
}

.ai-demo-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: transparent;
    outline: none;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 5;
    margin: 0;
    padding: 0;
    cursor: ew-resize;
}

/* Slider Thumb */
.ai-demo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #000080;
    border: 2px solid white;
    border-radius: 50%;
    cursor: ew-resize;
    margin-top: 0;
    position: relative;
    transform: translateY(-50%);
}

.ai-demo-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #000080;
    border: 2px solid white;
    border-radius: 50%;
    cursor: ew-resize;
}


/* --- Buttons --- */
#ai-demo-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 35px;
    height: 35px;
    background: white;
    border: 2px solid #E3CA94;
    border-radius: 50%;
    color: #333;
    font-size: 24px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    font-weight: bold;
}

#ai-demo-cta-btn, #ai-demo-limit-cta-btn {
    margin-top: 20px;
    padding: 15px 30px;
    background-color: #4CAF50; /* Green */
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    text-align: center;
}
#ai-demo-cta-btn:hover, #ai-demo-limit-cta-btn:hover {
    background-color: #45a049; /* Darker Green */
}

/* --- Notification Modals --- */
.ai-demo-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    background-color: rgba(0, 0, 0, 0.5);
}

.ai-demo-notification-content {
    background-color: #fff;
    color: #333;
    padding: 30px 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ai-demo-notification-content p {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #000080 !important; /* Navy Blue */
}

.ai-demo-notification-content span {
    font-size: 1em;
    color: #666;
}

#ai-demo-limit-cta-btn {
    margin-top: 15px;
}

/* --- REMOVED: Main style block for #iad-slider-graphic-guide as it's now inline in PHP --- */

/* This class is still needed for the JS to hide the element */
#iad-slider-graphic-guide.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}

#iad-slider-graphic-guide .iad-hand {
    font-size: 42px !important;
    margin: 0 10px !important;
    filter: grayscale(1) brightness(100); /* This line makes the emoji white */
}

/* --- NEW: Consolidated & Robust Mobile Responsive Styles (Version 2) --- */
@media (max-width: 850px) {

    /* Make the entire overlay scrollable and align content to the TOP */
    #ai-demo-overlay {
        overflow-y: auto !important;
        /* This tells the flex container to align items to the top, not center */
        justify-content: flex-start !important; 
        padding-top: 30px;
        padding-bottom: 30px;
    }

    /* Reduce headline size on mobile */
    .iad-main-headline {
        font-size: 28px !important;
        line-height: 1.2 !important;
        margin-bottom: 20px !important;
    }

    /* Stack the input fields vertically */
    #ai-demo-input-area {
        flex-direction: column;
        width: 90%;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Make inputs and button full-width */
    #ai-demo-input-area input,
    #ai-demo-input-area button {
        width: 100%;
        max-width: none;
        font-size: 16px;
    }

    /* Adjust main container width */
    #ai-demo-container {
        width: 95%;
        margin-left: auto;
        margin-right: auto;
        /* Add a flex-shrink of 0 to prevent the container from shrinking on short screens */
        flex-shrink: 0;
    }
    
    /* Slightly reduce the height of the content box to save vertical space */
    #ai-demo-content-box {
        height: 300px;
    }

    /* Make panel text slightly smaller on mobile */
    .ai-demo-panel h4 {
        font-size: 1.2em;
    }
    .ai-demo-panel p {
        font-size: 1em;
        line-height: 1.5;
    }
    
    /* Adjust CTA button margin for new layout */
    #ai-demo-cta-btn {
        margin-bottom: 20px;
        flex-shrink: 0; /* Prevent this from shrinking as well */
    }
}