/* Reset Cơ Bản & Google Font */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Lato', sans-serif; /* Font hiện đại, dễ đọc */
  background-color: #f8f9fa; /* Màu nền xám rất nhạt */
  color: #343a40; /* Màu chữ chính đậm */
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
  border-bottom: 1px solid #dee2e6; /* Đường kẻ mảnh phân cách */
}

.app-header h1 {
  font-size: 2.5rem;
  color: #0056b3; /* Xanh dương đậm hơn */
  font-weight: 700;
  margin-bottom: 10px;
}

.app-header p {
    font-size: 1.1rem;
    color: #6c757d; /* Xám nhạt */
}

/* Card Style Chung */
.card {
  background-color: #ffffff;
  border-radius: 12px; /* Bo góc nhiều hơn */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Bóng đổ nhẹ nhàng */
  padding: 25px;
  margin-bottom: 30px;
  transition: box-shadow 0.3s ease-in-out;
}

.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); /* Tăng bóng khi hover */
}

.card h2, .card h3 {
  color: #0056b3;
  margin-bottom: 20px;
  font-weight: 700;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

/* Tổng Quan */
.stats-overview h2 {
    text-align: center;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
}
.stats-grid div {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 8px;
}
.stats-grid span {
    font-weight: 700;
    color: #0056b3;
}
.overall-averages p {
    text-align: center;
    font-size: 1.1rem;
    margin: 5px 0;
}
.overall-averages span {
    font-weight: bold;
}

/* Buttons */
.btn {
  border: none;
  padding: 12px 25px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-align: center;
}

.btn-primary {
  background-color: #007bff; /* Màu xanh dương chính */
  color: #fff;
}
.btn-primary:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

.btn-secondary {
  background-color: #6c757d; /* Màu xám */
  color: #fff;
}
.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
   box-shadow: 0 4px 8px rgba(108, 117, 125, 0.2);
}
.btn-cancel {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}
.btn-cancel:hover {
    background-color: #e2e6ea;
}
.btn-icon {
    background: none;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 8px 15px;
}
.btn-icon:hover {
    background-color: #e7f3ff;
     color: #0056b3;
}

#exportButton {
    display: block;
    margin: 25px auto 10px auto; /* Canh giữa */
    min-width: 250px;
}


/* Tabs */
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #dee2e6;
}

.tab-btn {
  background-color: transparent;
  color: #495057;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 8px 8px 0 0; /* Bo góc trên */
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent; /* Đường gạch dưới ẩn */
   font-weight: 600;
}

.tab-btn:hover {
  background-color: #e9ecef; /* Nền nhạt khi hover */
  color: #0056b3;
}

.tab-btn.active {
  color: #007bff;
  border-bottom: 3px solid #007bff; /* Đường gạch dưới màu xanh */
   font-weight: 700;
}

.tabs-content .tabContent {
  display: none; /* Mặc định ẩn */
  animation: fadeIn 0.5s ease-in-out;
}

.tabs-content .tabContent.active {
  display: block; /* Hiển thị tab active */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Forms */
.form-card {
    max-width: 700px; /* Giới hạn chiều rộng form */
    margin: 20px auto; /* Canh giữa form */
}

.form-group {
  margin-bottom: 20px;
  position: relative; /* Cho suggestion list */
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #495057;
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ced4da;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.form-group input[readonly] {
    background-color: #e9ecef; /* Nền xám nhạt */
    cursor: not-allowed; /* Con trỏ không cho phép */
    color: #6c757d; /* Màu chữ mờ */
}

.form-group textarea {
  min-height: 100px;
  resize: vertical; /* Cho phép thay đổi chiều cao */
}

.video-types {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 10px;
}
.video-types label {
    margin-bottom: 0; /* Bỏ margin bottom mặc định của label */
    margin-right: 5px;
    font-weight: 400;
    cursor: pointer;
}
.video-types input[type="radio"] {
    margin-right: 5px;
    cursor: pointer;
}

.form-buttons {
  display: flex;
  justify-content: flex-end; /* Đẩy nút về bên phải */
  gap: 10px;
  margin-top: 20px;
}
.form-buttons .btn {
    min-width: 100px; /* Chiều rộng tối thiểu */
}
.rating-buttons {
    justify-content: space-between; /* Nút Lưu và Xuất AI tách xa nhau */
}


/* Suggestions List */
#suggestions,
#videoSuggestions {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    width: calc(100% - 2px); /* Trừ border */
    z-index: 1000;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    list-style-type: none; /* Bỏ dấu chấm đầu dòng */
    padding: 0;
    margin-top: 2px;
    left: 0; /* Đảm bảo nó căn trái */
}
#suggestions li,
#videoSuggestions li {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}
#suggestions li:last-child,
#videoSuggestions li:last-child {
    border-bottom: none;
}
#suggestions li:hover,
#videoSuggestions li:hover {
    background-color: #e7f3ff; /* Màu xanh dương nhạt khi hover */
}

/* Tables */
.table-container {
    overflow-x: auto; /* Cho phép cuộn ngang nếu bảng quá rộng */
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

table th,
table td {
  border: 1px solid #dee2e6;
  padding: 12px 15px;
  text-align: left;
  vertical-align: middle;
}

table th {
  background-color: #e9ecef; /* Nền header xám nhạt */
  color: #495057;
  font-weight: 600;
  white-space: nowrap; /* Không xuống dòng tiêu đề */
}

table tr:nth-child(even) {
  background-color: #f8f9fa; /* Màu nền xen kẽ */
}
table tr:hover {
    background-color: #e7f3ff; /* Highlight khi hover */
}
.delete-button, .play-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 1.1rem;
}
.delete-button { color: #dc3545; /* Màu đỏ */ }
.delete-button:hover { color: #c82333; }
.play-button { color: #007bff; margin-left: 8px; }
.play-button:hover { color: #0056b3; }

#latestVideosTable img {
    width: 30px; /* Kích thước icon play nhỏ hơn */
    height: auto;
    cursor: pointer;
    vertical-align: middle;
}
#latestVideosTable td:nth-child(4) { /* Cột URL Video */
    text-align: center;
}
#latestVideosTable td:last-child { /* Cột Xóa video */
    text-align: center;
}


/* Video Player & Rating */
.video-rating-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); /* Cột linh hoạt */
    gap: 30px;
    align-items: start; /* Canh các card theo đỉnh */
}
.video-player-card {
    position: sticky; /* Giữ video player khi cuộn */
    top: 20px;
}
#videoPlayer iframe {
  width: 100%;
  aspect-ratio: 16 / 9; /* Giữ tỷ lệ khung hình */
  border-radius: 8px;
  border: 1px solid #dee2e6;
}
.video-type-display {
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    color: #6c757d;
}
.rating-form-container {
    /* Container cho 2 form chấm điểm */
}
.rating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Lưới cho select */
    gap: 15px;
}
.average-score {
    text-align: right;
    font-weight: bold;
    margin-top: 20px;
    font-size: 1.1rem;
    color: #28a745; /* Màu xanh lá */
}
.average-score span {
    color: #007bff;
}
.save-disabled-message {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 10px;
    text-align: right;
}

/* Latest Words - Flashcard Style */
.latest-words-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    align-items: start;
}
#wordDetails {
    text-align: center;
}
.selected-word-display {
    font-size: 2rem; /* To hơn */
    font-weight: 700;
    color: #007bff;
    margin: 15px 0;
}
.selected-meaning-display {
    font-size: 1.1rem;
    color: #495057;
}
.selected-notes-display {
    font-size: 0.95rem;
    color: #6c757d;
    margin-top: 15px;
    font-style: italic;
    line-height: 1.5;
}
.selected-notes-display span { /* Tô đỏ từ trong ví dụ */
    color: #dc3545;
    font-weight: 600;
}

.word-image-container {
    margin: 20px 0;
    min-height: 150px; /* Chiều cao tối thiểu phòng khi ảnh không tải được */
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden; /* Ẩn phần ảnh thừa */
}
#wordImage {
    max-width: 100%;
    max-height: 250px; /* Giới hạn chiều cao ảnh */
    height: auto;
    display: block;
    border-radius: 8px;
}
.word-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

/* Learn Word Tab */
.learn-word-card {
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}
#learnedWordsCount {
    font-weight: bold;
    color: #28a745;
}
.scramble-guide {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 10px;
}
.scrambled-word-display {
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 8px; /* Khoảng cách chữ */
    color: #007bff;
    margin: 20px 0;
    padding: 10px;
    background-color: #e7f3ff;
    border-radius: 8px;
    display: inline-block; /* Để background vừa chữ */
    font-family: monospace; /* Font chữ đều */
    text-transform: uppercase;
}
.meaning-hint {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 20px;
}
#userGuess {
    display: block;
    margin: 15px auto;
    max-width: 300px; /* Giới hạn chiều rộng input */
}
.game-message {
    margin-top: 15px;
    font-weight: bold;
    min-height: 24px; /* Giữ không gian cho message */
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 30px;
}
.chart-container canvas {
    width: 100% !important; /* Quan trọng để Chart.js hoạt động đúng */
    height: auto !important;
    max-height: 400px; /* Giới hạn chiều cao */
}


/* Responsive */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 2rem;
    }
     .stats-grid, .charts-section, .video-rating-container, .latest-words-container, .rating-grid {
        grid-template-columns: 1fr; /* 1 cột trên màn hình nhỏ */
    }
    .tabs-nav {
        justify-content: center;
    }
    .tab-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    .form-card, .learn-word-card {
        padding: 20px;
    }
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    #videoPlayer iframe {
        height: 250px;
    }
     .video-player-card {
        position: static; /* Bỏ sticky trên mobile */
    }
}

@media (max-width: 480px) {
     body { padding: 10px; }
    .container { padding: 0 10px; }
    .app-header h1 { font-size: 1.8rem; }
    .app-header p { font-size: 1rem; }
    .card { padding: 15px; }
    .card h2, .card h3 { font-size: 1.2rem; margin-bottom: 15px;}
    .stats-grid div { font-size: 1rem; padding: 12px; }
    .tab-btn { padding: 8px 10px; font-size: 0.85rem;}
    .form-group input[type="text"], .form-group textarea, .form-group select { padding: 10px; font-size: 0.95rem;}
    table th, table td { padding: 8px 10px; font-size: 0.9rem;}
    .selected-word-display { font-size: 1.6rem; }
    .scrambled-word-display { font-size: 1.8rem; letter-spacing: 6px; }
    .btn { padding: 8px 15px; font-size: 0.9rem; }
     .form-buttons { flex-direction: column; gap: 8px; } /* Nút xếp chồng lên nhau */
     .form-buttons .btn { width: 100%; }
     .rating-buttons { flex-direction: row; gap: 10px; } /* Giữ nút rating trên 1 hàng */
     .rating-buttons .btn { width: auto; flex: 1; } /* Chia đều không gian */
}
/* Styling for Usage Guide Section */
#usage-guide {
    display: none; /* <<<< Quan trọng: Ẩn phần hướng dẫn ban đầu */
    background-color: #e7f3ff;
    border: 1px solid #b8daff;
    margin-top: 30px;
    margin-bottom: 40px;
}

#usage-guide h2 {
    color: #0056b3;
    text-align: center;
    border-bottom: none;
    margin-bottom: 15px;
}

#usage-guide p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #343a40;
}
#usage-guide p:first-of-type {
    text-align: center;
    font-weight: 600;
}

#usage-guide ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 15px;
}

#usage-guide li {
    margin-bottom: 12px;
}

#usage-guide ul ul {
    list-style-type: circle;
    margin-top: 8px;
    margin-left: 25px;
}
#usage-guide ul ul li {
    margin-bottom: 8px;
}

#usage-guide strong {
    color: #0056b3;
    font-weight: 700;
}

#usage-guide em {
    color: #6c757d;
    font-size: 0.95rem;
}

#usage-guide p:last-of-type {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #b8daff;
}

/* Style for the toggle button */
#toggle-guide-btn {
    display: block; /* Nút chiếm 1 dòng */
    margin: 20px auto 0 auto; /* Canh giữa và tạo khoảng cách trên */
    min-width: 200px;
}

/* Optional: Style for btn-outline-info */
.btn-outline-info {
    color: #17a2b8;
    border-color: #17a2b8;
    background-color: transparent;
}
.btn-outline-info:hover {
    color: #fff;
    background-color: #17a2b8;
    border-color: #17a2b8;
     transform: translateY(-2px);
     box-shadow: 0 4px 8px rgba(23, 162, 184, 0.2);
}
/* Container chính của hộp chat */
.support-box {
  /* Giữ các thuộc tính vị trí, kích thước, nền, bóng đổ cũ */
  position: fixed;
  /* bottom: 80px; /* Có thể cần điều chỉnh vị trí Y */
  /* right: 20px; */
  bottom: 20px; /* Đặt lại vị trí gần nút gốc hơn nếu muốn */
  right: 20px;
  width: 500px; /* Chiều rộng tổng thể */
  height: 60vh; /* Chiều cao tổng thể */
  background: white;
  border-radius: 16px; /* Bo góc */
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden; /* Quan trọng */
  z-index: 1000;

  /* --- THAY ĐỔI QUAN TRỌNG --- */
  display: none; /* Mặc định ẩn */
  flex-direction: row; /* Sắp xếp con theo hàng ngang (header trái, iframe phải) */
}

/* Khi hộp chat được mở (có class visible) */
.support-box.visible {
  display: flex; /* Hiện và áp dụng flexbox */
}

/* Thanh header dọc bên trái */
.support-header-bar {
  background: #007bff; /* Màu nền xanh */
  color: white;
  width: 55px; /* Chiều rộng cố định cho thanh dọc */
  height: 100%; /* Chiều cao 100% của container */
  padding: 10px 0; /* Padding trên dưới */
  display: flex;
  flex-direction: column; /* Sắp xếp logo và nút đóng theo chiều dọc */
  justify-content: space-between; /* Đẩy logo lên trên, nút đóng xuống dưới */
  align-items: center; /* Căn giữa theo chiều ngang */
  flex-shrink: 0; /* Không cho phép thanh này co lại */
  box-sizing: border-box; /* Tính cả padding vào width */
}

/* Logo/Title trong header */
.support-header-bar .header-logo {
  font-size: 14px;
  font-weight: bold;
  margin-top: 10px; /* Khoảng cách trên */
  /* Có thể xoay chữ nếu muốn */
  /* writing-mode: vertical-rl; */
  /* transform: rotate(180deg); */
}

/* Phần chứa nút đóng */
.support-header-bar .header-controls {
   margin-bottom: 5px; /* Khoảng cách dưới */
}

/* Nút đóng (X) */
.support-header-bar .close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px; /* Kích thước nút X */
  cursor: pointer;
  padding: 0; /* Bỏ padding mặc định */
  line-height: 1; /* Căn chỉnh chiều cao */
}
 .support-header-bar .close-btn:hover {
   opacity: 0.8; /* Hiệu ứng hover đơn giản */
}


/* Iframe chứa nội dung chat */
.support-box iframe {
  flex-grow: 1; /* Chiếm hết không gian ngang còn lại */
  height: 100%; /* Chiếm hết chiều cao */
  border: none; /* Bỏ viền */
  width: auto; /* Để flex-grow kiểm soát chiều rộng */
}

/* --- CSS cho nút bật/tắt gốc --- */
.support-toggle-btn {
  /* Giữ nguyên CSS cũ cho nút này */
  position: fixed;
  bottom: 20px;
  right: 20px;
  /* ... các thuộc tính khác ... */
  z-index: 999; /* Nằm dưới hộp chat khi mở */
}

 /* --- Responsive cho màn hình nhỏ --- */
 @media (max-width: 768px) {
   .support-box {
     width: 95%;
     height: 80vh;
     bottom: 10px; /* Điều chỉnh vị trí */
     right: 2.5%;
   }
   .support-header-bar {
      width: 45px; /* Thu nhỏ thanh header */
   }
    .support-header-bar .header-logo {
       font-size: 12px;
    }
    .support-header-bar .close-btn {
       font-size: 20px;
    }
 }
/* --- CSS Nâng Cấp cho Nút Trợ Lý AI --- */
.support-toggle-btn {
  position: fixed;
  bottom: 25px; /* Hơi nâng lên một chút */
  right: 25px;  /* Hơi cách lề một chút */
  background: linear-gradient(145deg, #0088ff, #0061c5); /* Gradient xanh dương hiện đại */
  color: #fff;
  border: none;
  padding: 10px 20px; /* Điều chỉnh padding */
  border-radius: 12px; /* Bo góc vuông vắn hơn, hiện đại hơn */
  cursor: pointer;
  font-size: 16px;
  font-weight: 600; /* Giữ nguyên hoặc 500 */
  font-family: 'Roboto', sans-serif; /* Đảm bảo font được áp dụng */
  letter-spacing: 0.5px; /* Tăng khoảng cách chữ một chút */
  box-shadow: 0 4px 10px rgba(0, 97, 197, 0.2), /* Bóng mờ chính */
              0 1px 3px rgba(0, 0, 0, 0.1);       /* Bóng nhẹ gần hơn */
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); /* Transition mượt mà hơn */
  z-index: 999;
  display: inline-flex; /* Sử dụng flex để căn chỉnh icon và text */
  align-items: center;
  gap: 8px; /* Khoảng cách giữa icon và text */
  white-space: nowrap; /* Không xuống dòng */
}

.support-toggle-btn:hover {
  background: linear-gradient(145deg, #007ae0, #0055b0); /* Gradient đậm hơn khi hover */
  transform: translateY(-3px); /* Hiệu ứng nhấc lên nhẹ */
  box-shadow: 0 7px 18px rgba(0, 97, 197, 0.3), /* Bóng đổ rõ hơn khi hover */
              0 3px 6px rgba(0, 0, 0, 0.15);
}

.support-toggle-btn:active {
  transform: translateY(0px); /* Hiệu ứng nhấn xuống */
  background: #0056b3; /* Màu nền đậm khi nhấn */
  box-shadow: 0 2px 5px rgba(0, 97, 197, 0.2); /* Bóng đổ nhỏ hơn khi nhấn */
}
/* === THÊM CSS CHO NÚT TOÀN MÀN HÌNH === */

/* Style chung cho các nút điều khiển trong header AI */
.support-header-bar .control-btn,
.support-header-bar .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px; /* Đồng nhất kích thước với nút close */
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: opacity 0.2s ease;
    width: 30px; /* Đảm bảo nút có chiều rộng để click */
    height: 30px; /* Đảm bảo nút có chiều cao để click */
    display: flex; /* Căn giữa icon */
    align-items: center;
    justify-content: center;
}

.support-header-bar .control-btn:hover,
.support-header-bar .close-btn:hover {
    opacity: 0.8;
}

/* Sắp xếp các nút điều khiển trong header */
.support-header-bar .header-controls {
   display: flex;
   flex-direction: column; /* Xếp chồng dọc */
   align-items: center;
   gap: 8px; /* Khoảng cách giữa nút toàn màn hình và nút đóng */
   margin-bottom: 10px; /* Khoảng cách với đáy */
}


/* CSS cho container khi ở chế độ toàn màn hình */
#supportContainer:fullscreen {
    /* Có thể thêm style khác nếu muốn, ví dụ nền khác */
    background-color: #ffffff;
    padding: 0; /* Bỏ padding khi fullscreen */
    border-radius: 0; /* Bỏ bo góc khi fullscreen */
}

/* Căn chỉnh lại header và iframe khi fullscreen */
#supportContainer:fullscreen .support-header-bar {
   border-radius: 0;
}

#supportContainer:fullscreen iframe {
   border-radius: 0;
}

/* Ẩn nút bật/tắt gốc khi AI đang ở chế độ toàn màn hình */
/* Lưu ý: Selector này có thể không hoạt động 100% trên mọi trình duyệt */
#supportContainer:fullscreen ~ .support-toggle-btn {
    display: none !important; /* Ưu tiên ẩn nút gốc */
}

/* === KẾT THÚC CSS THÊM === */
/* ================================================== */
/* == CSS ĐÃ SỬA LỖI CĂN CHỈNH CHO NHÓM NÚT == */
/* ================================================== */

/* Container cho nhóm nút */
.button-group {
  display: flex;
  justify-content: center;
  align-items: center;    /* Giữ thuộc tính này, nó rất quan trọng */
  gap: 15px;
  margin-top: 25px;
  flex-wrap: wrap;
}

/* Style CHUNG và ĐỒNG BỘ cho tất cả các nút trong nhóm */
.button-group .btn {
  /* Các thuộc tính thống nhất để đảm bảo kích thước và căn chỉnh như nhau */
  display: inline-flex;   /* Căn chỉnh nội dung bên trong nút tốt hơn */
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;  /* Đặt border mặc định để đồng nhất chiều cao */
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  min-width: auto;
  transform: translateY(0); /* Đảm bảo không có hiệu ứng transform ban đầu */
}

/* Style cho 2 nút đầu tiên (nút có nền) */
#exportButton,
#exportVocabButton {
  background: linear-gradient(145deg, #0d6efd, #0a58ca);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}
#exportVocabButton {
    display: block;
    margin: 25px auto 10px auto;
    min-width: 250px;
}
/* Style riêng cho nút thứ 3 (nút viền) */
#toggle-guide-btn {
  background-color: #ffffff;
  border-color: #0d6efd; /* Sử dụng cùng mã màu xanh để đồng bộ */
  color: #0d6efd;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Hiệu ứng HOVER cho tất cả các nút */
.button-group .btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

/* Hiệu ứng HOVER riêng cho nút thứ 3 */
#toggle-guide-btn:hover {
  background-color: #e7f3ff; /* Thêm nền xanh rất nhạt khi hover */
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Hiệu ứng ACTIVE (khi nhấn) cho tất cả các nút */
.button-group .btn:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 123, 255, 0.2);
}
/* Tổng Quan - Bố cục Lưới Thống Kê MỚI */
.stats-grid {
    display: grid;
    /* Lưới đáp ứng, tự động chia cột */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* Thẻ thống kê MỚI */
.stat-item {
    background-color: #f8f9fa; /* Màu nền xám nhạt */
    border: 1px solid #e9ecef;
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.07);
}

/* Nhãn của thẻ MỚI */
.stat-label {
    display: block;
    font-size: 1rem;
    color: #6c757d; /* Chữ xám */
    margin-bottom: 8px;
}

/* Giá trị của thẻ MỚI */
.stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: #0056b3; /* Màu xanh dương đậm */
    line-height: 1.2;
}
/* === BẮT ĐẦU MÃ MỚI === */
/* Tối ưu hóa hiển thị cho biểu đồ nhện */
.chart-container canvas#speakingSpiderChart,
.chart-container canvas#readingSpiderChart {
    max-height: 450px; /* Tăng chiều cao tối đa cho biểu đồ nhện */
}

/* Đảm bảo canvas giữ đúng tỷ lệ khung hình */
.chart-container {
    position: relative;
    height: auto;
    width: 100%;
}
/* === KẾT THÚC MÃ MỚI === */