/* ============================================================
   GLOBAL & SYSTEM STYLES
   ============================================================ */
   body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f4f6f8; /* Soft light background for desktop */
    margin: 0;
    padding: 0;
}
html, body {
    height: 100%;
    width: 100%;
}
img {
    border: 0;
}
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
}
.clearfix { display: inline-block; }
* html .clearfix { height: 1%; }
.clearfix { display: block; }

/* Processing & Loading Indicators */
#processing {
    display: none;
    position: fixed;
    top: 46%;
    left: 49%;
    padding: 10px;
    z-index: 9999;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
#proessmsg {
    color: #666;
    opacity: 0.8;
    text-align: center;
}
#proessmsg img {
    vertical-align: middle;
}

/* ============================================================
   RESPONSIVE CONTAINERS & PAGE FLOW
   ============================================================ */

/* Outer Wrapper (Centered column on desktop, full-screen on mobile) */
.chatareaouter, #box {
    display: block;
    max-width: 480px;
    margin: 0px auto; /* Centered with top/bottom space on desktop */
    background: #fff;
    box-sizing: border-box;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); /* Soft professional drop shadow */
    border-radius: 16px;
    border: 1px solid #eef2f6;
    overflow: hidden;
}

/* Standard Mobile/WebView fallback overrides */
@media (max-width: 500px) {
    .chatareaouter,#box {
        margin: 0;
        max-width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

/* Base chat panel structure */
.chatarea {
    display: block;
    background: #fff;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#frmchat {
    display: block;
    margin: 0;
    padding: 0;
}

/* ============================================================
   HEADER STYLING
   ============================================================ */
#topcontainer {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f6;
    background: #ffffff;
    overflow: hidden;
}
#logocontainer {
    float: left;
}
#mutecontainer {
    float: right;
    font-size: 13px;
    color: #6c757d;
    margin-top: 6px;
}
#mutecontainer input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 4px;
}
.textlogo {
    font-size: 22px;
    color: #0084ff; /* Professional blue */
    font-weight: 700;
    letter-spacing: -0.5px;
    text-decoration: none;
}
.textlogo img {
    vertical-align: middle;
    width: 32px;
    height: 32px;
    margin-left: 6px;
}

/* ============================================================
   CHAT WINDOW & MESSAGES (.b1 & .b2)
   ============================================================ */
#teacherarea {
    display: block;
    position: relative;
}

/* Scrollable message window */
#chat {
    display: block;
    height: 380px; /* Fallback for legacy systems */
    height: 55vh;  /* Adjustable viewport sizing */
    min-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    color: #333;
    background-color: #f8f9fa; /* Sleek, off-white background */
    box-sizing: border-box;
    border-bottom: 1px solid #eef2f6;
}

/* Bubble Message Base */
.b1, .b2 {
    max-width: 75%;
    padding: 10px 14px;
    margin: 6px 0;
    font-size: 14.5px;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    clear: both;
}

/* Left Message Bubble (User / Client) */
.b1 {
    float: left;
    background-color: #e9edf2;
    color: #1a1a1a;
    border-radius: 16px 16px 16px 4px; /* Sleek curved tails */
}

/* Right Message Bubble (AI / Assistant) */
.b2 {
    float: right;
    background-color: #0084ff; /* Modern messaging blue */
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
}

/* ============================================================
   INPUT SYSTEM STYLING
   ============================================================ */
#student {
    display: block;
    padding: 12px;
    background: #ffffff;
    position: relative;
    box-sizing: border-box;
}

/* Clean, rounded text input */
#question {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: 22px;
    border: 1px solid #e1e4e8;
    padding: 11px 76px 11px 16px;
    font-size: 14px;
    background: #f8f9fa;
    height: 44px;
    line-height: 20px;
    resize: none;
    margin: 0;
    transition: border-color 0.2s, background-color 0.2s;
}
#question:focus {
    outline: none;
    border-color: #0084ff;
    background-color: #ffffff;
}

/* Right control section styling */
#controls {
    position: absolute;
    right: 20px;
    top: 18px;
    z-index: 10;
}
#recordButton {
    display: inline-block;
    background-size: 28px 28px;
    width: 32px;
    height: 32px;
    opacity: 0.65;
    cursor: pointer;
    margin-right: 8px;
    vertical-align: middle;
    transition: opacity 0.2s;
    background: url("./ico_mic.png") no-repeat;
    border: none;
}
#submitbutton {
    display: inline-block;
    background-size: 28px 28px;
    width: 32px;
    height: 32px;
    opacity: 0.65;
    cursor: pointer;
    vertical-align: middle;
    transition: opacity 0.2s;
    background: url("./ico_send.png") no-repeat;
    border: none;
}
#recordButton:hover, #submitbutton:hover {
    opacity: 1;
}

#policy {
    background-color: transparent;
    font-size: 11px;
    color: #8c757d;
    text-align: center;
    padding-top: 8px;
    margin-top: 4px;
}
#policy a {
    color: #0084ff;
    text-decoration: none;
}

/* ============================================================
   BUTTONS (General Style Classes)
   ============================================================ */
.button {
    color: #ffffff;
    background-color: #0084ff;
    border: none;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.2);
    transition: background-color 0.2s, transform 0.1s;
    margin-top: 4px;
    margin-left: 2px;
}
.button:hover {
    background-color: #0066cc;
}
.button:active {
    -webkit-transform: scale(0.97);
    transform: scale(0.97);
}

.orangebutton {
    background-color: #ED7D31;
    border: none;
    width: 80px;
    height: 80px;
    margin: 6px auto;
    font-weight: bold;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(237, 125, 49, 0.3);
    transition: transform 0.1s;
}
.orangebutton:active {
    -webkit-transform: scale(0.95);
    transform: scale(0.95);
}

/* ============================================================
   AD CONTAINER STYLING
   ============================================================ */
.adcontainer {
    display: block;
    height: 134px;
    width: 100%;
    background: #f1f3f5;
    border-top: 1px solid #eef2f6;
    text-align: center;
    box-sizing: border-box;
    padding-top: 5px;
}

/* ============================================================
   MODALS, OVERLAYS & DIALOGS
   ============================================================ */

/* Voice Recorder Box */
#recordContainer {
    background: #ffffff;
    border: 1px solid #eef2f6;
    position: fixed;
    bottom: 140px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    z-index: 999;
    color: #333;
    display: none;
    padding: 12px;
    width: 290px;
    box-sizing: border-box;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

#box1 {
    background: #fff;
    border: 1px solid #eef2f6;
    color: #333;
    display: none;
    padding: 12px;
    position: fixed;
    top: 16%;
    left: 50%; 
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%); 
    width: 350px;
    min-height: 300px;
    border-radius: 12px;
    max-height: 80%;
    max-width: 80%;
    overflow: auto;
    z-index: 2147483640;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

#box {
    position: fixed;
    top: 0;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    height: 100%;
    width: 100%;
    max-width: 480px;
    padding: 12px;
    background: #f8f9fa;
    box-sizing: border-box;
    display: none;
    z-index: 99999;
}
#titlebar {
    border-bottom: 1px solid #eef2f6;
    min-height: 36px;
    background-color: #ffffff;
}
#thecontents {
    padding: 12px;
    color: #444;
    overflow: auto;
    max-height: 85%;
}
#closebox,
.closebox { 
    background: #fff none repeat scroll 0 0; 
    cursor: pointer; 
    font-size: 20px; 
    position: absolute; 
    right: 14px; 
    top: 12px; 
    width: 22px;
    z-index: 2147483647; 
}