/*
|--------------------------------------------------------------------------
| CWICUSPHIL AI CHATBOT - COMPLETE CSS
|--------------------------------------------------------------------------
*/

/* MAIN WIDGET */

#cwic-ai-widget {
    font-family: Arial, sans-serif;
    color: #333333;
}

/*
|--------------------------------------------------------------------------
| FLOATING CHAT BUTTON
|--------------------------------------------------------------------------
*/

#cwic-ai-toggle {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1050;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 14px 20px;
    border: none;
    border-radius: 30px;

    background: #245c45;
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;

    transition: background-color 0.2s ease,
                transform 0.2s ease;
}

#cwic-ai-toggle:hover {
    background: #194631;
    transform: translateY(-2px);
}

#cwic-ai-toggle span:first-child {
    color: #f7b5cc;
    font-size: 23px;
    line-height: 1;
}

/*
|--------------------------------------------------------------------------
| CHAT PANEL
|--------------------------------------------------------------------------
*/

#cwic-ai-panel {
    position: fixed;
    right: 22px;
    bottom: 88px;
    z-index: 1051;

    display: flex;
    flex-direction: column;

    box-sizing: border-box;
    width: min(380px, calc(100vw - 28px));
    height: min(620px, calc(100dvh - 110px));
    min-height: 300px;

    overflow: hidden;

    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

#cwic-ai-panel[hidden] {
    display: none !important;
}

/*
|--------------------------------------------------------------------------
| CHAT HEADER
|--------------------------------------------------------------------------
*/

#cwic-ai-panel .cwic-ai-header {
    box-sizing: border-box;
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 16px;

    background: #245c45;
    color: #ffffff;
}

#cwic-ai-panel .cwic-ai-header strong,
#cwic-ai-panel .cwic-ai-header small {
    display: block;
}

#cwic-ai-panel .cwic-ai-header strong {
    font-size: 16px;
    font-weight: 700;
}

#cwic-ai-panel .cwic-ai-header small {
    margin-top: 5px;
    color: #e6f2eb;
    font-size: 12px;
}

#cwic-ai-panel #cwic-ai-close {
    flex: 0 0 36px;

    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: none;
    border-radius: 50%;

    background: transparent;
    color: #ffffff;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;
}

#cwic-ai-panel #cwic-ai-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/*
|--------------------------------------------------------------------------
| MESSAGE AREA
|--------------------------------------------------------------------------
*/

#cwic-ai-panel #cwic-ai-messages {
    box-sizing: border-box;

    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;

    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;

    padding: 16px;

    background: #fffaf9;
    scroll-behavior: smooth;
}

/*
|--------------------------------------------------------------------------
| CHAT BUBBLES
|--------------------------------------------------------------------------
*/

#cwic-ai-panel .cwic-ai-message {
    box-sizing: border-box;

    max-width: 92%;
    padding: 11px 13px;

    border-radius: 13px;

    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;

    overflow-wrap: anywhere;
    white-space: pre-wrap;
    text-align: left;
}

#cwic-ai-panel .cwic-ai-bot {
    align-self: flex-start;

    background: #f0f0f0;
    color: #333333;

    border-bottom-left-radius: 4px;
}

#cwic-ai-panel .cwic-ai-user {
    align-self: flex-end;

    background: #245c45;
    color: #ffffff;

    border-bottom-right-radius: 4px;
}

#cwic-ai-panel .cwic-ai-error {
    color: #9b1c31;
}

/*
|--------------------------------------------------------------------------
| MESSAGE INPUT
|--------------------------------------------------------------------------
*/

#cwic-ai-panel #cwic-ai-form {
    box-sizing: border-box;
    flex: 0 0 auto;

    display: flex;
    align-items: flex-end;
    gap: 8px;

    width: 100%;
    margin: 0;
    padding: 12px;

    border-top: 1px solid #eeeeee;
    background: #ffffff;
}

#cwic-ai-panel #cwic-ai-input {
    box-sizing: border-box;

    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    max-height: 100px;

    resize: vertical;

    padding: 10px;
    border: 1px solid #cccccc;
    border-radius: 9px;

    background: #ffffff;
    color: #333333;

    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

#cwic-ai-panel #cwic-ai-input:focus {
    border-color: #245c45;
    outline: 2px solid rgba(36, 92, 69, 0.2);
    outline-offset: 1px;
}

#cwic-ai-panel #cwic-ai-input:disabled {
    background: #f5f5f5;
}

#cwic-ai-panel #cwic-ai-send {
    box-sizing: border-box;
    flex: 0 0 auto;

    padding: 11px 14px;
    border: none;
    border-radius: 9px;

    background: #d94f8a;
    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
}

#cwic-ai-panel #cwic-ai-send:hover {
    background: #b83e72;
}

#cwic-ai-panel #cwic-ai-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

/*
|--------------------------------------------------------------------------
| CONTACT SECTION
|--------------------------------------------------------------------------
*/

#cwic-ai-panel .cwic-ai-contact {
    box-sizing: border-box;
    flex: 0 0 auto;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;

    width: 100%;
    margin: 0;
    padding: 12px 14px;

    border-top: 1px solid #eeeeee;
    background: #ffffff;

    text-align: center;
}

#cwic-ai-panel .cwic-ai-contact p {
    display: block;
    flex: 0 0 auto;

    width: 100%;
    margin: 0 0 4px;
    padding: 0;

    background: transparent;
    color: #555555;

    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;

    text-align: center;
}

/* Reset default and Bootstrap link styles */

#cwic-ai-panel .cwic-ai-contact a,
#cwic-ai-panel .cwic-ai-contact a:link,
#cwic-ai-panel .cwic-ai-contact a:visited {
    box-sizing: border-box;
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 40px;

    margin: 0;
    padding: 10px 12px;

    border: none;
    border-radius: 8px;

    color: #ffffff !important;
    text-decoration: none !important;

    font-family: Arial, sans-serif !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;

    text-align: center;
    overflow-wrap: anywhere;

    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* MESSENGER */

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(1) {
    background-color: #1877f2 !important;
}

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(1):hover {
    background-color: #0d65d9 !important;
}

/* WHATSAPP */

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(2) {
    background-color: #25a366 !important;
}

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(2):hover {
    background-color: #1f854f !important;
}

/* EMAIL */

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(3) {
    background-color: #d94f8a !important;
}

#cwic-ai-panel .cwic-ai-contact a:nth-of-type(3):hover {
    background-color: #b83e72 !important;
}

/* Keyboard accessibility */

#cwic-ai-panel .cwic-ai-contact a:focus-visible {
    outline: 3px solid #245c45;
    outline-offset: 2px;
}

/*
|--------------------------------------------------------------------------
| DISCLAIMER
|--------------------------------------------------------------------------
*/

#cwic-ai-panel .cwic-ai-disclaimer {
    box-sizing: border-box;
    flex: 0 0 auto;

    margin: 0;
    padding: 0 12px 10px;

    background: #ffffff;
    color: #777777;

    font-family: Arial, sans-serif;
    font-size: 10px;
    line-height: 1.5;

    text-align: center;
}

/*
|--------------------------------------------------------------------------
| MOBILE DEVICES
|--------------------------------------------------------------------------
*/

@media (max-width: 480px) {

    #cwic-ai-toggle {
        right: 14px;
        bottom: 14px;
        padding: 12px 16px;
        font-size: 13px;
    }

    #cwic-ai-panel {
        right: 10px;
        bottom: 76px;

        width: calc(100vw - 20px);
        height: min(650px, calc(100dvh - 90px));
        min-height: 300px;

        border-radius: 14px;
    }

    #cwic-ai-panel .cwic-ai-header {
        padding: 12px 14px;
    }

    #cwic-ai-panel #cwic-ai-messages {
        gap: 10px;
        padding: 12px;
    }

    #cwic-ai-panel .cwic-ai-message {
        max-width: 94%;
        padding: 10px 12px;
        font-size: 13px;
    }

    #cwic-ai-panel #cwic-ai-form {
        gap: 6px;
        padding: 9px;
    }

    #cwic-ai-panel #cwic-ai-input {
        padding: 9px;
    }

    #cwic-ai-panel #cwic-ai-send {
        padding: 10px 12px;
    }

    #cwic-ai-panel .cwic-ai-contact {
        gap: 6px;
        padding: 9px 12px;
    }

    #cwic-ai-panel .cwic-ai-contact a,
    #cwic-ai-panel .cwic-ai-contact a:link,
    #cwic-ai-panel .cwic-ai-contact a:visited {
        min-height: 36px;
        padding: 8px;
        font-size: 12px !important;
    }

    #cwic-ai-panel .cwic-ai-contact p {
        font-size: 11px;
    }

    #cwic-ai-panel .cwic-ai-disclaimer {
        padding: 0 8px 7px;
        font-size: 9px;
    }
}

/*
|--------------------------------------------------------------------------
| VERY SMALL SCREENS
|--------------------------------------------------------------------------
*/

@media (max-width: 340px) {

    #cwic-ai-toggle {
        right: 10px;
        bottom: 10px;
        padding: 11px 13px;
    }

    #cwic-ai-panel {
        right: 6px;
        width: calc(100vw - 12px);
    }

    #cwic-ai-panel .cwic-ai-contact {
        gap: 5px;
        padding: 8px;
    }
}

/*
|--------------------------------------------------------------------------
| REDUCED MOTION
|--------------------------------------------------------------------------
*/

@media (prefers-reduced-motion: reduce) {

    #cwic-ai-toggle,
    #cwic-ai-panel .cwic-ai-contact a,
    #cwic-ai-panel #cwic-ai-messages {
        transition: none;
        scroll-behavior: auto;
    }
}