/* Cloud Communications Alliance (CCA) Theme */

/* Primary CCA Color Palette */
:root {
    --cca-primary-blue: #155A88;
    --cca-secondary-blue: #2F8DCA;
    --cca-light-blue: #68C6F0;
    --cca-dark-blue: #094FA3;
    --cca-bg-light: #F3F3F4;
    --cca-white: #ffffff;
    --cca-text-dark: #2c3e50;
    --cca-text-light: #ffffff;
    --cca-gradient: linear-gradient(135deg, #2F8DCA 0%, #68C6F0 100%);
}

#chat-title {
    font-family: 'Poppins', 'Noto Sans', sans-serif;
    font-size: 22px;
    font-weight: 600;
    margin: -2px 0 0 0;
    color: var(--cca-primary-blue);
}

.main-chatBox {
    font-family: 'Poppins', 'Noto Sans', sans-serif;
    height: 100vh;
    max-height: 100vh;
}

.chatInput input::placeholder {
    color: var(--cca-primary-blue);
    opacity: 0.7;
}

.chatInput textarea::placeholder {
    color: var(--cca-primary-blue);
    opacity: 0.7;
}

.ChatWindow {
    overflow: hidden;
    align-self: flex-end;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh !important;
    max-height: 100vh !important;
    background: var(--cca-white);
    box-shadow: 0 4px 20px rgba(21, 90, 136, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(21, 90, 136, 0.1);
}

.chatHeader {
    display: flex;
    gap: 15px;
    align-items: center;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1;
    padding: 18px 24px;
    box-shadow: 0px 2px 8px rgba(21, 90, 136, 0.08);
    background: var(--cca-gradient);
    border-radius: 12px 12px 0 0;
}

.chatHeader img {
    width: 44px;
    height: 30px;
    filter: none;
    opacity: 1;
}

.chat-title-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.powered-by {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chatHeader h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1;
}

#chat-title a {
    color: var(--cca-text-light);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

#chat-title a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.chatitems {
    padding: 24px !important;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 200px) !important;
    max-height: calc(100vh - 200px) !important;
    min-height: calc(100vh - 200px) !important;
    flex: 1;
}

.chatInput {
    display: flex;
    padding: 20px 24px;
    gap: 16px;
    align-items: flex-end;
    background-color: var(--cca-white);
    box-shadow: 0px -2px 8px rgba(21, 90, 136, 0.08);
    border-radius: 0 0 12px 12px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.chatInput input {
    width: 100%;
    height: 56px !important;
    padding: 16px 20px;
    background-color: var(--cca-bg-light);
    border: 2px solid transparent;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.chatInput input:focus {
    outline: none;
    border-color: var(--cca-secondary-blue);
    background-color: var(--cca-white);
    box-shadow: 0 0 0 3px rgba(47, 141, 202, 0.1);
}

.chatInput #input-container {
    flex: 1;
    position: relative;
    min-width: 0;
    width: 100%;
}

.chatInput textarea {
    width: 100%;
    box-sizing: border-box;
    resize: none;
    padding: 14px 20px;
    background-color: var(--cca-bg-light);
    border: 2px solid transparent;
    border-radius: 24px;
    min-height: 48px;
    max-height: 200px;
    height: 48px;
    color: var(--cca-text-dark);
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.4;
    transition: height 0.2s ease;
    overflow-y: hidden;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.chatInput textarea:focus {
    outline: none;
    border-color: var(--cca-secondary-blue);
    background-color: var(--cca-white);
    box-shadow: 0 0 0 3px rgba(47, 141, 202, 0.1);
}

.chatInput textarea::-webkit-scrollbar {
    width: 4px;
}

.chatInput textarea::-webkit-scrollbar-track {
    background: transparent;
}

.chatInput textarea::-webkit-scrollbar-thumb {
    background: var(--cca-secondary-blue);
    border-radius: 2px;
}

.copied::before {
    content: "Copied";
    position: absolute;
    top: -40px;
    left: auto;
    right: 0;
    width: 42%;
    border-radius: 8px;
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    padding: 12px;
    font-weight: 500;
    font-size: 12px;
}

.copied::after {
    border-left: solid transparent 10px;
    border-right: solid transparent 10px;
    border-top: solid var(--cca-secondary-blue) 10px;
    right: 45px;
    content: " ";
    left: auto;
    top: -5px;
    margin-left: -13px;
    position: absolute;
    width: 0;
}

.chat-button {
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--cca-bg-light);
    border: 2px solid var(--cca-primary-blue);
    border-radius: 50%;
    color: var(--cca-primary-blue);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    position: relative;
}

/* Send button gets gradient styling */
#send-message {
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    border-color: var(--cca-secondary-blue);
    box-shadow: 0 2px 8px rgba(47, 141, 202, 0.3);
}

.chat-button svg {
    width: 24px;
    height: 24px;
    color: currentColor;
}


.chat-button:hover {
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    border-color: var(--cca-secondary-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 90, 136, 0.2);
}

#send-message:hover {
    background: var(--cca-primary-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 90, 136, 0.4);
}

.chat-button:focus {
    outline: none;
}

#send-message:focus {
    background: var(--cca-primary-blue);
}

.user-message {
    position: relative;
    width: fit-content;
    max-width: 75%;
    margin-bottom: 24px;
    padding: 14px 20px;
    font-size: 14px;
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 2px 12px rgba(47, 141, 202, 0.2);
    line-height: 1.4;
    margin-left: auto;
    font-family: 'Poppins', sans-serif;
}

.user-message::before {
    display: none;
}

.ai-message {
    position: relative;
    width: fit-content;
    max-width: 75%;
    margin-bottom: 24px;
    padding: 14px 20px !important;
    font-size: 14px;
    background: var(--cca-white);
    color: var(--cca-text-dark);
    border-radius: 20px 20px 20px 4px;
    box-shadow: 0 2px 8px rgba(21, 90, 136, 0.08);
    line-height: 1.4;
    border: 1px solid rgba(21, 90, 136, 0.1);
    font-family: 'Poppins', sans-serif;
}

.ai-message::before {
    display: none;
}

#input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.input-container input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    background-color: var(--cca-bg-light);
    border: 2px solid transparent;
    border-radius: 8px;
    position: relative;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.input-container input:focus {
    outline: none;
    border-color: var(--cca-secondary-blue);
    background-color: var(--cca-white);
    box-shadow: 0 0 0 3px rgba(47, 141, 202, 0.1);
}

#chat-buttons {
    display: flex;
    gap: 8px;
    position: relative;
    transition: all 0.3s ease;
    flex: 0 0 auto;
}



#shortcut-button-container button {
    margin: 6px;
    padding: 12px 20px;
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

#shortcut-button-container button:hover {
    background: var(--cca-primary-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 90, 136, 0.2);
}

#shortcut-button-container {
    display: flex;
    justify-content: center;
    padding: 16px;
    flex-wrap: wrap;
}

.chat-messages p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.message h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 12px 0 8px;
    color: var(--cca-primary-blue);
}

.message h4 {
    font-size: 16px;
    font-weight: 500;
    margin: 10px 0 6px;
    color: var(--cca-primary-blue);
}

.message ul, .message ol {
    margin: 0 0 8px 20px;
    line-height: 1.5;
}

.message ul li, .message ol li {
    padding: 3px 0;
}

.chat-messages .message button {
    background: var(--cca-bg-light);
    color: var(--cca-primary-blue);
    border: 2px solid var(--cca-primary-blue);
    padding: 0;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.chat-messages .message button a {
    color: var(--cca-primary-blue);
    padding: 12px 20px;
    display: inline-block;
    text-decoration: none;
}

.chat-messages .message button:hover {
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 90, 136, 0.2);
}

.chat-messages .message button:hover * {
    color: var(--cca-text-light);
}

.chat-messages .message table {
    background: var(--cca-white);
    border: 1px solid rgba(21, 90, 136, 0.15);
    box-shadow: 0 2px 12px rgba(21, 90, 136, 0.08);
    border-collapse: collapse;
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages .message table tbody tr,
.chat-messages .message table tbody td {
    font-size: 13px;
    margin: 0 !important;
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(21, 90, 136, 0.08);
}

.chat-messages .message table tbody tr {
    display: table-row;
}

.chat-messages .message table tbody th {
    background: var(--cca-gradient);
    color: var(--cca-text-light);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

/* Remove default theme height restrictions and set proper full height */
.chat-messages-main #chat-container {
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0;
}

.chat-messages-main #chat-container div#chat-messages {
    height: calc(100vh - 200px) !important;
    max-height: calc(100vh - 200px) !important;
    min-height: calc(100vh - 200px) !important;
}

.chatitems .message:last-child {
    margin-bottom: 12px;
}

.ai-message pre {
    background: var(--cca-bg-light);
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid rgba(21, 90, 136, 0.1);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    overflow-x: auto;
}

.ai-message code {
    background: var(--cca-bg-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: var(--cca-primary-blue);
}

@keyframes typing-dot {
    0% { content: "."; }
    25% { content: ".."; }
    50% { content: "..."; }
    75% { content: ""; }
}

.dot-animation::after {
    content: ".";
    animation: typing-dot 1s infinite;
}

span.dot-animation {
    min-width: 15px;
    display: inline-block;
    color: var(--cca-secondary-blue);
}

/* Media Queries with fixed heights */
@media (min-width: 767px) {
    body.cleanpage.ast-desktop .main-chatBox {
        padding: 0;
        height: 100vh;
    }

    body.cleanpage.ast-desktop .chatitems {
        height: calc(100vh - 200px) !important;
        max-height: calc(100vh - 200px) !important;
        min-height: calc(100vh - 200px) !important;
    }

    .ChatWindow {
        height: 100vh !important;
        max-height: 100vh !important;
    }
}

@media (max-width: 1440px) {
    #input-container {
        flex: 1 !important;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
    }
}

@media (max-width: 1024px) {
    .chatInput {
        padding: 18px !important;
        justify-content: space-between;
    }
    
    .chatitems {
        height: calc(100vh - 220px) !important;
        max-height: calc(100vh - 220px) !important;
        min-height: calc(100vh - 220px) !important;
    }
}

@media (max-width: 768px) {
    .chatInput input {
        padding: 14px 50px 14px 16px;
    }

    .chatitems {
        height: calc(100vh - 240px) !important;
        max-height: calc(100vh - 240px) !important;
        min-height: calc(100vh - 240px) !important;
        padding: 20px !important;
    }
}

@media (max-width: 767px) {
    #input-container {
        flex: 1 !important;
        width: 100% !important;
        min-width: 0;
    }


    div.chatInput {
        gap: 8px !important;
        padding: 12px !important;
        flex-direction: row;
        align-items: flex-end;
        width: 100%;
        box-sizing: border-box;
    }

    div.chatInput #input-container {
        flex: 1 !important;
        width: 100% !important;
        min-width: 0;
    }

    .chatInput textarea {
        min-height: 44px !important;
        padding: 10px 18px;
        font-size: 16px;
        border-radius: 22px;
    }

    .chatHeader {
        padding: 16px 16px;
        align-items: center;
    }



    .chatInput .btn button {
        width: 100%;
    }

    #chat-buttons {
        display: flex;
        gap: 8px !important;
        flex: 0 0 auto;
        align-items: center;
    }

    div.chatitems {
        padding: 16px !important;
        height: calc(100vh - 260px) !important;
        max-height: calc(100vh - 260px) !important;
        min-height: calc(100vh - 260px) !important;
    }

    .ai-message {
        margin-bottom: 20px;
        max-width: 90%;
    }

    div.user-message {
        max-width: 90%;
        padding: 12px 16px !important;
    }

    .chat-messages .message {
        margin-bottom: 16px;
    }

    .ChatWindow {
        border-radius: 0;
        height: 100vh !important;
        max-height: 100vh !important;
    }

    .chatHeader {
        border-radius: 0;
    }

    .chatInput {
        border-radius: 0;
    }
}

@media (max-width: 580px) {
    .ai-message {
        padding: 12px 16px !important;
        max-width: 85% !important;
    }

    .user-message {
        padding: 12px 16px;
        max-width: 85% !important;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 45%;
    }

    .chatInput .btn button {
        padding: 14px 12px !important;
        font-size: 12px;
    }

    .chatInput {
        padding: 12px !important;
    }

    .chat-messages * {
        font-size: 14px !important;
    }
    
    #chat-title {
        font-size: 18px;
    }

    .chatitems {
        height: calc(100vh - 280px) !important;
        max-height: calc(100vh - 280px) !important;
        min-height: calc(100vh - 280px) !important;
    }
}

@media (max-width: 425px) {
    .chat-messages * {
        font-size: 13px !important;
    }

    .chatitems {
        padding: 12px !important;
        height: calc(100vh - 300px) !important;
        max-height: calc(100vh - 300px) !important;
        min-height: calc(100vh - 300px) !important;
    }
}

/* Ensure iframe container doesn't restrict height */
iframe {
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
}