* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Roboto, sans-serif;
}

body {
  background: #fff;
  color: #111;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: #0f0f0f;
    color: #e5e5e5;
  }
  
  .app {
    background: #0f0f0f;
  }
}

/* Layout */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #fafafa;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  transform: translateX(-100%); /* Ẩn mặc định */
  transition: transform 0.3s ease;
  z-index: 1000;
}

/* Dark mode sidebar */
@media (prefers-color-scheme: dark) {
  .sidebar {
    background: #1a1a1a;
    border-right: 1px solid #333;
  }
}

.sidebar.show {
  transform: translateX(0);
}

.sidebar.hide {
  transform: translateX(-100%);
}

/* Desktop: sidebar hiện mặc định */
@media (min-width: 769px) {
  .sidebar {
    position: fixed;
    transform: translateX(0) !important; /* Hiện mặc định trên desktop */
    z-index: 1; /* Thấp hơn header trên desktop */
  }
  .sidebar.hide {
    transform: translateX(-100%) !important;
  }
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}
.logo {
  height: 28px;
}
.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #374151;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  background: #f3f4f6;
  color: #111;
}

/* Dark mode buttons */
@media (prefers-color-scheme: dark) {
  .toggle-btn {
    color: #e5e5e5;
  }
  
  .toggle-btn:hover {
    background: #333;
    color: #fff;
  }
}

.toggle-btn svg {
  width: 24px;
  height: 24px;
}

.chat-list {
  flex-grow: 1;
  padding: 0 1rem 1rem 1rem;
  overflow-y: auto;
}
.chat-item {
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #374151;
  transition: 0.2s;
}
.chat-item span {
  font-size: 1.1rem;
  opacity: 0.8;
}
.chat-item:hover {
  background: #f3f4f6;
  color: #111;
}
.chat-item.active {
  background: #2563eb;
  color: #fff;
}

/* Dark mode chat items */
@media (prefers-color-scheme: dark) {
  .chat-item {
    color: #e5e5e5;
  }
  
  .chat-item:hover {
    background: #333;
    color: #fff;
  }
  
  .chat-item.active {
    background: #3b82f6;
    color: #fff;
  }
}

/* Main */
.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2rem 2rem 2rem;
  transition: margin-left 0.3s ease;
  background: #fcfcfc;
}

/* Dark mode main */
@media (prefers-color-scheme: dark) {
  .main {
    background: #111111;
  }
}

/* Desktop: điều chỉnh margin khi sidebar ẩn */
@media (min-width: 769px) {
  .main {
    transition: margin-left 0.3s ease;
  }
  .main.sidebar-hidden {
    margin-left: 0;
  }
}
.main-header {
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: fixed;
  top: 24px;
  left: 7px;
  padding: 0px;
  z-index: 1000000;
  background: #fcfcfc;
  transition: width 0.3s ease;
}

/* Dark mode header */
@media (prefers-color-scheme: dark) {
  .main-header {
    background: #0f0f0f;
  }
}

/* Desktop: điều chỉnh header khi sidebar ẩn */
@media (min-width: 768px) {
  .main.sidebar-hidden .main-header {
    width: fit-content;
  }
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: #374151;
  transition: all 0.2s ease;
}

/* Dark mode menu button */
@media (prefers-color-scheme: dark) {
  .menu-btn {
    color: #e5e5e5;
  }
  
  .menu-btn:hover {
    background: #333;
    color: #fff;
  }
}

/* Desktop: hiện menu button khi sidebar ẩn */
@media (min-width: 769px) {
  .main.sidebar-hidden .main-header {
    display: flex;
  }
  .main.sidebar-hidden .menu-btn {
    display: flex;
    align-items: center;
  }
}

.menu-btn:hover {
  background: #f3f4f6;
  color: #111;
}

.menu-btn svg {
  width: 24px;
  height: 24px;
}
.badge {
  background: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #374151;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.main-content h1 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

/* Input box */
.input-box {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 0.6rem 1rem;
  width: 500px;
  max-width: 90%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.input-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
}
.send-btn {
  background: #2563eb;
  border: none;
  color: #fff;
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}
.send-btn:hover {
  background: #1d4ed8;
}
#mainContent {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
}

#mainContent iframe {
  width: 100%;
  height: calc(100vh - 60px);
  border: none;
  position: relative;
}

/* Dark mode iframe */
@media (prefers-color-scheme: dark) {
  #mainContent iframe {
    background: #0f0f0f;
  }
}

/* Icon chatbot */
.icon-chatbot {
  display: none;
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
  border-radius: 8px;
}

/* Dark mode icon */
@media (prefers-color-scheme: dark) {
  .icon-chatbot {
    filter: brightness(0.8);
  }
}

/* Sidebar overlay */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Dark mode overlay */
@media (prefers-color-scheme: dark) {
  #sidebar-overlay {
    background: rgba(0, 0, 0, 0.7);
  }
}
.toggle-btn,
.menu-btn {
  background: none;
  border: none;
  /* font-size: 1.2rem; */
  cursor: pointer;
  color: #374151;
}
.toggle-btn.active {
  font-weight: bold;
}
/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    z-index: 1001; /* Cao hơn header trên mobile */
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar.hide {
    transform: translateX(-100%);
  }
  .main {
    margin-left: 0;
    padding: 1rem;
  }
  .menu-btn {
    display: flex;
    align-items: end;
  }
  .main-header {
    width: fit-content;
    z-index: 1; /* Thấp hơn sidebar trên mobile */
    display: flex;
    justify-content: flex-start;
  }
  .main-content {
    justify-content: start;
  }
  #pageTitle{
    font-size: 20px;
  }
  .main-header{
    top: 26px;
    left: 10px;
  }
}

/* Dark mode responsive */
@media (prefers-color-scheme: dark) {
  @media (max-width: 768px) {
    .main {
      background: #0f0f0f;
    }
    
    .main-header {
      background: #0f0f0f;
    }
  }
}
