/* ==========================================================================
   MARKETEAM ON-SITE TELEGRAM CHAT WIDGET
   Zero emojis, strict institutional cyber-fintech styling, dual theme support.
   ========================================================================== */

/* Floating Launcher Trigger: completely disabled to preserve original native dock layout */
.mt-chat-trigger{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
  opacity:0 !important;
}

/* Chat Window Modal */
.mt-chat-window{
  position:fixed;
  bottom:calc(76*var(--u, 1px));
  right:calc(28*var(--u, 1px));
  width:380px;
  max-width:calc(100vw - 32px);
  height:520px;
  max-height:calc(100vh - 120px);
  z-index:999999 !important;
  background:rgba(8,12,18,0.96);
  -webkit-backdrop-filter:blur(24px);
  backdrop-filter:blur(24px);
  border:1px solid rgba(255,255,255,0.18);
  clip-path:polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow:0 24px 60px rgba(0,0,0,0.8);
  display:flex;
  flex-direction:column;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(16px) scale(0.98);
  transition:opacity .22s ease, transform .22s cubic-bezier(0.16, 1, 0.3, 1), visibility .22s;
}
.mt-chat-window.open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateY(0) scale(1);
}

/* Light Theme Window */
html[data-theme="light"] .mt-chat-window{
  background:#ffffff !important;
  border:1px solid rgba(15,23,42,0.22) !important;
  box-shadow:0 20px 50px rgba(15,23,42,0.18) !important;
}

/* Chat Header */
.mt-chat-head{
  padding:14px 18px;
  border-bottom:1px solid rgba(255,255,255,0.12);
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:rgba(255,255,255,0.02);
}
html[data-theme="light"] .mt-chat-head{
  border-bottom:1px solid rgba(15,23,42,0.1) !important;
  background:#f8f9fc !important;
}
.mt-chat-title-group{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.mt-chat-title{
  font-family:'Chakra S',sans-serif;
  font-size:12px;
  font-weight:800;
  letter-spacing:1.5px;
  color:#ffffff;
  text-transform:uppercase;
  display:flex;
  align-items:center;
  gap:8px;
}
html[data-theme="light"] .mt-chat-title{
  color:#0c1017 !important;
}
.mt-chat-sub{
  font-family:'Inter S',sans-serif;
  font-size:10px;
  color:rgba(255,255,255,0.5);
  letter-spacing:0.5px;
}
html[data-theme="light"] .mt-chat-sub{
  color:rgba(15,23,42,0.6) !important;
}
.mt-chat-close{
  background:none;
  border:none;
  color:rgba(255,255,255,0.5);
  font-family:'Chakra S',sans-serif;
  font-size:16px;
  cursor:pointer;
  padding:4px 8px;
  transition:color .2s ease;
}
.mt-chat-close:hover{
  color:#ffffff;
}
html[data-theme="light"] .mt-chat-close{
  color:rgba(15,23,42,0.5) !important;
}
html[data-theme="light"] .mt-chat-close:hover{
  color:#0c1017 !important;
}

/* Messages Area */
.mt-chat-body{
  flex:1;
  overflow-y:auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.mt-chat-body::-webkit-scrollbar{
  width:4px;
}
.mt-chat-body::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,0.15);
}
html[data-theme="light"] .mt-chat-body::-webkit-scrollbar-thumb{
  background:rgba(15,23,42,0.15);
}

/* Single Message */
.mt-msg{
  display:flex;
  flex-direction:column;
  max-width:85%;
}
.mt-msg.client{
  align-self:flex-end;
}
.mt-msg.operator{
  align-self:flex-start;
}
.mt-msg-meta{
  font-family:'Chakra S',monospace;
  font-size:9px;
  color:rgba(255,255,255,0.4);
  margin-bottom:4px;
  letter-spacing:1px;
}
html[data-theme="light"] .mt-msg-meta{
  color:rgba(15,23,42,0.45) !important;
}
.mt-msg.client .mt-msg-meta{
  text-align:right;
}

.mt-msg-bubble{
  padding:10px 14px;
  font-family:'Inter S',sans-serif;
  font-size:12px;
  line-height:1.45;
  clip-path:polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.mt-msg.operator .mt-msg-bubble{
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  color:#e2e8f0;
}
html[data-theme="light"] .mt-msg.operator .mt-msg-bubble{
  background:#f1f5f9 !important;
  border:1px solid rgba(15,23,42,0.12) !important;
  color:#0f172a !important;
}

.mt-msg.client .mt-msg-bubble{
  background:#1c2536;
  border:1px solid rgba(238,220,214,0.3);
  color:#ffffff;
}
html[data-theme="light"] .mt-msg.client .mt-msg-bubble{
  background:#e2e8f0 !important;
  border:1px solid rgba(15,23,42,0.25) !important;
  color:#0c1017 !important;
}

/* Chat Input Footer */
.mt-chat-foot{
  padding:12px 14px;
  border-top:1px solid rgba(255,255,255,0.12);
  background:rgba(0,0,0,0.25);
  display:flex;
  gap:8px;
  align-items:center;
}
html[data-theme="light"] .mt-chat-foot{
  border-top:1px solid rgba(15,23,42,0.1) !important;
  background:#f8f9fc !important;
}
.mt-chat-input{
  flex:1;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.14);
  color:#ffffff;
  font-family:'Inter S',sans-serif;
  font-size:12px;
  padding:9px 12px;
  outline:none;
  clip-path:polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  transition:border-color .2s ease;
}
.mt-chat-input:focus{
  border-color:var(--cream, #eedcd6);
}
html[data-theme="light"] .mt-chat-input{
  background:#ffffff !important;
  border:1px solid rgba(15,23,42,0.2) !important;
  color:#0c1017 !important;
}
html[data-theme="light"] .mt-chat-input:focus{
  border-color:rgba(15,23,42,0.6) !important;
}

.mt-chat-send{
  background:var(--cream, #eedcd6);
  border:none;
  color:#0c1017;
  font-family:'Chakra S',sans-serif;
  font-size:11px;
  font-weight:800;
  letter-spacing:1px;
  padding:9px 14px;
  cursor:pointer;
  clip-path:polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  transition:all .2s ease;
  white-space:nowrap;
}
.mt-chat-send:hover{
  background:#ffffff;
}
html[data-theme="light"] .mt-chat-send{
  background:#0c1017 !important;
  color:#ffffff !important;
}
html[data-theme="light"] .mt-chat-send:hover{
  background:#334155 !important;
}

/* Mobile Responsiveness: Native Full-Screen Dialog with Touch Keyboard Support */
@media (max-width: 600px){
  .mt-chat-window{
    bottom:0 !important;
    right:0 !important;
    left:0 !important;
    top:0 !important;
    width:100% !important;
    max-width:100% !important;
    height:100% !important;
    max-height:100dvh !important;
    clip-path:none !important;
    border-radius:0 !important;
    border:none !important;
  }
  .mt-chat-head{
    padding:16px;
  }
  .mt-chat-foot{
    padding:12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }
}
