/* =============================================
   CAROLCHAT WELCOME SCREEN
   CSS-first: instantly hide React default state
   ============================================= */

/* ---- KILL default React empty state INSTANTLY ---- */
#carolchat-root [role="log"] > .absolute.inset-0.flex.flex-col.items-center.justify-center.text-center.text-stone-400 {
    display: none !important;
}

/* Kill intro animations that cause flicker */
.orb-intro,
.text-blur-intro,
.text-blur-intro-delay {
    animation: none !important;
}

/* ---- Fix the widget container ---- */
/* Remove the dark border / shadow from the outer widget */
.carolchat-widget {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* Ensure seamless dark background everywhere */
#carolchat-container,
.carolchat-widget,
#carolchat-root,
#carolchat-root > div,
#carolchat-root > div > div,
#carolchat-root [role="log"] {
    background-color: #1B1C28 !important;
}

/* ---- Entry animation ---- */
@keyframes welcomeFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Welcome screen layout ---- */
/* Position absolutely inside [role="log"] to fill the full visible area.
   The log has pt-16 (64px) top and pb-32 (128px) bottom padding.
   We overlap that padding to center between the actual top and the input bar. */
.carolchat-welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 120px; /* space for the input bar */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 24px;
    padding: 20px 32px;
    box-sizing: border-box;
    font-family: 'DM Sans', 'Inter', -apple-system, sans-serif;
    color: #FFFFFF;
    overflow-y: auto;
    animation: welcomeFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ---- Badge ---- */
.carolchat-welcome-badge {
    background-color: #2A2B3D;
    color: #A0A0B0;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0;
    animation: welcomeFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}

/* ---- Title ---- */
.carolchat-welcome-title {
    color: #FFFFFF;
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    max-width: 600px;
    line-height: 1.3;
    opacity: 0;
    animation: welcomeFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

/* ---- Description ---- */
.carolchat-welcome-description {
    color: #8B8D9E;
    font-size: 15px;
    max-width: 600px;
    line-height: 1.6;
    margin: 0;
    opacity: 0;
    animation: welcomeFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

/* ---- Cards row ---- */
.carolchat-welcome-cards {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    max-width: 720px;
    justify-content: center;
    opacity: 0;
    animation: welcomeFadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* ---- Card ---- */
.carolchat-polymarket-card {
    background-color: #222332;
    border: 1px solid #2E2F42;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.carolchat-polymarket-card:hover {
    border-color: #52D38E40;
    box-shadow: 0 4px 24px rgba(82, 211, 142, 0.08);
}

.carolchat-polymarket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.carolchat-polymarket-question {
    color: #E8E8EC;
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
    font-weight: 500;
    flex: 1;
    text-align: left;
}

.carolchat-polymarket-percentage {
    color: #FFFFFF;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.carolchat-polymarket-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.carolchat-polymarket-btn-vote {
    flex: 1;
    background-color: #52D38E;
    color: #1B1C28;
    padding: 10px 0;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.carolchat-polymarket-btn-vote:hover {
    background-color: #45b87a;
    transform: translateY(-1px);
}

.carolchat-polymarket-btn-view {
    flex: 1;
    background-color: transparent;
    color: #52D38E;
    padding: 10px 0;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #52D38E;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carolchat-polymarket-btn-view:hover {
    background-color: rgba(82, 211, 142, 0.08);
}

.carolchat-polymarket-votes {
    color: #6B6D7E;
    font-size: 13px;
    margin: 0;
    text-align: left;
}

/* ---- Buy button ---- */
.carolchat-welcome-buy-btn {
    border: 1.5px solid #52D38E;
    background: transparent;
    color: #E8E8EC;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s;
    opacity: 0;
    animation: welcomeFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.carolchat-welcome-buy-btn:hover {
    background-color: rgba(82, 211, 142, 0.1);
    border-color: #45b87a;
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* ---- Fix input bar integration ---- */
/* The Dify composer uses .fixed.bottom-4 which means it's fixed
   relative to the viewport. We force it to appear seamlessly 
   inside the dark themed widget. */
#carolchat-root .fixed.bottom-4 {
    background-color: transparent !important;
}

#carolchat-root .fixed.bottom-4 .rounded-3xl {
    background-color: #1B1C28 !important;
    border: 1.5px solid #52D38E !important;
    box-shadow: 0 0 15px rgba(82, 211, 142, 0.1), 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

/* ---- Responsive / Mobile ---- */
@media screen and (max-width: 768px) {
    .carolchat-welcome-screen {
        padding: 20px 16px;
        bottom: 100px;
        gap: 20px;
        /* On mobile, if content is taller than screen, allow scroll and start from top */
        justify-content: flex-start;
        padding-top: 40px;
    }

    .carolchat-welcome-title {
        font-size: 22px;
    }

    .carolchat-welcome-description {
        font-size: 14px;
    }

    .carolchat-welcome-cards {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .carolchat-polymarket-card {
        max-width: 100%;
    }

    .carolchat-welcome-buy-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}
