@import url(https://fonts.googleapis.com/css?family=Lato:400,300,300italic,400italic,700,700italic,900,900italic);

:root {
    --color-ummaize:                    #FFCB05;
    --color-umblue:                     #00274c;
    --color-orange:                     #ff4400;
    --color-green:                      #16ba16;

    /* Header Styling */
    --header-background-color:          #00274c;
    --header-text-color:                white;
    --header-height:                    55px;
    --footer-height:                    50px;


    /* Notification Styling */
    --notification-default-color:       #8f8f8f;
    --notification-info-color:          #0b3bd8;
    --notification-info-text-color:     white;
    --notification-success-color:       #278d07;
    --notification-success-text-color:  white;
    --notification-warning-color:       #ba5207;
    --notification-warning-text-color:  white;
    --notification-error-color:         #cd1010;
    --notification-error-text-color:    white;
    
    /* Content Area */
    --content-bg-color:                white;
    --response-bg-color:               #fcffce;
    --response-welcome-bg-color:       white;
    --question-bg-color:               #303E4B;
    --response-text-color:             #00274c;
    --question-text-color:             white;
    

    /* Content Footer */
    --cf-bg-color:                      #999999;
    --cf-toggle-button-color:           white;
    --cf-toggle-button-hover-bg-color:  var(--color-orange);
    --cf-toggle-button-bg-color:        #999999;
    --cf-toggle-button-color:           white;
    --cf-button-color:                  white;
    --cf-button-bg-color:               var(--color-umblue);
    --cf-button-hover-color:            var(--color-umblue);
    --cf-button-hover-bg-color:         #005986;
    
    /* Footer Area*/
    --footer-bg-color:                  #cac2c2;
    --footer-button-color:              white;
    --footer-button-bg-color:           var(--color-umblue);
    --footer-button-hover-color:        var(--color-umblue);
    --footer-button-hover-bg-color:     #005986;
}

#chatbot-wrapper {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.chat-icon {
    display: none;
    border: none;
    background: none;
    position: absolute; 
    margin: 3px 3px 3px 3px;
    left: 0px;
    bottom: 0px; 

    &.show {
        display: block;
    }

    button {
        background: transparent;
        padding: 8px 9px 9px 9px;
        display: flex;
        justify-content: center;
        align-items: center;
        border: none !important;
        outline: none !important;
        
        &:hover, &:focus {
            background-color: rgba(0,0,0,0) !important;

            .chat-bubble-svg {
                transform: scale(1.05);
                transition: height 0.1s ease-in-out;
                
                .blockm { fill: #fff; }
            }     
        }

        .chat-bubble-svg {
            height: 60px;
            transition: height 0.1s ease-in-out;
            filter: drop-shadow(4px 4px 3px rgba(0, 0, 0, 0.5));
            
            .bubble { fill: var(--color-umblue); }
            .blockm { fill: var(--color-ummaize); }
        }
    }

    &.right {
        right: 0px;
        left: unset;

        button .chat-bubble-svg {
            transform: scaleX(-1);
        }
    }
}


.chatbot {
    display: none !important;
    grid-template-rows: var(--header-height) auto var(--footer-height);
    width: 350px;
    height: 500px;
    max-height: 100svh;
    position: absolute; 
    margin: 0px 10px 0px 10px;
    left: 0px;
    bottom: 0px; 
    z-index: 1000; /* Ensure it stays on top of other content */
    box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.4); 
    border-radius: 5px 5px 0px 0px;
    transition: transform 0.3s ease, height 0.3s ease;
    overflow: hidden; /* Prevent content from overflowing */

    &.show {
        display: grid !important;
    }

    &.right {
        right: 0px;
        left: unset;
    }

    .header {
        grid-row: 1;
        grid-column: 1;
        display: grid;
        grid-template-columns: [col] 55px [col] auto [col] 50px;
        height: var(--header-height);
        font-family: Lato;
        padding-left: 5px;
        background-color: var(--header-background-color);
        border-bottom: 1px solid #fff;
        color: var(--header-text-color);
        border-radius: 5px 5px 0px 0px;

        img.block-m {
            align-self: center;
            justify-self: center;
            height: 30px;
        }

        .chat-title {
            display: grid;
            grid-template-rows: auto auto;
            justify-self: left;            
            align-content: center;
            padding-left: 5px;

            h2 {
                color: var(--header-text-color);
                width: 100%;
                font-size: 18px;
                font-family: Lato;
                font-weight: 500;
                margin: 0;            
            }

            p {
                display: flex;
                font-size: 13px;
                margin: 0;

                i {
                    font-size: 6px;
                    color: var(--color-green);
                    padding-right: 5px;
                    filter: drop-shadow(0px 0px 1px rgba(255, 255, 255, 1.0));
                    align-self: center;
                }
            }
        }

        button#close-chat-button {
            border: none;
            width: 35px;
            height: 35px;
            
            border: solid 2px #aaa;
            border-radius: 50%;
            outline: none !important;
            align-self: center;
            justify-self: center;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #aaa;
            background-color: transparent;
    
            &:hover, &:focus {
                background-color: var(--color-orange);
                border-color: white;
                color: white;
            }
        }
    }

    .notification {
        grid-row: 1;
        grid-column: 1;
        background-color: var(--notification-default-color);
        padding: 3px 0 3px 0;
        text-align: center;
        align-self: end;
        transition: transform 0.3s ease-in-out;
        font-size: 12px;
        border-radius: 0 0 5px 5px;
        
        z-index: 10;
        z-index: -2;

        &.info {
            background-color: var(--notification-info-color);
            color: var(--notification-info-text-color);
        }
        &.success {
            background-color: var(--notification-success-color);
            color: var(--notification-success-text-color);
        }
        &.warning {
            background-color: var(--notification-warning-color);
            color: var(--notification-warning-text-color);
        }
        &.error {
            background-color: var(--notification-error-color);
            color: var(--notification-error-text-color);
        }
        &.show {
            transform: translateY(100%);
        }
    }
    
    .content {
        display: grid;
        position: relative;
        background-color: var(--content-bg-color);
        border: 1px solid #c4c4c4;
        clear: both;       
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        z-index: -5;

        .messages {
            float: left;
            padding: 15px;
            z-index: -20;

            h1, h2, h3, h4, h5, h6 {
                margin-bottom: 5px;
            }
            h1 { font-size: 1.4em; font-weight: 600; }
            h2 { font-size: 1.3em; font-weight: 600; }
            h3 { font-size: 1.2em; font-weight: 600; }
            h4 { font-size: 1.1em; font-weight: 400; }
            h5 { font-size: 1.1em; font-weight: 400; }
            h6 { font-size: 1.1em; font-weight: 300; }
            p {
                margin-top: 5px;
                margin-bottom: 5px;
            }
            a {
                text-decoration: underline;
            }
            ol, ul {
                padding-left: 0px;
                li ul, li ol {
                    margin-left: 10px;
                }
            }

            .response {
                margin-bottom: 15px;

                .received_msg {			
                    display: inline-block;
                    width: 100%;

                    .msg_block {
                        background: var(--response-bg-color) none repeat scroll 0 0;
                        border: 0px solid #c4c4c4;
                        border-radius: 3px;
                        color: var(--response-text-color);
                        font-size: 14px;
                        margin: 0;
                        padding: 5px 5px 5px 12px;
                        width: 100%;

                        &.welcome_message {
                            background-color: var(--response-welcome-bg-color) !important;
                            border: 2px solid #c4c4c4 !important;
                        }
                        
                    }
                    .time_date {
                        _color: #000000;
                        _background-color: rgb(253, 223, 116);
                    }
                }
            }

            .question {
                overflow: hidden;
                margin-bottom: 15px;

                .sent_msg {
                    float: right;
                    width: 100%;

                    .msg_block {
                        background: var(--question-bg-color) none repeat scroll 0 0;
                        border-radius: 3px;
                        border: 1px solid #c4c4c4;
                        font-size: 14px;
                        margin: 0;
                        color: var(--question-text-color);
                        padding: 5px 5px 5px 12px;
                        width: 100%;
                    }
                    span {
                        text-align: right;
                    }
                    .time_date {
                        _color: #FFF;
                        _background-color: #5a728afe;
                    }
                }
            }

            .time_date {
                display: block;
                font-size: 10px;
                margin: -1px 10px 0px 10px;
                padding: 2px 5px 2px 5px;
                border-bottom-right-radius: 5px;
                border-bottom-left-radius: 5px;   
            }
        }
    }

    

    .footer {
        display: grid;
        height: var(--footer-height);
        background-color: var(--footer-bg-color);		
        align-items: start;
        position: relative;
        z-index: 20;
        

        .content-footer {
            grid-column: 1;
            grid-row: 1;
            display: grid;
            align-items: start;
            height: 50px;        
            transition: transform 0.3s ease-in-out;
            border-bottom: 1px solid #4e4e4e;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: -10;
            
            
            &.show {
                transform: translateY(-100%);

                .content-footer-toggle button {
                    background-color: var(--cf-toggle-button-bg-color);
                }

                .content-footer-buttons button {
                    display: block;
                }
            }
    
            .content-footer-toggle {
                grid-row: 1;
                grid-column: 1;
                justify-self: center;
                z-index: -5;
                
                button {
                    display: flex;
                    flex-wrap: wrap;
                    justify-content: center;
                    align-content: center;
                    font-size: 16px;
                    height: 21px;
                    width: 21px;
                    padding: 8px 16px;
                    color: var(--cf-toggle-button-color);
                    background-color: var(--cf-toggle-button-bg-color);
                    border: none;
                    border-radius: 20px 20px 0 0;
                    
                    outline: none !important;
                    transform: translateY(-80%);
                    
                    &:hover, &:focus {
                        border: none;
                        background-color: var(--cf-toggle-button-hover-bg-color);
                    }
                }
            }
            
            .content-footer-buttons {
                grid-row: 1;
                grid-column: 1;
                display: grid;
                background-color: var(--cf-bg-color);
                height: 100%;
                align-items: center;
                padding: 0 10px;
                gap: 10px;

                .icon-buttons {
                    display: grid;
                    grid-template-columns: repeat(auto-fit, minmax(20px, 35px));
                    align-items: center;
                    gap: 10px;

                }
            
                button {
                    display: none; /* hide so we tab over */
                    font-family: Lato;
                    font-size: 13px;
                    background-color: var(--cf-button-bg-color);
                    color: var(--cf-button-color);
                    border: 0px solid #fff;
                    border-radius: 10px;
                    padding: 1px 5px 1px 5px;
                    box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2);
                    width: 30px;
                    height: 30px;
    
                    &:hover, &:focus {
                        background-color: var(--cf-button-hover-bg-color);
                        box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2);
                    }
                }
            }
        }
        
        form {
            height: 100%;
            grid-column: 1;
            grid-row: 1;
            background-color: var(--footer-bg-color);	;
            

            .input-wrapper {
                display: grid;
                grid-template-columns: auto 50px;
                gap: 10px;
                align-items: center;
                justify-items: center;
                padding-left: 10px;
                
                
                height: 100%;

                .chat-input {
                    width: 100%;
                    height: 60%;
                    border: 0px solid #a1a0a0;
                    border-radius: 5px;
                    font-family: Lato;
                    font-size: 16px;
                    margin: 0 10px;
                    padding: 0px 5px;
                    cursor: text;

                    &:focus {
                        outline-width: 2px !important;
                        outline-style: solid !important;
                        outline-color: var(--cf-bg-color) !important;
                    }
                }

                button#chat-send-button {
                    border: 0;
                    padding: 0px;
                    width: 35px;
                    height: 35px;
                    background-color: var(--footer-button-bg-color);
                    color: var(--footer-button-color);
                    border: solid 2px #fff;
                    border-radius: 50%;
                    box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.5);
            
                    &:focus, &:hover {
                        background-color: var(--footer-button-hover-bg-color);
                        color: var(--footer-button-hover-color);
                        box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.5);
                        width: 35px;
                        height: 35px;
                    }
        
                    i#chat-send-icon {
                        display: flex;
                        font-size: 20px;
                        color: #eee;
                        justify-content: center;
                        align-items: center;
                        padding-top: 2px;
                    }
                }
            }
        }
    }
}


/*********** MEDIA QUERY ************/
@media screen and (max-width: 600px) {

    body.chatbot-open {
        height: 100vh;
        overflow-y: hidden;
    }

    #chatbot-wrapper {
        bottom: 0;
        margin-bottom: calc(env(keyboard-inset-height, 0px));
        position: fixed;
    }

    .chatbot {
        width: 100%;
        margin: 0;
        padding-bottom: 10px;
        top: auto;
        bottom: 0;
        position: fixed;

        height: 100vh; /* Fallback */
        height: 100dvh; /* Dynamic viewport height */
        height: -webkit-fill-available; /* For iOS Safari */
        max-height: -webkit-fill-available;
        
        .footer .content-footer {
            height: 60px;

            .content-footer-buttons {
                .icon-buttons {
                    gap: 20px !important;
                }
                
                button {
                    width: 40px !important;
                    height: 40px !important;
                    font-size: 20px;

                    &#toggle-side-button {
                        display: none !important;
                    }

                }
            }
            
            .content-footer-toggle button {
                width: 50px;
                height: 35px;
                border-radius: 25px 25px 0 0;
            }
        }
    }
}