#chat-survey-container {
    width: 100%;
    max-width: 600px;
    margin: auto;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.05);
    scroll-behavior: smooth;
}

#chat-window {
    padding: 20px;
    height: 572px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth !important;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
    font-size: 15px;
    position: relative;
    word-break: break-word;
}

.chat-bubble.bot {
    background: #efeff7;
    color: black;
    line-height: 1.5em;
    align-self: flex-start;
}

.chat-bubble.user {
    background: #1159dc;
    color: white;
    line-height: 1.5em;
    align-self: flex-end;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-start;
    align-items: flex-start;
}

/* Horizontal layout for range-style questions */
.options-container.range-options {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: left;
    align-items: center;
    gap: 15px;
}
.options-container.range-options button {
    line-height: 1.3em!important;
}

.answer-option {
    background: #ffffff;
    color: rgb(0, 0, 0);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    border-radius: 25px;
    border: 1px solid rgb(214, 214, 214);
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    width: fit-content;
    word-break: break-word;
    max-width: 100%;
    text-align: left;
}

.answer-option:hover {
    background: #1159dc;
    color: #fff;
    border: 1px solid #1159dc;
}

.answer-option.selected {
    background: #1159dc; /* Darker blue for selected state */
    color: #fff;
    border: 2px solid #1159dc;
}

.submit-button {
    background: #efeff7;
    color: rgb(28, 28, 28);
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    margin-top: 20px;
    align-self: flex-start;
    width: fit-content;
    border-radius: 5px !important;
}

.submit-button:hover {
    background: #1159dc;
}

.pill-shape {
    border-radius: 25px;
}

.chat-bubble.typing::after {
    content: '...';
    display: inline-block;
    animation: ellipsis 1.5s steps(3, end) infinite;
}

@keyframes ellipsis {
    0%,
    20% {
        content: '...';
    }
    40% {
        content: '...';
    }
    60%,
    100% {
        content: '...';
    }
}

/* Bot message tail */
.chat-bubble.bot::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: #efeff7;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}

/* User message tail */
.chat-bubble.user::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #1159dc;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.chat-bubble {
    word-break: break-word;
}

@media (max-width: 768px) {
    #chat-survey-container {
        max-width: 100%;
        /* Take up full width */
        border-radius: 10;
        /* Remove container radius */
    }

    #chat-window {
        /* height: calc(90vh - 50px);  Remove this line */
        padding: 20px;
        /* Reduce padding for smaller screens */
    }
}

/* Class to trigger fade-in */
.answer-option.fade-in {
    opacity: 1;
}

/* Pulse Icon */
#typing-indicator {
    position: relative;
    margin: 0px auto;
    width: 65px;
    height: 65px;
    display: block;
    bottom: -10px;
    right: 10px;
    z-index: 2;
}

#typing-indicator img {
    width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: box-shadow 0.4s ease-out;
}

/* Pulsing Siri-style glow */
/* Siri-style pulse on the IMG directly */
#typing-indicator img.pulsing {
    animation: siriGlow 3s ease-in-out infinite;
}

/* Smoothly fade out after pulse stops */
#typing-indicator img.fading {
    animation: none;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: box-shadow 0.4s ease-out;
}

/* Glowing animated ring (Siri-style) */
@keyframes siriGlow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px 2px rgba(17, 89, 220, 0.4);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 15px 5px rgba(17, 89, 220, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px 2px rgba(17, 89, 220, 0.4);
    }
}

/* nested-sub-question container styling */
.nested-sub-question {
    background-color: #efeff7;
    border-radius: 20px;
    padding: 15px 20px;
    margin-bottom: 10px;
    max-width: 80%;
    align-self: flex-start;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.4s ease forwards;
}

.sub-question-label {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 15px;
    color: #333;
}

.radio-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    transition: 0.2s ease-in-out;
    font-size: 14px;
}

.radio-option input[type="radio"] {
    margin-right: 6px;
    accent-color: #1159dc;
}

.radio-option:hover {
    background-color: #eaf4ff;
}

.radio-option.selected {
    background-color: #1159dc;
    border-color: #1159dc;
    color: white;
}

.radio-option input[type="radio"] {
    display: none;
}

/* New survey screen UI */
#screens-wrapper {
    position: relative;
    width: 100%;
    min-height: 500px;
    overflow: hidden;
}

/* Navigation Bar */
.navigation-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f7f7f7;
    border-bottom: 1px solid #eee;
}

.navigation-bar button {
    background: none;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navigation-bar button:hover {
    background:transparent!important;
}

.navigation-bar button svg {
    width: 100%;
    height: 100%;
    fill: #1159dc;
    transition: fill 0.3s ease;
}

.navigation-bar button:disabled svg {
    fill: #ccc;
    cursor: not-allowed;
}

.navigation-bar button:hover:not(:disabled) svg {
    fill: #1159dc;
}

.navigation-bar button:disabled {
    background: none;
}

.progress-indicator {
    font-size: 14px;
    color: #555;
}

@media (max-width: 768px) {
.navigation-bar {
    padding: 15px 5px;
}

#screens-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
}

}

/* Adjust chat bubbles to fit screen UI */
.question-typing {
    font-size: 18px;
    font-weight: 400;
    color: #333;
    margin-bottom: 20px;
    width: 100%;
    text-align: left;
}

.question-typing span,
.prompt-text span {
    font-weight: 400;
}

.question-typing strong,
.prompt-text strong {
    font-weight: 700;
}

.user-response {
    background: #1159dc;
    color: white;
    border-radius: 20px;
    padding: 12px 20px;
    align-self: flex-end;
    margin-top: 20px;
    font-size: 15px;
    max-width: 80%;
    text-align: left;
    word-break: break-word;
    animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hide old scrolling chat window styling for screen-by-screen UI */
#chat-window {
    display: none !important;
}

/* Ensure selected options stay visually highlighted even after click */
.answer-option.selected, 
.answer-option.selected:focus, 
.answer-option.selected:active {
    background-color: #1159dc !important;
    color: #ffffff !important;
    border: 2px solid #1159dc !important;
}

.radio-option.selected,
.radio-option.selected:focus, 
.radio-option.selected:active {
    background-color: #1159dc !important;
    color: #ffffff !important;
    border: 2px solid #1159dc !important;
}

/* Screen visibility and opacity control for smooth transitions */
.chat-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 30px 20px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1;
    overflow-y: auto;
}

.chat-screen.active {
    visibility: visible;
    opacity: 1;
}

/* Slide animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

/* Progress Bar Styling */
.progress-bar-container {
    width: 85%;
    background-color: #e0e0e0;
    height: 7px;
    border-radius: 3px;
    overflow: hidden;
    margin: 3px auto 0px auto;
    flex-grow: 1;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: #1159dc;
    transition: width 0.3s ease;
}
.survey-list {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: -5px;
    font-size: 14px;
}

.survey-item {
    color: #555;
}

.survey-item.active-survey {
    font-weight: bold;
    color: #1159dc;
}

.prompt-text {
    padding-bottom:20px;
}
.essay-bubble {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 0;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%; /* Changed from none to 100% */
    margin: 0 auto;   /* Center the bubble if needed */
}

.essay-input {
    width: 100%;
    min-height: 120px;
    font-size: 16px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #ccc;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
    margin-bottom: 15px;
}

.essay-submit-button {
    float: right;
    padding: 10px 18px;
    font-size: 15px;
    background-color: #1159dc;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.essay-submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Full-width essay container and improved presentation */
.essay-container {
  width: 90%;
  margin: 0 auto;
  position:absolute;
}

.essay-container h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #222;
}

.essay-container textarea {
    width: 100%;
    min-height: 140px;
    font-size: 15px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
}

.essay-container .essay-submit-button {
    margin-top: 15px;
    float: right;
    padding: 10px 18px;
    font-size: 15px;
    background-color: #1159dc;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.essay-container .essay-submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
