/******************************************************-*/
/************************ Chat *************************/
/*******************************************************/
:root {
    --cwm-chat-header-max-height: 8vh;
    --cwm-chat-control-height: 200px;
}

#cwm-chat { /* Main container for Chat inside cwm-layout-right */
    padding: 0;
    margin: 0;
    display: flex;
    /*flex-grow: 1;*/
    /*flex-wrap: wrap;*/
    flex-direction: column;
    /*overflow: hidden;*/
    height: 100%;
    width: 100%;
}

#cwm-chat-h {
    display: flex;
    box-sizing: border-box;
    margin: 2px;
    text-align: center;
    font-size: 26px;
    width: 100%;
    padding: .1em;
    /**TODO: re-enable this when header click hides it**/
    /*cursor: se-resize;*/
    /*background-color: var(--secondary-color);*/
}

#cwm-chat-messages { /* area where chats are appended */
    box-sizing: border-box;
    overflow-y: scroll;
    overflow-x: hidden;
    margin: 0;
    padding: 4px;
    /*justify-content: space-between;*/
    justify-content: flex-start;
    list-style-type: none;
    list-style-position: inside;
    /**https://stackoverflow.com/q/33513957**/
    /*flex: 1 1 20%; display: flex; flex-direction: column;*/
    flex: 1 1 20%;
    display: flex;
    flex-direction: column;
}

/*****************************************************************************/
/******************************* Chat  Options *******************************/
/*****************************************************************************/
/*    > > Displayed on login with no default chat, or manual selection < <   */
/*#cwm-chat-opts {*/
/*}*/
#cwm-chat-opts > p {
    padding-left: 6px;
    padding-right: 6px;
}

#cwm-chat-opts-rooms {
    list-style-type: none;
    list-style-position: inside;
    color: var(--primary-color);
    margin: 0;
    padding: 20px;
}

.cwm-chat-opts-rooms-item {
    border: 1px solid var(--primary-color);
    padding: 2px;
    border-radius: var(--border-radius-sm);
    width: 100%;
    text-align: center;
    margin-top: 10px;
    cursor: pointer;
    word-break: break-word;
}
#cwm-chat-opts > ul > li:hover {
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: var(--secondary-color);
}
#cwm-chat-opts > h2 {
    font-size: 20px;
    text-align: center;
}


/** Chat Create **/
#cwm-chat-cc {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /*border-radius: .5em;*/
}
#cwm-chat-cc-input {
    box-sizing: border-box;
    border: 2px solid var(--accent-color);
    width: 90%;
    margin-bottom: 10px;
    border-radius: var(--border-radius-sm);
    font-size: x-large;
    text-align: center;
    background-color: var(--background-color);
    border: var(--border-two);
    color: var(--primary-color);
}
#cwm-chat-cc-input:active, #cwm-chat-cc-input:focus {
    /*border: 4px solid var(--accent-color);*/
    /* box-shadow: right, bottom,  */
    box-shadow: -5px -5px 10px var(--accent-color);
    font-size: xx-large; /*slightly easier to read, but moves other elems...decisions*/
}
#cwm-chat-cc-btn {
    border-radius: .5em;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: var(--border-one);
    font-size: large;
    font-weight: bold;
    width: 60%;
    max-width: 99%;
    min-width: 75px;
    cursor: pointer;
}
#cwm-chat-cc-btn:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}
/*****************************/
/*** Chat Controls Section ***/

/** TODO: Change name (this is the 'last refresh' text) **/
#cwm-chat-last-msg, #cwm-chat-typing-status {
    height: 1em;
    font-size: small;
    display: block;
    font-style: oblique;
    width: 100%;
    text-align: center;
}

#cwm-chat-ctrl { /* Chat Controls */
    box-sizing: border-box;
    border-top: var(--border-two);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    height: var(--cwm-chat-control-height);
    justify-content: flex-start;
}
#cwm-chat-toolbox {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}

/*****************/
/** Chat  Send **/
#cwm-chat-send {
    width: 100%;
    margin: 5px;
    height: 50px;
}
#cwm-chat-send-input, #cwm-chat-send-btn {
    box-sizing: border-box;
    display: inline-block;
    height: 50px;
    border: 2px solid var(--accent-color);
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--primary-color);
    font-size: x-large;
    flex: 1 1 auto;
}
#cwm-chat-send-input {
    width: calc(100% - 50px);
    border-top-left-radius: var(--border-radius-sm);
    border-bottom-left-radius: var(--border-radius-sm);
    vertical-align: top;
    box-shadow: none;
    resize: none;
    border-right: none;

}
#cwm-chat-send-input:focus {
    border: 2px solid var(--primary-color);
    box-shadow: none;
}
#cwm-chat-send-btn {
    width: 40px;
    border-top-right-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
    font-size: x-large;
    font-family: Geneva, Arial, Helvetica, sans-serif;
}
#cwm-chat-send-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.cwm-chat-control-button {
    box-sizing: border-box;
    font-size: x-large;
    min-width: var(--cwm-chat-control-button-width);
    height: var(--cwm-chat-control-button-height);
    background-color: var(--background-color);
    border: 2px solid var(--accent-color);
    color: var(--primary-color);
    /*!*border: 1px solid var(--primary-color);*!*/
    border-radius: var(--border-radius-sm);
    margin: 5px;
    flex: 1 1 auto;
    cursor: pointer;
}

.cwm-chat-control-button:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
}

.cwm-chat-item {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    /*border-width: 1px;*/
    /*border-style: solid;*/
    border: var(--border-one);
    border-radius: var(--border-radius-md);
    margin-top: .4em;
    padding: 0;
    min-width: 150px;
    display: flex;
    overflow-wrap: normal;
}
.cwm-chat-item-italic {
    font-style: italic;
}
.cwm-chat-item-italic::after {
    content: ' (sending)';
}
.cwm-chat-icon {
    margin-right: 5px;
    /*margin-bottom: 30px;*/
    width: 25px !important;
    height: 25px !important;
    border-right: var(--border-one);
    border-bottom: var(--border-one);
    border-bottom-right-radius: var(--border-radius-sm);
    padding-left: 6px;
    padding-right: 6px;
    text-align: center;
    line-height: 100%;
    vertical-align: middle;
    overflow: hidden;
    font-size: large;
    display: inline-block;
}
.cwm-chat-counter {
    color: var(--accent-color);
    position: relative;
    left: 0;
}

.cwm-chat-text {
    padding: .4em;
    wrap-option: wrap;
    word-break: break-word;
}

.cwm-chat-opened h1::after {
    content: 'X';
    font-weight: normal;
    font-size: large;
    float: right;
    vertical-align: middle;
    padding-top: .2em;
    padding-right: .2em;
}
.cwm-chat-closed h1 {
    writing-mode: vertical-lr;
    /*text-orientation: upright;*/
    cursor: nw-resize;
}

#cwm-chat-presence {
    display: flex;
    justify-content: center;
}

#cwm-chat-presence span {
    /* Three values: flex-grow | flex-shrink | flex-basis */
    /* The flex-grow CSS property sets the flex grow factor, */
    /* which specifies how much of the flex container's remaining */
    /* space should be assigned to the flex item's main size. */
    /* flex: 0 0 calc((100% - 6em)/5); */
    flex: 0 0 33%;
    flex-wrap: wrap;
    /* flex-direction: column-reverse; */
    text-align: center;
    display: flex;
    vertical-align: middle;
    box-sizing: border-box;
    border: var(--border-two);
    border-radius: var(--border-radius-sm);
    height: 2em;
    overflow: hidden;
}
