/* ===== BIẾN CƠ BẢN ===== */
:root {
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --spotify-black: #121212;
  --spotify-grey: #1e1e1e;
  --spotify-light: #2a2a2a;
  --spotify-accent: #1db954;
  --spotify-text: #b3b3b3; /* chữ xám sáng */
  --spotify-heading: #ffffff; /* tiêu đề (không đổi theo theme) */
  --spotify-white: #fff;
  --bg-input-area: rgba(255, 255, 255, 0.85); /* Nền trắng mờ */
  --border-main: rgba(0, 0, 0, 0.1);     /* Viền chung */
  --bg-input-form: rgba(0, 0, 0, 0.03);       /* Nền form xám siêu nhạt */
  --bg-footer: #f8f8f8;                  /* Nền footer sáng */
  --text-footer: #555;                   /* Chữ footer sáng */
  --backdrop-blur: 10px;
}


/* Screen Reader Only (Accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== LIGHT MODE ===== */
html.light {
  --spotify-black: #ffffff;
  --spotify-grey: #f5f5f5;
  --spotify-light: #e5e5e5;
  --spotify-accent: #1db954;
  --spotify-text: #333333; /* chữ tối */
  --spotify-heading: #000000;
}

/* Light Theme Overrides */
.light #file-staging-area {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

.light .file-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.light .file-card:hover {
  background: rgba(0, 0, 0, 0.05);
}

.light .file-name {
  color: #2c2c2c;
}

.light #prompt-input {
  color: #2c2c2c;
}

.light #prompt-input::placeholder {
  color: #999;
}

/* Đổi màu chữ input ở light mode */
html.light #prompt-input {
  color: var(--spotify-text);
}

html.light .message.user {
  color: #fff;
}

/* Overrides mới từ "Enhancements" */
.light .shortcuts-content {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

.light .shortcuts-header,
.light .shortcuts-footer {
  border-color: rgba(0, 0, 0, 0.1);
}

.light .shortcut-row {
  background: rgba(0, 0, 0, 0.03);
}

.light .shortcut-row:hover {
  background: rgba(0, 0, 0, 0.05);
}

.light .shortcut-row span {
  color: #2c2c2c;
}

.light .close-shortcuts {
  color: #666;
}

.light .close-shortcuts:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #2c2c2c;
}

.light .username {
  color: #2c2c2c;
}

.light .version-info small {
  color: #666;
}

.light .chat-input-area {
  background-color: #fff;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
  .toast-notification {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  #file-staging-area {
    max-height: 200px;
  }

  .message {
    max-width: 95%;
  }

  /* Rules mới từ "Enhancements" */
  .shortcuts-content {
    width: 95%;
    max-height: 90vh;
  }

  .shortcuts-header,
  .shortcuts-body,
  .shortcuts-footer {
    padding: 1rem;
  }

  .shortcut-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Keyboard Shortcut Hints */
.shortcut-hint {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #888;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
}

.shortcut-hint.visible {
  opacity: 1;
}

.shortcut-key {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: monospace;
  color: #1db954;
}

/* ---------- CÁC THÀNH PHẦN CẦN GIỮ TRẮNG ---------- */
.sidebar h2,
.main-chat-header h1 {
  color: var(--spotify-heading);
}

/* ---------- CÁC THÀNH PHẦN THEO THEME ---------- */
body,
.chat-select-btn,
.message.assistant,
#prompt-input::placeholder,
.file-name,
.faq-item ul {
  color: var(--spotify-text);
}

body,
html {
  height: 100%;
  margin: 0;
  background: var(--spotify-black);
  color: var(--spotify-text);
  overflow: hidden; /* Ngăn cả trang cuộn */
}

/* ---------- SCROLL-BAR “mỏng + transparent” ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--spotify-accent);
}

#file-staging-area::-webkit-scrollbar,
#prompt-input::-webkit-scrollbar {
  width: 6px;
}

#file-staging-area::-webkit-scrollbar-track,
#prompt-input::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#file-staging-area::-webkit-scrollbar-thumb,
#prompt-input::-webkit-scrollbar-thumb {
  background: rgba(29, 185, 84, 0.5);
  border-radius: 3px;
}

#file-staging-area::-webkit-scrollbar-thumb:hover,
#prompt-input::-webkit-scrollbar-thumb:hover {
  background: rgba(29, 185, 84, 0.7);
}

/* ---------- NAVBAR (Đã gộp "Enhancements") ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: var(--spotify-grey);
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

/* (MỚI) Từ "Enhancements" */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
}

/* (MỚI) Từ "Enhancements" */
.navbar-brand span {
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* (MỚI) Từ "Enhancements" */
.username {
  font-weight: 600;
  color: #e0e0e0;
}

/* (MỚI) Từ "Enhancements" */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(29, 185, 84, 0.3);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--spotify-text);
  font-size: 0.875rem;
}
.navbar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--spotify-light);
}

/* ---------- FOOTER (Đã gộp "Enhancements") ---------- */
.footer {
  grid-area: footer;
  background: var(--spotify-grey);
  border-top: 1px solid #000;
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--spotify-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* (MỚI) Từ "Enhancements" */
.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* (MỚI) Từ "Enhancements" */
.footer-links a,
.footer-links button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: #888;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

/* (MỚI) Từ "Enhancements" */
.footer-links a:hover,
.footer-links button:hover {
  color: #1db954;
}

/* (MỚI) Từ "Enhancements" */
.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ---------- LAYOUT GRID (Updated - No FAQ Panel) ---------- */
body {
  display: grid;
  grid-template-areas:
    "nav  nav"
    "side main"
    "foot foot";
  grid-template-columns: 280px 1fr;
  grid-template-rows: 56px 1fr auto;
  height: 100vh;
  margin: 0;
  font-family: var(--font-main);
}
.navbar {
  grid-area: nav;
}
.sidebar {
  grid-area: side;
}
.main-chat {
  grid-area: main;
}
.footer {
  grid-area: foot;
}

/* ---------- RESPONSIVE (Không đổi) ---------- */
@media (max-width: 900px) {
  body {
    grid-template-areas:
      "nav"
      "main"
      "foot";
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr auto;
  }
  .sidebar {
    display: none;
  }
}

/* ---------- SIDEBAR (SỬA) ---------- */
.sidebar {
  background: var(--spotify-grey);
  padding: 1rem; /* Giảm padding 1 chút */
  display: flex;
  flex-direction: column;
  border-right: 1px solid #000;
  overflow-y: auto; /* (THÊM) Cho phép cuộn khi danh sách chat dài */
}
.sidebar h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--spotify-white);
  margin-bottom: 0.25rem;
}

/* (MỚI) Từ "Enhancements", thay thế #new-chat-btn */
/* New Chat Button Enhancement */
.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  color: white;
  border: none;
  border-radius: 5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.new-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(29, 185, 84, 0.4);
}

.new-chat-btn:active {
  transform: translateY(0);
}

.new-chat-btn svg {
  transition: transform 0.2s;
}

.new-chat-btn:hover svg {
  transform: rotate(90deg);
}

#chat-list-container {
  overflow-y: auto;
  flex: 1;
}
.chat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
}
.chat-item:hover {
  background: var(--spotify-light);
}
.chat-item.selected {
  background: rgba(29, 185, 84, 0.25);
  color: var(--spotify-accent);
}
.chat-select-btn {
  background: none;
  border: none;
  color: var(--spotify-text);
  flex: 1;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-delete-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 0.8rem;
  padding: 0.25rem;
  cursor: pointer;
  flex-shrink: 0; /* Không bị co lại */
}
.chat-delete-btn:hover {
  color: #fff;
}

/* ---------- MAIN CHAT (SỬA LAYOUT) ---------- */
.main-chat {
  display: flex;
  flex-direction: column;
  background: var(--spotify-black);
  padding: 0;
  overflow: hidden;
}
.main-chat-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--spotify-white);
}
#messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
/* Bong bóng chat */
.message {
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  max-width: 85%;
  line-height: 1.6;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  margin-left: auto;
  background: var(--spotify-accent);
  color: #000; /* Chữ đen/trắng sẽ tự xử lý theo theme */
}

.message.assistant {
  align-self: flex-start;
  background: var(--spotify-black);
  border: 1px solid var(--spotify-text);
}
.message.loading {
  background: rgba(29, 185, 84, 0.1);
  border: 1px dashed rgba(29, 185, 84, 0.5);
}

/* Định dạng markdown trong chat */
.message p {
  margin: 0 0 0.5rem 0;
}
.message p:last-child {
  margin-bottom: 0;
}
.message ul,
.message ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

/* ---------- INPUT AREA ---------- */
.chat-input-area {
  padding: 1rem;
  background: rgba(18, 18, 18, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

#chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 0.5rem;
  transition: all 0.3s;
}

#chat-form:focus-within {
  border-color: rgba(29, 185, 84, 0.5);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.1);
}

#prompt-input {
  flex: 1;
  min-height: 45px;
  max-height: 200px;
  overflow-y: auto;
  resize: none;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--spotify-light);
  color: var(--spotify-text);
  caret-color: var(--spotify-accent);
  box-sizing: border-box;
  transition: height 0.1s ease-out;
}
#prompt-input::placeholder {
  color: #666;
}
#prompt-input:focus {
  outline: none;
  border-color: var(--spotify-accent);
  box-shadow: 0 0 0 1px var(--spotify-accent);
}

/* ===== ICON BUTTONS – (HỢP NHẤT) ===== */
.icon-btn {
  flex-shrink: 0;
  width: 45px;
  height: 45px;
  padding: 0;
  border: 1px solid var(--spotify-light);
  border-radius: 12px;
  background: var(--spotify-light);
  color: var(--spotify-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.18s ease;
}

.icon-btn:hover {
  background: var(--spotify-accent);
  border-color: var(--spotify-accent);
  color: #000;
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn.send {
  background: var(--spotify-accent);
  border-color: var(--spotify-accent);
  color: #000;
}
.icon-btn.send:hover {
  filter: brightness(1.15);
  border-color: var(--spotify-accent);
}

.icon-btn.round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.icon-btn.round:hover {
  background: var(--spotify-accent);
  color: #000;
}

/* ---------- FLOATING HELP BUTTON ---------- */
.floating-help-btn {
  position: fixed;
  bottom: 9rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  border: none;
  border-radius: 50%;
  color: #000;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.4), 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  padding: 0;
}

.floating-help-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(29, 185, 84, 0.5), 0 12px 40px rgba(0, 0, 0, 0.4);
  filter: brightness(1.1);
}

.floating-help-btn:active {
  transform: translateY(-2px) scale(1.02);
}

.floating-help-btn svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.help-btn-text {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Pulse animation for attention */
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.7);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(29, 185, 84, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(29, 185, 84, 0);
  }
}

.floating-help-btn::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .floating-help-btn {
    width: 56px;
    height: 56px;
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .floating-help-btn svg {
    width: 24px;
    height: 24px;
  }

  .help-btn-text {
    font-size: 0.65rem;
  }
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* Drag and Drop Overlay */
.drag-over {
  position: relative;
}

.drag-over::after {
  content: "📎 Drop files here to upload";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(29, 185, 84, 0.95);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  z-index: 1000;
  border: 4px dashed rgba(255, 255, 255, 0.5);
  border-radius: 1rem;
  backdrop-filter: blur(8px);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.95;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* ---------- FILE STAGING (SỬA) ---------- */
#file-staging-area {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.file-staging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #1db954;
  font-weight: 600;
  font-size: 0.9rem;
}

.clear-all-btn {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-all-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.5);
}

.file-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.file-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(29, 185, 84, 0.5);
  transform: translateX(4px);
}

.file-icon {
  font-size: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.file-name {
  color: #e0e0e0;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  color: #888;
  font-size: 0.75rem;
}

.file-remove-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  transition: all 0.2s;
  flex-shrink: 0;
}

.file-remove-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.5);
  transform: scale(1.1);
}

/* Loading Animation - Improved */
.loading-dots {
  display: inline-flex;
  gap: 0.25rem;
  margin-right: 0.5rem;
}

.loading-dots span {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background: #1db954;
  border-radius: 50%;
  animation: loading-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes loading-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

#cv-upload-btn {
  position: relative;
  overflow: hidden;
}

#cv-upload-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(29, 185, 84, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

#cv-upload-btn:hover::before {
  width: 150%;
  height: 150%;
}

/* ========================================================================= */
/* CÁC BLOCK MỚI TỪ "ENHANCEMENTS" (ĐÃ GIỮ LẠI) */
/* ========================================================================= */

/* Version Info */
.version-info {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  opacity: 0.6;
}

.version-info small {
  font-size: 0.7rem;
  color: #888;
}

/* Keyboard Shortcuts Overlay */
.shortcuts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.shortcuts-content {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcuts-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #1db954;
}

.close-shortcuts {
  background: transparent;
  border: none;
  color: #888;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.close-shortcuts:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.shortcuts-body {
  padding: 1.5rem;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.5rem;
  transition: background 0.2s;
}

.shortcut-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.shortcut-row kbd {
  background: rgba(29, 185, 84, 0.1);
  border: 1px solid rgba(29, 185, 84, 0.3);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: #1db954;
  font-weight: 600;
  box-shadow: 0 2px 0 rgba(29, 185, 84, 0.2);
}

.shortcut-row span {
  color: #e0e0e0;
  font-size: 0.9rem;
}

.shortcuts-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.shortcuts-footer small {
  color: #888;
  font-size: 0.8rem;
}

.shortcuts-footer kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-family: monospace;
  font-size: 0.75rem;
  color: #1db954;
}

/* Empty State Styling */
#messages-container[data-empty-state="true"]::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath fill='%231db954' fill-opacity='0.05' d='M100 20 L120 60 L160 70 L130 100 L140 140 L100 120 L60 140 L70 100 L40 70 L80 60 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 150px;
  opacity: 0.3;
}

/* Improved Input Area */
.chat-input-area {
  position: relative;
}

.chat-input-area::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: none;
}

/* Focus Styles for Accessibility */
button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 2px solid #1db954;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .navbar-brand span {
    -webkit-text-fill-color: #1db954;
  }

  .faq-item kbd,
  .shortcut-row kbd {
    border-width: 2px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .sidebar,
  .floating-help-btn,
  .footer,
  .chat-input-area,
  .shortcuts-overlay,
  .features-modal {
    display: none !important;
  }

  .main-chat {
    width: 100%;
    height: auto;
  }

  #messages-container {
    height: auto;
    overflow: visible;
  }
}

/* ========================================================================= */
/* ===== STYLES CHO TRANG LOGIN ===== */
/* ========================================================================= */

/* Áp dụng khi body có class 'login-page' */
body.login-page {
  /* Hủy bỏ layout grid của chat */
  display: flex;
  grid-template-areas: none;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto; /* Cho phép cuộn nếu cần */
}

/* Ẩn các thành phần của chat UI trên trang login */
.login-page .navbar,
.login-page .sidebar,
.login-page .main-chat,
.login-page .floating-help-btn,
.login-page .footer {
  display: none;
}

.login-container {
  background: var(--spotify-grey);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow);
  animation: messageSlideIn 0.3s ease-out; /* Dùng lại animation có sẵn */
}

.login-container h1 {
  color: var(--spotify-heading);
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
}

.login-container .flashes {
  list-style: none;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem 0;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.3);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.login-form div {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--spotify-text);
  font-size: 0.875rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--spotify-light);
  background: var(--spotify-light);
  border-radius: var(--radius);
  color: var(--spotify-text);
  font-size: 1rem;
  box-sizing: border-box; /* Quan trọng */
  transition: 0.2s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: var(--spotify-accent);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.2);
}

.login-form button[type="submit"] {
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--spotify-accent);
  color: var(--spotify-black);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 0.5rem;
}

.login-form button[type="submit"]:hover {
  filter: brightness(1.15);
}

/* Tinh chỉnh light mode cho login */
.light .login-container {
  border-color: rgba(0, 0, 0, 0.1);
}
.light .login-form input[type="text"],
.light .login-form input[type="password"] {
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--spotify-text);
}
.light .login-form button[type="submit"] {
  color: var(--spotify-white); /* Chữ trắng trên nền xanh */
}

/* ========================================================================= */
/* ===== FEATURES MODAL (RE-STYLED FOR SMOOTHNESS) ===== */
/* ========================================================================= */

.features-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
  padding: 1rem; /* Thêm padding để không dính sát mép trên mobile */
}

.features-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7); /* Tối hơn một chút để tập trung */
  backdrop-filter: blur(5px); /* Hiệu ứng mờ nền đằng sau */
}

.features-modal-content {
  position: relative;
  /* Thay đổi background thành màu xám đậm chuẩn Spotify card */
  background: #282828;
  border: 1px solid rgba(255, 255, 255, 0.08); /* Viền trắng mờ rất nhẹ thay vì xanh */
  border-radius: 12px; /* Bo góc lớn hơn */
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.6); /* Bóng đổ sâu hơn */
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); /* Animation trượt mượt mà */
}

.features-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  /* Border dưới mờ nhẹ thay vì xanh */
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #282828; /* Giữ nền header đồng bộ */
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

.features-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #fff; /* Màu trắng thay vì xanh để sang trọng hơn */
  font-weight: 700;
  letter-spacing: -0.02em;
}

.close-features {
  background: transparent;
  border: none;
  color: #b3b3b3;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
}

.close-features:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: none; /* Bỏ scale để đỡ giật */
}

.features-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  /* Scrollbar tùy chỉnh */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Scrollbar Chrome/Safari */
.features-modal-body::-webkit-scrollbar {
  width: 8px;
}
.features-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.features-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.features-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --- FEATURE SECTIONS (CARD STYLE) --- */
.feature-section {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  /* Nền tách biệt nhẹ nhàng thay vì viền */
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent; /* Ẩn viền mặc định */
  border-radius: 8px;
  transition: all 0.2s ease;
}

/* Hover vào section sẽ sáng lên nhẹ */
.feature-section:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.feature-section h3 {
  color: #fff; /* Tiêu đề section màu trắng */
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


.feature-section h4 {
  color: #1db954; /* Sub-header giữ màu xanh Spotify */
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.feature-section:first-child h4:first-of-type {
  margin-top: 0;
}

.feature-content p {
  color: #b3b3b3; /* Màu chữ xám chuẩn Spotify text */
  line-height: 1.6;
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
}

.feature-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 1rem 0;
}

.feature-content ul li {
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.5rem;
  color: #b3b3b3;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Dấu mũi tên danh sách */
.feature-content ul li::before {
  content: "•"; /* Dùng dấu chấm tròn đơn giản hoặc mũi tên nhỏ */
  position: absolute;
  left: 0;
  color: #1db954; /* Màu xanh điểm nhấn */
  font-weight: bold;
  font-size: 1.2em;
  line-height: 1.2;
}

.feature-content strong {
  color: #fff;
  font-weight: 600;
}

/* Code block style */
.code-block {
  background: #121212; /* Nền đen sâu */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 1rem;
  margin: 0.75rem 0;
  font-family: "JetBrains Mono", "Fira Code", monospace; /* Font code hiện đại hơn nếu có */
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e0e0e0;
}

.features-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  flex-shrink: 0;
  background: #282828;
  border-radius: 0 0 12px 12px;
}

.features-modal-footer small {
  color: #666;
  font-size: 0.8rem;
}

/* --- HELP SHORTCUTS STYLING (New Style Compatible) --- */
.help-shortcuts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* Responsive: Trên màn hình rộng chia 2 cột cho đẹp */
@media (min-width: 600px) {
  .help-shortcuts {
    grid-template-columns: 1fr 1fr;
  }
}

.help-shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2); /* Nền tối hơn section cha */
  border-radius: 6px;
  border: 1px solid transparent;
}

.help-shortcut-row:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.help-shortcut-desc {
  color: #b3b3b3;
  font-size: 0.85rem;
  font-weight: 500;
}

.help-shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.help-shortcut-keys kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.75rem;
  color: #fff;
  min-width: 1.2rem;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.help-shortcut-keys span {
  color: #666;
  font-size: 0.8rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .features-modal-content {
    max-height: 90vh;
    width: 100%;
  }

  .features-modal-header,
  .features-modal-body {
    padding: 1.25rem;
  }

  .feature-section {
    padding: 1rem;
  }
}
