/* A floating container for the chat button and window */
#ita-assistant-floating-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    --ita-assistant-header-bg: #4571bb;
    --ita-assistant-send-bg: #011f2c;
}

/* The toggle button to open the chatbot */
#ita-assistant-toggle {
    position:fixed;
    background-color: var(--ita-assistant-header-bg);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 18px 18px;
    font-size: 21px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, transform 0.3s ease;
    bottom:20px;
    right:20px;
}

#ita-assistant-toggle:hover {
    opacity: 0.7;
    transform: scale(1.05);
}

/* The main chat window container */
#ita-assistant-window {
    position: relative;
    width: 350px;
    height: 510px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

/* The header of the chat window */
#chatbot-header {
    background-color: var(--ita-assistant-header-bg);
    color: white;
    padding: 12px 12px 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    gap: 8px;
}

#chatbot-heading {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#chatbot-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#ita-assistant-call-button {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#ita-assistant-call-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* The main chat content area */
#chat-window-content {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f4f4f4;
}

/* Styles for chat messages */
.message {
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    background-color: #a2a2a2;
    color: white;
    margin-left: auto;
    border-top-right-radius: 5px;
}

.message.bot {
    background-color: #e0e0e0;
    color: #333;
    border-top-left-radius: 5px;
}

.message.agent {
    background-color: #d1e7dd;
    color: #0f5132;
    border-top-left-radius: 5px;
    border: 1px solid #badbcc;
}

.message.bot.welcome {
    background-color: #c8e6c9;
    color: #333;
    font-style: italic;
    text-align: center;
}

.message.bot.loading {
    background-color: #f0f0f0;
    font-style: italic;
    animation: pulse 1.5s infinite ease-in-out;
}

.message.bot.error {
    background-color: #ffcdd2;
    color: #d32f2f;
    font-weight: bold;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* The input area at the bottom of the chat window */
#chat-input-area {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #ffffff;
    border-top: 1px solid #ddd;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
}

#send-button {
    background-color: var(--ita-assistant-send-bg);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#send-button:hover {
    opacity: 0.7;
}

#ita-assistant-call-overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 31, 44, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 24px;
}

#ita-assistant-call-overlay[hidden] {
    display: none !important;
}

.ita-assistant-call-card {
    text-align: center;
    color: #fff;
    max-width: 260px;
}

.ita-assistant-call-pulse {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #34d399 0%, #12805f 55%, transparent 70%);
    animation: ita-assistant-call-pulse 1.6s ease-in-out infinite;
}

@keyframes ita-assistant-call-pulse {
    0%, 100% { transform: scale(0.92); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}

.ita-assistant-call-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
}

.ita-assistant-call-status {
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 20px;
    color: rgba(255, 255, 255, 0.88);
    min-height: 40px;
}

.ita-assistant-call-end {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.ita-assistant-call-end:hover {
    background: #b91c1c;
}

#ita-assistant-floating-wrapper.open #ita-assistant-toggle {
    display: none;
}
.message.bot a {
    color: #0055ff; /* A different color for links */
    text-decoration: underline;
}

.message.bot a:hover {
    color: #007bff; /* A slightly different color on hover */
}
/* Responsive adjustments */
@media (max-width:500px) {
    #ita-assistant-floating-wrapper.open #ita-assistant-window {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }

    #ita-assistant-floating-wrapper.open {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background-color: white;
        transition: all 0.3s ease-in-out;
    }

    #ita-assistant-floating-wrapper.open {
        transform: translateY(0);
    }
}

/* New styles for the contact form */
#contact-form-container {
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    margin-top:-21px;
}
#contact-form-container h3 {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}
#contact-form-container input {
    width: 90%;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 14px;
}
#contact-form-container button {
    width: 90%;
    padding: 12px;
    background-color: var(--ita-assistant-send-bg);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#contact-form-container button:hover {
    background-color: var(--ita-assistant-header-bg);
}
#contact-form-container .required-label::after {
    content: "*";
    color: red;
    margin-left: 4px;
}
#form-error-message {
    color: red;
    font-size: 12px;
    margin-bottom: 10px;
    text-align: center;
    display: none;
}

/* Human WebRTC panel inside the assistant window (no floating FAB) */
#ita-assistant-window > .ita-as-hc-widget--embedded {
    position: absolute;
    inset: 0;
    z-index: 40;
    margin: 0;
    display: block;
    pointer-events: none;
}

#ita-assistant-window > .ita-as-hc-widget--embedded .ita-as-hc-fab {
    display: none !important;
}

#ita-assistant-window > .ita-as-hc-widget--embedded .ita-as-hc-panel {
    position: absolute;
    inset: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
    pointer-events: auto;
    z-index: 41;
}

#ita-assistant-window > .ita-as-hc-widget--embedded .ita-as-hc-panel[hidden] {
    display: none !important;
}
