:root{

  --bg: #f7f7f8;          /* nền ChatGPT */

  --card: #ffffff;

  --stroke: #e5e7eb;



  --text: #1f2937;

  --muted: #6b7280;



  --brand: #4143d8;       /* màu xanh ChatGPT */



  --shadow: 0 4px 12px rgba(0,0,0,0.04);



  --radius: 16px;

}



html, body{ height:100%; }



body{

  margin:0;

  font-family: "Inter", system-ui, sans-serif;

  background: var(--bg);

  color: var(--text);

}



.wrap{

  max-width: 980px;

  margin: 0 auto;

  padding: 14px;

  min-height: 100dvh;

  display:flex;

  flex-direction:column;

  gap: 12px;

}



/* ===== topbar ===== */

.topbar{

  background: #ffffff;

  border: 1px solid var(--stroke);

  box-shadow: none;

  border-radius: 12px;

}



.topbar__left{ display:flex; align-items:center; gap: 12px; min-width: 0; }

.topbar__avatar{

  background: var(--brand);

  box-shadow: none;

}

.topbar__title{ font-weight: 800; letter-spacing: .2px; line-height: 1.1; }

.topbar__sub{ font-size: 12px; color: var(--muted); display:flex; align-items:center; gap: 8px; }

.dot{ width:8px; height:8px; border-radius:999px; background:#22c55e; box-shadow:0 0 0 4px rgba(34,197,94,.16); }



.topbar__actions{ display:inline-flex; gap: 10px; align-items:center; }

.clear-top{

  display:inline-flex;

  align-items:center;

  gap: 8px;

  padding: 9px 12px;

  border-radius: 999px;

  border: 1px solid var(--stroke-strong);

  background: rgba(255,255,255,.9);

  color: var(--text);

  cursor:pointer;

  font-size: 13px;

  line-height: 1;

}

.clear-top .ico{ width: 16px; height: 16px; fill: currentColor; opacity: .85; }

.clear-top:active{ transform: translateY(1px); }

.form-box.login{

  z-index: 2;

}



.form-box.register{

  z-index: 1;

}

.container.active .form-box.login{

  z-index: 1;

}



.container.active .form-box.register{

  z-index: 2;

}

.scroll-bottom{

  width: 40px;

  height: 40px;

  border-radius: 999px;

  border: 1px solid var(--stroke);

  background: rgba(255,255,255,.85);

  color: var(--text);

  display:grid;

  place-items:center;

  box-shadow: 0 4px 10px rgba(0,0,0,.05);

  opacity: 0;

  pointer-events: none;

  transition: opacity .18s ease;

}

.scroll-bottom.show{ opacity: 1; pointer-events: auto; }

.scroll-bottom svg{ width: 20px; height: 20px; }



/* ===== chat ===== */

.chat{

  background: transparent;

  border: none;

  box-shadow: none;

  padding: 20px 0;

}



.msgrow{ display:flex; margin: 10px 0; }

.msgrow.me{ justify-content:flex-end; }

.msgrow.bot{ justify-content:flex-start; }



.bubble{

  position: relative;

  max-width: 100%;

  border-radius: var(--radius);

  padding: 12px 12px;

  line-height: 1.45;

  font-size: 14px;

  overflow-wrap: anywhere;

  word-break: break-word;

}



.me .bubble{

  background: var(--brand);

  color: #fff;

  border-radius: 18px;

  padding: 12px 16px;

  max-width: 72%;



  box-shadow: 0 2px 8px rgba(16,163,127,0.2);

}



.bot .bubble{
  background: #ffffff;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 16px 18px;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.bubble img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

/* Image Editing Styles */
.edit-result {
  border: 1px solid var(--brand) !important;
  box-shadow: 0 4px 15px rgba(65, 67, 216, 0.1) !important;
}

.edit-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(65, 67, 216, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}




.message-content{

  white-space: normal;

  word-break: break-word;

}



.message-content p,

.message-content ul,

.message-content ol,

.message-content pre,

.message-content blockquote{

  margin: 0 0 12px;

}



.message-content p:last-child,

.message-content ul:last-child,

.message-content ol:last-child,

.message-content pre:last-child,

.message-content blockquote:last-child{

  margin-bottom: 0;

}



.message-content mjx-container{

  margin: 8px 0 !important;

  max-width: 100% !important;

  overflow-x: auto !important;

  overflow-y: hidden !important;

}



/* copy button */

.copy-btn{

  position:absolute;

  top:8px;

  right:8px;

  font-size:12px;

  background:#1f2937;

  color:#fff;

  border:none;

  border-radius:6px;

  padding:4px 6px;

  cursor:pointer;

  opacity:0.8;

}

.copy-btn:hover{ transform: translateY(-1px); }

.copy-btn:active{ transform: translateY(0); opacity: .8; }

.copy-btn svg{ width: 16px; height: 16px; }



/* code blocks */

pre{ margin: 10px 0 0; }

pre code{

  display:block;

  padding: 14px;

  border-radius: 14px;

  background:#0b1020;

  color:#d7def5;

  font-size:13px;

  line-height:1.45;



  overflow-x:auto;

  white-space:pre;

}



/* MathJax */

.bot mjx-container{

  max-width: 100% !important;

  overflow-x: auto !important;

  overflow-y: hidden !important;

  display:block;

  -webkit-overflow-scrolling: touch;

}



/* ===== status ===== */

.status{

  padding: 10px 12px;

  border-radius: 14px;

  background: rgba(255,243,205,.92);

  border: 1px solid rgba(0,0,0,.08);

  font-size: 13px;

  box-shadow: 0 4px 10px rgba(0,0,0,.05);

}



/* ===== composer ===== */

#composer{

  position: fixed;

  left: 0; right: 0; bottom: 0;

  z-index: 60;

  background: #ffffff;

  border-top: 1px solid var(--stroke);

}



.composer-inner{

  max-width: 980px;

  margin: 0 auto;

  padding: 12px 14px;

  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));

  display:flex;

  gap: 10px;

  align-items:flex-end;

}



.iconbtn{

  width: 44px;

  height: 44px;

  border-radius: 14px;

  border: 1px solid rgba(17,24,39,.10);

  background: rgba(255,255,255,.92);

  color: var(--text);

  display:grid;

  place-items:center;

  cursor:pointer;

  padding: 0;

}

.iconbtn .ico{ width: 20px; height: 20px; }

.iconbtn:active{ transform: translateY(1px); }



.textwrap{

  border-radius: 20px;

  border: 1px solid var(--stroke);

  background: #fff;

  box-shadow: none;

}







#msg{

resize:none;

overflow-y:auto;

min-height:40px;

max-height:180px;

}



.sendbtn{

  background: var(--brand);

  border-radius: 12px;

  box-shadow: none;

}

.sendbtn:disabled{ opacity: .6; cursor:not-allowed; }

.sendbtn:active{ transform: translateY(1px); }



/* dropdown */

.dropdown-menu{

  border-radius: 16px;

  border: 1px solid rgba(17,24,39,.10);

  box-shadow: 0 18px 50px rgba(17,24,39,.18);

  padding: 8px;

}

.dropdown-item{

  display:flex;

  align-items:center;

  gap: 10px;

  border-radius: 12px;

  padding: 10px 12px;

  font-size: 14px;

  color: var(--text);

}

.dropdown-item:active{ background: rgba(17,24,39,.06); }

.menu-ico{ width: 20px; height: 20px; flex: 0 0 auto; }



/* attachments */

.attachments{ margin-top: 8px; display:flex; gap: 8px; flex-wrap: wrap; }

.atchip{

  font-size: 12px;

  padding: 6px 10px;

  border-radius: 999px;

  background: rgba(17,24,39,.06);

  border: 1px solid rgba(17,24,39,.10);

  max-width: 100%;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

}







/* image preview in attachments */

.atimg{

  position: relative;

  width: 84px;

  height: 84px;

  border-radius: 10px;

  border: 1px solid rgba(17,24,39,.12);

  overflow: hidden;

  background: rgba(17,24,39,.03);

}

.atimg img{

  width: 100%;

  height: 100%;

  object-fit: cover;

  display: block;

}

.atremove{

  position: absolute;

  top: 4px;

  right: 4px;

  width: 22px;

  height: 22px;

  border: 0;

  border-radius: 999px;

  background: rgba(0,0,0,.6);

  color: #fff;

  cursor: pointer;

  line-height: 22px;

  padding: 0;

}



/* images/files inside sent user messages */

.usertxt{ white-space: pre-wrap; }

.msgatts{

  display: flex;

  gap: 8px;

  flex-wrap: wrap;

  margin-top: 8px;

}

.msgimg{

  width: 180px;

  max-width: 100%;

  max-height: 240px;

  height: auto;

  object-fit: cover;

  border-radius: 12px;

  border: 1px solid rgba(255,255,255,.35);

  display: block;

}

.msgfile{

  font-size: 12px;

  padding: 6px 10px;

  border-radius: 999px;

  background: rgba(255,255,255,.16);

  border: 1px solid rgba(255,255,255,.22);

  color: #fff;

  max-width: 100%;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

}



/* footer */

.hint{ font-size: 12px; color: rgba(15,23,42,.55); }



/* home button */

.home-btn{

  background: #ffffff;

  border: 1px solid var(--stroke);

}

/*#loginBox{

  width:300px;

  margin:120px auto;

  text-align:center;

}



#loginBox input{

  width:100%;

  margin:5px 0;

  padding:10px;

}



#loginBox button{

  width:100%;

  padding:10px;

  margin-top:5px;

}*/



/* ===== responsive ===== */

@media (max-width: 640px){

  .wrap{ padding: 10px; gap: 10px; }

  .topbar{ top: 8px; padding: 10px 12px; }

  .topbar__avatar{ width: 38px; height: 38px; }

  .bubble{ font-size: 14px; }

  .composer-inner{ padding: 10px 10px; }

  .sendbtn{ width: 64px; }

  .home-btn{ right: 12px; }

}

/* layout chat + sidebar */



#chatApp{

  display:none;

  height:100dvh;

  background:#f4f6fb;

  pointer-events:auto; /* 🔥 QUAN TRỌNG */

}



#chatApp > .d-flex{

  height:100%;

  width: 100%;

}



/* sidebar */



.sidebar{

  background: #ffffff;

  border-right: 1px solid var(--stroke);



  display: flex;

  flex-direction: column;



  height: 100%;

  overflow: hidden; /* 🔥 QUAN TRỌNG NHẤT */

}



/* main chat */



.flex-grow-1{

  display:flex;

  flex-direction:column;

  min-width:0;

}



/* chat scroll */



#chat{

  flex:1;

  overflow:auto;

}



.menu-btn{

z-index:3000;

position:relative;

}



/* mobile */

@media (max-width:768px){

.copy-btn {

    padding: 6px 10px;

    font-size: 13px;

}



#sidebar{

position:fixed;

top:0;

left:0;

width:260px;

flex-shrink: 0;

height:100%;

background:#fff;

z-index:2000;



transform:translateX(-100%);

transition:transform .3s ease;

}



#sidebar.open{

transform:translateX(0);

}



}

.chat-history-item{

  border-bottom: none;

  border-radius: 10px;

  margin: 4px 6px;

}

.chat-history-item:hover{

  background: #f1f5f9;

}



/* Removed redundant button style to use main_style.css */


.chat-title{

cursor:pointer;

flex:1;

}

mjx-container{

font-size: 110%;

margin: 6px 0;

}

/*pre{

background:#0f172a;

color:#e5e7eb;

padding:14px

border-radius:10px;

overflow:auto;

font-size:13px;

}*/



pre code{

font-family: "JetBrains Mono", monospace;

}

pre{

position:relative;

background:#0f172a;

color:#e5e7eb;

padding:16px;

border-radius:10px;



overflow-x:auto;

max-width:100%;

white-space:pre;



-webkit-overflow-scrolling: touch;

}

.bot pre{

width:100%;

}







.password-box{

position:relative;

}



.password-box input{

padding-right:40px;

}



.toggle-pass{

position:absolute;

right:12px;

top:50%;

transform:translateY(-50%);

cursor:pointer;

font-size:18px;

color:#555;

}

.mode-toggle{

display:flex;

gap:5px;

margin-bottom:5px;

}



.mode-btn{

border:none;

background:#eee;

padding:4px 8px;

border-radius:6px;

cursor:pointer;

font-size:14px;

}



.mode-btn.active{

background:#2b7cff;

color:white;

}



.copy-btn-msg{

      opacity: 0.7;





  position: absolute;

  top: 6px;

  right: 6px;



  width: 26px !important;

  height: 26px !important;



  display: flex;

  align-items: center;

  justify-content: center;



  border-radius: 8px;

  border: 1px solid transparent;



  background: transparent;

  color: #6b7280;



  cursor: pointer;

  opacity: 0;



  transition: all 0.15s ease;

}



.bubble:hover .copy-btn-msg{

  opacity:1;

}



.copy-btn-msg i{

  font-size:14px;

  

}





.copy-btn-msg:hover{

    opacity: 1;

}



.copy-btn-clean{

  position: absolute;

  bottom: 6px;

  right: 8px;



  font-size: 12px;

  padding: 4px 8px;



  border-radius: 8px;

  border: 1px solid var(--stroke);



  background: #f9fafb;

  color: #374151;



  cursor: pointer;

  opacity: 0;



  transition: all 0.2s ease;

}



.bubble:hover .copy-btn-clean{

  opacity: 1;

}

#profileBox{

  position:fixed;

  inset:0;

  background:#fff;

  z-index:999999; /* 🔥 tăng */

  display:flex;

}

.send-btn{

  width: 48px !important;

  height: 44px;

  padding: 0 !important;

  border-radius: 10px;

  flex-shrink: 0;

}



#msg{

  flex:1;

}



.send-btn i{

  font-size:18px;

  color:#fff;

}

/* ===== UI nâng cấp ===== */



.btn-primary{

  background: linear-gradient(135deg,#6366f1,#4f46e5);

  border:none;

}



.new-chat-btn{

  background: linear-gradient(135deg,#6366f1,#4f46e5);

}



.sidebar{

  background:#f9fafb;

}



.topbar{

  background:#fff;

  border-bottom:1px solid #eee;

}

#pf_dob{

  letter-spacing:1px;

  font-weight:500;

}

.dropdown > button{

  width:40px;

  height:40px;

  border-radius:10px;

  padding:0;

  display:flex;

  align-items:center;

  justify-content:center;

}

/* Removed redundant button style */


.p-2.border-top{

  flex-shrink:0;

}

#attachments{

  flex-shrink:0;

}

@media (max-width:768px){



  /* Ẩn hiệu ứng container gốc */

  #loginBox .container{

    display:block;

    width:100%;

    max-width:380px;

    margin:auto;

    height:auto;

  }



  /* Ẩn toggle animation */

  .toggle-box{

    display:none !important;

  }



  /* Ẩn hết form */

  .form-box{

    display:none !important;

    width:100% !important;

    position:relative !important;

  }



  /* Form active sẽ hiện */

  .form-box.active{

    display:block !important;

  }



  /* Style card cho đẹp */

  .form-box form{

    background:#fff;

    padding:25px 20px;

    border-radius:14px;

    box-shadow:0 10px 30px rgba(0,0,0,0.1);

  }



  /* Button chuyển form */

  .switch-auth{

    text-align:center;

    margin-top:15px;

    font-size:14px;

  }



  .switch-auth span{

    color:#4f46e5;

    font-weight:600;

    cursor:pointer;

  }

}

@media (max-width:768px){





}

@media (max-width:768px){



  html, body{

    width:100%;

    overflow-x:hidden !important;

  }



  #loginBox{

    padding:10px;

  }



  #loginBox .container{

    width:100% !important;

    max-width:100% !important;

    padding:0 10px;

  }



  .form-box form{

    width:100%;

    max-width:100%;

    box-sizing:border-box;

  }



  .input-box input{

    width:100%;

  }



}

@media (max-width:768px){



  .toggle-box{

    display:none !important;

    pointer-events:none !important;

    z-index:-1 !important;

  }



}

.form-box{

  position:relative;

  z-index:10;

}

.sidebar {

  display: flex;

  flex-direction: column;

}

.logout-box{

  padding: 12px;

  border-top: 1px solid #eee;

  flex-shrink: 0;

}



/* ===== USER UI ===== */



.user-box {

  position: relative;

}



.user-info {

  display: flex;

  align-items: center;

  gap: 8px;

  padding: 6px 10px;

  border-radius: 10px;

  cursor: pointer;

  transition: 0.2s;

}



.user-info:hover {

  background: #f1f5f9;

}



.avatar {

  width: 32px;

  height: 32px;

  border-radius: 50%;



  display: flex;

  align-items: center;

  justify-content: center;



  font-weight: bold;

  color: #fff;



  background: linear-gradient(135deg,#6366f1,#4f46e5);

}



.user-name {

  font-weight: 600;

  font-size: 14px;

}



.arrow {

  font-size: 12px;

  color: #666;

}



.user-menu {

  position: absolute;

  top: 45px;

  right: 0;



  background: #fff;

  border-radius: 10px;

  border: 1px solid #eee;



  box-shadow: 0 10px 30px rgba(0,0,0,0.1);



  display: none;

  min-width: 160px;

  z-index: 9999;

}



.menu-item {

  padding: 10px;

  cursor: pointer;

  font-size: 14px;

}



.menu-item:hover {

  background: #f3f4f6;

}

.profile-modal{

  position: fixed;

  inset: 0;

  background: rgba(0,0,0,0.4);



  display: none;

  align-items: center;

  justify-content: center;



  z-index: 99999;

}





.profile-title{

  font-size: 20px;

  font-weight: 700;

  margin-bottom: 15px;

  text-align: center;

}

.user-menu{

  position:absolute;

  right:0;

  top:40px;

  background:#fff;

  border-radius:10px;

  box-shadow:0 10px 30px rgba(0,0,0,0.1);

  display:none;

}



.user-menu.show{

  display:block;

}



.menu-item{

  padding:10px 15px;

  cursor:pointer;

}



.menu-item:hover{

  background:#f5f5f5;

}



.profile-card{

  width: 360px;

  background:#fff;

  border-radius:20px;

  padding:25px;

  box-shadow:0 20px 60px rgba(0,0,0,0.2);

  animation: fadeUp .25s ease;

}



@keyframes fadeUp{

  from{ transform:translateY(20px); opacity:0 }

  to{ transform:translateY(0); opacity:1 }

}



.avatar-upload{

  text-align:center;

  margin-bottom:15px;

}



.avatar-preview{

  width:80px;

  height:80px;

  border-radius:50%;

  background:linear-gradient(135deg,#6366f1,#4f46e5);

  color:#fff;

  font-size:28px;

  font-weight:bold;



  display:flex;

  align-items:center;

  justify-content:center;



  margin:auto;

  overflow:hidden;

}



.avatar-preview img{

  width:100%;

  height:100%;

  object-fit:cover;

}



.message-content + .message-actions,

.message-actions {

  margin-top: 14px;

}



.message-actions {

  display: flex;

  justify-content: flex-start;

  align-items: center;

  gap: 10px;

  flex-wrap: wrap;

}



.message-action-btn {

  appearance: none;

  border-radius: 999px;

  display: inline-flex;

  align-items: center;

  gap: 7px;

  height: 36px;

  padding: 0 14px;

  font-size: 13px;

  font-weight: 600;

  line-height: 1;

  cursor: pointer;

  transition: all .18s ease;

}



.message-action-btn:hover {

  transform: translateY(-1px);

}



.message-action-btn-primary {

  border: none;

  background: #4f46e5;

  color: #fff;

  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.20);

}



.message-action-btn-primary:hover {

  background: #4338ca;

  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.24);

}



.message-action-btn-secondary {

  border: 1px solid #e5e7eb;

  background: #fff;

  color: #4b5563;

}



.message-action-btn-secondary:hover {

  background: #f9fafb;

  border-color: #d1d5db;

}



.message-action-icon {

  font-size: 13px;

  line-height: 1;

  display: inline-flex;

  align-items: center;

}



@media (max-width: 768px) {

  .message-actions {

    gap: 8px;

  }



  .message-action-btn {

    height: 34px;

    padding: 0 12px;

    font-size: 12px;

  }

}

.copy-btn,

.copy-btn-clean {

  display: none !important;

}





.message-content{

  line-height: 1.75;

  white-space: normal;

}



.message-content p{

  margin: 0 0 12px;

}



.message-content br + br{

  display: block;

  content: "";

  margin-top: 10px;

}



.message-content mjx-container{

  margin: 8px 0 !important;

  max-width: 100% !important;

  overflow-x: auto !important;

  overflow-y: hidden !important;

}

.code-entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #eef4ff;
  color: #2b7cff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #d8e6ff;
  transition: all 0.2s ease;
}

.code-entry-btn:hover {
  background: #2b7cff;
  color: #fff;
  border-color: #2b7cff;
  text-decoration: none;
}

.code-entry-btn i {
  font-size: 15px;
}

/* Video Generation Styles */
.video-bubble-premium {
  padding: 0 !important;
  border: 1px solid var(--stroke) !important;
  overflow: hidden;
  background: #000 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
  margin-top: 10px;
}

.video-container-premium {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
}

.video-player-premium {
  width: 100%;
  height: auto;
  border-radius: 0;
  display: block;
}

.video-actions-premium {
  padding: 10px 15px;
  background: #1a1a1a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-label {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.8;
}

.video-download-btn {
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  background: var(--brand);
  border-radius: 8px;
  transition: all 0.2s;
}

.video-download-btn:hover {
  filter: brightness(1.1);
}