﻿/* ==========================================================================
   HỆ THỐNG ĐA GIAO DIỆN NGỤY TRANG (MULTI-DISGUISE THEMES)
   1. Google Sheets (Mặc định)
   2. Gmail Web (Clone 100% Hộp thư Google)
   3. Zalo Web (Clone 100% Ứng dụng chat Zalo)
   ========================================================================== */

/* Ẩn hiện các view theo theme */
.theme-view {
  display: none !important;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.theme-view.active {
  display: flex !important;
  flex-direction: column;
}

/* Nút đổi giao diện trên Header (Disguised Template Switcher) */
.theme-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f3f4;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-switch-btn:hover {
  background: #e8eaed;
  border-color: #bdc1c6;
}

/* ==========================================================================
   A. GIAO DIỆN GMAIL WEB (CLONE 100%)
   ========================================================================== */
.gmail-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #f6f8fc;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1f1f1f;
}

/* Header Gmail */
.gmail-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #f6f8fc;
  border-bottom: 1px solid transparent;
}

.gmail-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 240px;
}

.gmail-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #444746;
  font-size: 22px;
  font-weight: 400;
}

.gmail-search-bar {
  flex: 1;
  max-width: 720px;
  height: 48px;
  background: #eaf1fb;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  transition: all 0.2s;
}

.gmail-search-bar:focus-within {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gmail-search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: #1f1f1f;
}

.gmail-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Thân Gmail (Sidebar + Content) */
.gmail-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar Gmail */
.gmail-sidebar {
  width: 256px;
  padding: 12px 12px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gmail-compose-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #c2e7ff;
  color: #001d35;
  border: none;
  border-radius: 16px;
  padding: 0 24px;
  height: 56px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s;
}

.gmail-compose-btn:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.gmail-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gmail-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 24px;
  height: 32px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  color: #444746;
  cursor: pointer;
  transition: background 0.1s;
}

.gmail-menu-item:hover {
  background: #eaebef;
}

.gmail-menu-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 700;
}

.gmail-menu-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Khung đọc thư Gmail (Email Reading View) */
.gmail-main {
  flex: 1;
  background: #ffffff;
  border-radius: 16px;
  margin: 0 16px 16px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,0.1);
}

.gmail-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #f1f3f4;
}

.gmail-email-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.gmail-email-subject {
  font-size: 22px;
  font-weight: 400;
  color: #1f1f1f;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gmail-tag-inbox {
  background: #ddf3e4;
  color: #0d652d;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.gmail-sender-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.gmail-sender-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gmail-sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.gmail-sender-name {
  font-size: 14px;
  font-weight: 700;
  color: #1f1f1f;
}

.gmail-sender-email {
  font-size: 12px;
  color: #5f6368;
}

.gmail-email-body {
  font-size: 14px;
  line-height: 1.7;
  color: #202124;
}

.gmail-email-body p {
  margin-bottom: 14px;
  text-align: justify;
}

.gmail-email-nav-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   B. GIAO DIỆN ZALO WEB (CLONE 100%)
   ========================================================================== */
.zalo-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #081c36;
}

/* Cột Navigation Zalo bên trái nhất (64px) */
.zalo-nav {
  width: 64px;
  height: 100%;
  background: #0068ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.zalo-nav-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.zalo-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #004ecc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.zalo-nav-item {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0.75;
  cursor: pointer;
  transition: all 0.15s;
}

.zalo-nav-item:hover, .zalo-nav-item.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

/* Cột danh sách hội thoại Zalo (340px) */
.zalo-conversations {
  width: 340px;
  height: 100%;
  border-right: 1px solid #e1e4ea;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.zalo-search-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f2f5;
}

.zalo-search-input-wrapper {
  flex: 1;
  height: 32px;
  background: #eaedf0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

.zalo-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
}

.zalo-chat-list {
  flex: 1;
  overflow-y: auto;
}

.zalo-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f6f7f9;
}

.zalo-chat-item:hover {
  background: #f3f5f8;
}

.zalo-chat-item.active {
  background: #e5efff;
}

.zalo-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #129af6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.zalo-chat-info {
  flex: 1;
  min-width: 0;
}

.zalo-chat-name {
  font-size: 14px;
  font-weight: 600;
  color: #081c36;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zalo-chat-preview {
  font-size: 12px;
  color: #72808e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

/* Khung Chat chính của Zalo */
.zalo-chat-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #eef0f3;
}

.zalo-chat-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e1e4ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.zalo-chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zalo-chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zalo-message-bubble {
  max-width: 75%;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #081c36;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  word-break: break-word;
}

.zalo-sender-label {
  font-size: 11px;
  font-weight: 700;
  color: #0068ff;
  margin-bottom: 4px;
}

.zalo-chat-footer {
  background: #ffffff;
  border-top: 1px solid #e1e4ea;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zalo-chat-toolbar-icons {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #72808e;
}

.zalo-input-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zalo-input-box input {
  flex: 1;
  height: 38px;
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  font-size: 14px;
}

/* ==========================================================================
   C. MODAL CHỌN GIAO DIỆN NGỤY TRANG (THEME SELECTOR MODAL)
   ========================================================================== */
.theme-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.theme-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 820px;
  max-width: 90vw;
  padding: 28px 32px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
}

.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.theme-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1f1f1f;
}

.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.theme-option-item {
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  position: relative;
}

.theme-option-item:hover {
  border-color: #1a73e8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26,115,232,0.15);
  background: #ffffff;
}

.theme-option-item.selected {
  border-color: #0b8043;
  background: #f0fdf4;
}

.theme-preview-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px auto;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-option-name {
  font-size: 16px;
  font-weight: 700;
  color: #1f1f1f;
  margin-bottom: 6px;
}

.theme-option-desc {
  font-size: 12px;
  color: #5f6368;
  line-height: 1.4;
}

/* ==========================================================================
   HOTKEY GUIDE MODAL (BẢNG TRA CỨU PHÍM TẮT NGỤY TRANG & THOÁT HIỂM)
   ========================================================================== */
.hotkey-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.hotkey-modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 780px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  box-sizing: border-box;
}

.hotkey-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e0e0e0;
}

.hotkey-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a73e8;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hotkey-section {
  margin-bottom: 22px;
}

.hotkey-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #5f6368;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hotkey-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 680px) {
  .hotkey-grid {
    grid-template-columns: 1fr;
  }
}

.hotkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.15s ease;
}

.hotkey-item:hover {
  background: #f1f3f4;
  border-color: #dadce0;
}

.hotkey-item.danger {
  background: #fef7f6;
  border-color: #fad2cf;
}
.hotkey-item.danger:hover {
  background: #fce8e6;
}

.hotkey-desc {
  font-size: 13px;
  color: #3c4043;
  font-weight: 500;
}

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

.hotkey-keys span {
  font-size: 11px;
  color: #70757a;
}

kbd {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  font-weight: 700;
  line-height: 1;
  color: #3c4043;
  background-color: #ffffff;
  border: 1px solid #c6c9cc;
  border-radius: 5px;
  box-shadow: 0 2px 0 #c6c9cc;
  white-space: nowrap;
}

.hotkey-notice {
  background: #e8f0fe;
  border-left: 4px solid #1a73e8;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #174ea6;
  line-height: 1.5;
  margin-top: 18px;
}

/* ==========================================================================
   RESPONSIVE DESIGN CHO GIAO DIỆN DI ĐỘNG (MOBILE & TABLET: <= 768px, <= 480px)
   Áp dụng đồng bộ cho cả 3 nền tảng: Google Sheets, Gmail Web, Zalo Web
   ========================================================================== */

/* ==========================================================================
   RESPONSIVE DESIGN CHO GIAO DIỆN DI ĐỘNG (MOBILE & TABLET: <= 768px, <= 480px)
   Áp dụng đồng bộ cho cả 3 nền tảng: Google Sheets, Gmail Web, Zalo Web
   ========================================================================== */

@media (max-width: 768px) {
  /* ------------------------------------------------------------------------
     1. TỔNG QUAN & BODY
     ------------------------------------------------------------------------ */
  body {
    overflow-x: hidden !important;
    -webkit-tap-highlight-color: transparent;
  }

  /* ------------------------------------------------------------------------
     2. GOOGLE SHEETS TRÊN MOBILE (KHẮC PHỤC TRIỆT ĐỂ ĐÈ HEADER & BỎ CỘT STT THỪA)
     ------------------------------------------------------------------------ */
  /* Ẩn hoàn toàn các phần tử rườm rà trên Mobile */
  #view-sheets .menu-bar,
  #view-sheets .sheets-toolbar,
  #view-sheets .star-btn,
  #view-sheets .move-btn,
  #view-sheets .save-status,
  #view-sheets .current-story-badge,
  #view-sheets .reading-hint-badge,
  #view-sheets .share-btn,
  #view-sheets .user-avatar,
  #view-sheets .circle-icon-btn[title="Lịch sử phiên bản"],
  #view-sheets .circle-icon-btn[title="Mở bảng lịch sử nhận xét"] {
    display: none !important;
  }

  /* Header Google Sheets: 1 hàng duy nhất cao 46px, không bao giờ đè nhau */
  #view-sheets .sheets-header {
    height: 46px !important;
    padding: 0 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e2e6 !important;
    overflow: hidden !important;
    gap: 6px !important;
  }

  #view-sheets .header-main-info {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
  }

  #view-sheets .doc-title-row {
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  #view-sheets .sheets-logo svg {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
  }

  #view-sheets .doc-title-input {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f1f1f !important;
    width: 100% !important;
    max-width: 150px !important;
    padding: 2px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border: none !important;
    background: transparent !important;
  }

  #view-sheets .header-right-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  /* Các nút hành động trên Header: thu gọn thành icon tròn nhỏ */
  #view-sheets .theme-switch-btn span,
  #view-sheets .boss-key-btn span {
    display: none !important; /* Ẩn chữ */
  }

  #view-sheets .theme-switch-btn {
    padding: 6px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #view-sheets .boss-key-btn {
    padding: 6px !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #view-sheets .circle-icon-btn {
    width: 32px !important;
    height: 32px !important;
  }

  /* Thanh công thức fx trên mobile */
  #view-sheets .formula-bar {
    height: 36px !important;
    padding: 0 6px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e2e6 !important;
    display: flex !important;
    align-items: center !important;
  }

  #view-sheets .name-box {
    width: 36px !important;
    font-size: 11px !important;
    padding: 2px 4px !important;
  }

  #view-sheets .formula-input {
    font-size: 13px !important;
    color: #444746 !important;
  }

  /* LƯỚI BẢNG TÍNH: BỎ CỘT STT THÊM VÀO, DÙNG TRỰC TIẾP ROW HEADER 1, 2, 3... CỦA GOOGLE SHEETS */
  #view-sheets .row-header {
    width: 36px !important;
    min-width: 36px !important;
    font-size: 11px !important;
    color: #5f6368 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Cột A chứa trực tiếp nội dung truyện: Chiếm trọn 100% bề ngang còn lại */
  #view-sheets .column-headers .col-header:nth-child(1) {
    width: calc(100vw - 38px) !important;
    min-width: calc(100vw - 38px) !important;
    font-size: 12px !important;
    text-align: left !important;
    padding-left: 10px !important;
  }

  #view-sheets .cell-item[data-col="A"] {
    width: calc(100vw - 38px) !important;
    min-width: calc(100vw - 38px) !important;
    font-size: 15px !important;
    line-height: 1.65 !important;
    padding: 10px 12px !important;
    color: #1f1f1f !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
  }

  /* ẨN TOÀN BỘ CÁC CỘT PHỤ B, C, D, E, F TRÊN MOBILE */
  #view-sheets .column-headers .col-header:nth-child(n+2),
  #view-sheets .cell-item[data-col="B"],
  #view-sheets .cell-item[data-col="C"],
  #view-sheets .cell-item[data-col="D"],
  #view-sheets .cell-item[data-col="E"],
  #view-sheets .cell-item[data-col="F"],
  #view-sheets .cell-item[data-col="G"] {
    display: none !important;
  }

  /* Thanh Tab dưới đáy */
  #view-sheets .sheets-bottom-bar {
    height: 42px !important;
    padding: 0 6px !important;
  }

  #view-sheets .sheet-tab {
    padding: 0 10px !important;
    font-size: 12px !important;
    max-width: 130px !important;
  }

  /* ------------------------------------------------------------------------
     3. GMAIL WEB TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .gmail-sidebar {
    display: none !important;
  }

  .gmail-header {
    height: 52px !important;
    padding: 0 10px !important;
    gap: 8px !important;
  }

  .gmail-logo {
    min-width: auto !important;
  }

  .gmail-logo span {
    display: none !important;
  }

  .gmail-search-box {
    max-width: none !important;
    flex: 1 !important;
    height: 38px !important;
  }

  .gmail-search-box span {
    font-size: 12px !important;
  }

  .gmail-header-right {
    min-width: auto !important;
    gap: 4px !important;
  }

  .gmail-header-right .theme-switch-btn span {
    display: none !important;
  }

  .gmail-header-right .theme-switch-btn {
    padding: 6px 8px !important;
    border-radius: 50% !important;
    min-width: 32px !important;
    height: 32px !important;
    justify-content: center !important;
  }

  .gmail-content-area {
    padding: 12px 10px !important;
  }

  .gmail-email-subject {
    font-size: 17px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin-bottom: 16px !important;
  }

  .gmail-sender-card {
    padding: 10px 0 !important;
  }

  .gmail-email-body {
    font-size: 15px !important;
    line-height: 1.65 !important;
  }

  .gmail-email-body p {
    margin-bottom: 14px !important;
  }

  .gmail-toolbar-right {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     4. ZALO WEB TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .zalo-nav {
    display: none !important;
  }

  .zalo-conversations {
    display: none !important;
  }

  .zalo-chat-area {
    width: 100vw !important;
    height: 100vh !important;
  }

  .zalo-chat-header {
    height: 52px !important;
    padding: 0 10px !important;
  }

  #zalo-chat-header-title {
    font-size: 14px !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .zalo-chat-header .theme-switch-btn span,
  .zalo-chat-header #btn-help-zalo span {
    display: none !important;
  }

  .zalo-chat-header .theme-switch-btn,
  .zalo-chat-header #btn-help-zalo {
    padding: 6px 8px !important;
    min-width: 32px !important;
    height: 32px !important;
    justify-content: center !important;
  }

  .zalo-messages {
    padding: 12px 8px !important;
  }

  .zalo-msg-bubble {
    max-width: 88% !important;
    padding: 10px 12px !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
  }

  .zalo-input-area {
    height: 50px !important;
    padding: 6px 10px !important;
  }

  .zalo-input-toolbar {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     5. CÁC MODAL TRÊN MOBILE
     ------------------------------------------------------------------------ */
  .theme-modal-card,
  .hotkey-modal-card {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    padding: 18px 16px !important;
  }

  .theme-options-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .theme-option-item {
    padding: 14px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    text-align: left !important;
  }

  .theme-option-icon {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  .theme-option-details {
    flex: 1 !important;
  }

  .theme-option-name {
    font-size: 15px !important;
    margin-bottom: 2px !important;
  }

  .theme-option-desc {
    font-size: 11.5px !important;
  }

  .search-modal-container {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 92vh !important;
    padding: 16px 14px !important;
  }

  .search-input-group {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .search-input-group .search-input {
    width: 100% !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }

  .search-input-group .modal-btn {
    width: 100% !important;
    height: 40px !important;
  }

  .chapter-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    max-height: 50vh !important;
  }

  .chapter-item {
    padding: 10px 8px !important;
    font-size: 12.5px !important;
  }

  /* ------------------------------------------------------------------------
     6. THANH ĐIỀU KHIỂN CHẠM NHANH TRÊN DI ĐỘNG (MOBILE QUICK ACTION BAR)
     ------------------------------------------------------------------------ */
  .mobile-touch-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(32, 33, 36, 0.92) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 28px !important;
    padding: 6px 12px !important;
    gap: 8px !important;
    z-index: 9999 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    align-items: center !important;
  }

  .mobile-touch-btn {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 8px !important;
    min-width: 44px !important;
    cursor: pointer !important;
    font-size: 10px !important;
    font-family: inherit !important;
    gap: 2px !important;
    border-radius: 12px !important;
    transition: background 0.15s ease !important;
  }

  .mobile-touch-btn:active {
    background: rgba(255, 255, 255, 0.2) !important;
  }

  .mobile-touch-btn svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor !important;
  }

  .mobile-touch-btn.danger {
    color: #ff6b6b !important;
  }

  .mobile-touch-btn.primary {
    color: #8ab4f8 !important;
  }
}

/* Ẩn Mobile Touch Bar trên màn hình Desktop (> 768px) */
@media (min-width: 769px) {
  .mobile-touch-bar {
    display: none !important;
  }
}


.zalo-header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f5;
  border: 1px solid #dcdfe4;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  color: #081c36;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.zalo-header-action-btn:hover {
  background: #e4e7ec;
  color: #0068ff;
  border-color: #0068ff;
}



/* ==========================================================================
   FEEDBACK & SUGGESTION CARD (ĐÓNG GÓP Ý KIẾN & Ý TƯỞNG KHÁCH HÀNG)
   ========================================================================== */
.feedback-suggestion-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px dashed #f59e0b;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.feedback-suggestion-card:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #d97706;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.16);
  transform: translateY(-1px);
}

.feedback-card-icon {
  width: 46px;
  height: 46px;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.feedback-card-content {
  flex: 1;
  min-width: 0;
}

.feedback-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 5px;
}

.feedback-badge-hot {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #ef4444;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.feedback-card-desc {
  font-size: 12.5px;
  color: #78350f;
  line-height: 1.5;
}

.feedback-card-desc b {
  color: #451a03;
}

.feedback-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #d97706;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.3);
  transition: all 0.15s ease;
}

.feedback-cta-btn:hover {
  background: #b45309;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.45);
  transform: translateY(-1px);
}


/* ==========================================================================
   TTS CORE ENGINE - LOADING MODAL (INDEXEDDB PROGRESS) & FLOATING WIDGET
   ========================================================================== */

/* 1. Modal tiến trình tải Model vào IndexedDB */
.tts-loading-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.tts-loading-card {
  background: #ffffff;
  border-radius: 16px;
  width: 520px;
  max-width: 92vw;
  padding: 24px 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  box-sizing: border-box;
}

.tts-loading-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.tts-loading-icon {
  width: 48px;
  height: 48px;
  background: #e8f0fe;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tts-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f1f1f;
  margin-bottom: 3px;
}

.tts-loading-subtitle {
  font-size: 12px;
  color: #5f6368;
}

.tts-progress-track {
  width: 100%;
  height: 8px;
  background: #e8eaed;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.tts-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a73e8, #4285f4);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.tts-progress-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 16px;
}

.tts-loading-note {
  background: #f8f9fa;
  border-left: 3px solid #1a73e8;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #3c4043;
  line-height: 1.45;
}

/* 2. Floating TTS Control Widget */
.tts-floating-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  animation: slideUp 0.2s ease-out;
}

.tts-widget-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid #dadce0;
  border-radius: 30px;
  padding: 6px 14px 6px 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.tts-speaker-icon {
  width: 34px;
  height: 34px;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.tts-speaker-icon.pulse {
  animation: pulseAnim 1.5s infinite;
  background: #1a73e8;
  color: #ffffff;
}

@keyframes pulseAnim {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(26, 115, 232, 0); }
  100% { transform: scale(1); }
}

.tts-status-col {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.tts-status-title {
  font-size: 11px;
  font-weight: 700;
  color: #1a73e8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tts-status-sub {
  font-size: 12px;
  color: #5f6368;
  font-weight: 500;
}

.tts-controls-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tts-btn-icon {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tts-btn-icon:hover {
  background: #f1f3f4;
  color: #1f1f1f;
}

.tts-btn-play {
  background: #1a73e8;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.35);
  transition: all 0.15s ease;
}

.tts-btn-play:hover {
  background: #1557b0;
  transform: scale(1.05);
}

.tts-speed-select {
  border: 1px solid #dadce0;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #3c4043;
  outline: none;
  cursor: pointer;
}

.tts-btn-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #70757a;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 50%;
}
.tts-btn-close:hover {
  color: #d93025;
}

/* 3. Hiệu ứng Highlight câu văn đang đọc trên giao diện */
/* Google Sheets Highlight */
.grid-row.tts-reading-row .cell-item[data-col="A"] {
  background: #e8f0fe !important;
  color: #174ea6 !important;
  font-weight: 500 !important;
  border-left: 3px solid #1a73e8 !important;
}

/* Zalo Chat Highlight */
.zalo-message-item.tts-reading-chat .zalo-msg-bubble {
  border: 2px solid #0068ff !important;
  box-shadow: 0 0 12px rgba(0, 104, 255, 0.25) !important;
}

/* Gmail Highlight */
.gmail-email-body p.tts-reading-email {
  background: #fef7e0;
  border-radius: 4px;
  padding: 2px 6px;
}

/* Tối ưu Mobile */
@media (max-width: 768px) {
  .tts-floating-widget {
    bottom: 74px !important;
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 92vw !important;
    max-width: 360px !important;
  }
  .tts-widget-inner {
    justify-content: space-between;
    padding: 6px 10px;
  }
}
