/* ============================================================
   BRU LEARNING - Mobile App Stylesheet
   Phong cách: Sáng tạo, Thiết kế App, Màu xanh lá chủ đạo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #00d26a;
  /* Xanh lá chủ đạo mới */
  --primary-dark: #00b058;
  --secondary: #f0ad4e;
  --accent: #ff8e53;
  --bg-main: #f8f9fa;
  /* Nền sáng */
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --glass-border: rgba(0, 0, 0, 0.05);
  /* Viền xám rất nhạt */
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --success: #10b981;
  --danger: #ef4444;
  --info: #3b82f6;
  --warning: #f59e0b;

  --gradient-primary: linear-gradient(135deg, #00d26a, #10b981);
  --gradient-green: linear-gradient(135deg, #10b981, #34d399);
  --gradient-blue: linear-gradient(135deg, #3b82f6, #60a5fa);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #a78bfa);
  --gradient-orange: linear-gradient(135deg, #f59e0b, #fbbf24);

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --shadow-glow: 0 8px 24px rgba(0, 210, 106, 0.25);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-bottom-nav: 0 -4px 16px rgba(0, 0, 0, 0.05);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --app-max-width: 480px;
  /* Khung chuẩn cho Mobile */
}

/* Các lớp tiện ích màu */
.text-muted {
  color: var(--text-muted) !important;
}

.text-dark {
  color: var(--text-dark) !important;
}

.text-primary-app {
  color: var(--primary) !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: #e5e7eb;
  /* Nền viền xám nếu xem trên PC */
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: var(--app-max-width);
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
  /* Viền ảo trên PC */
  padding-bottom: 80px;
  /* Nhường chỗ cho Bottom Nav */
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* ===== APP HEADER (Khác navbar cũ) ===== */
.app-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-direction: row !important;
  flex-wrap: nowrap;
}

.app-header.with-shadow {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.user-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e6f9f0;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  position: relative;
}

.user-avatar i {
  font-size: 1.2rem;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-avatar .badge {
  position: absolute;
  bottom: 0px;
  right: 0px;
  background: var(--primary);
  color: white;
  font-size: 0.55rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 2px solid white;
}

.user-greeting {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  line-height: 1.2;
}

.user-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.btn-bell {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e6f9f0;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ===== SEARCH BAR ===== */
.search-bar-wrap {
  padding: 0 20px 16px 20px;
}

.app-search {
  position: relative;
}

.app-search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.app-search input {
  width: 100%;
  height: 48px;
  background: #f1f3f5;
  border: none;
  border-radius: 24px;
  padding: 0 20px 0 44px;
  font-size: 0.95rem;
  color: var(--text-dark);
  outline: none;
}

.app-search input::placeholder {
  color: #9ca3af;
}

/* ===== APP CARDS ===== */
.app-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0 20px 20px 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--glass-border);
}

/* ===== TYPOGRAPHY HEADINGS ===== */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 20px 12px 20px;
}

.section-heading h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.section-heading .see-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

/* ===== CATEGORIES ===== */
.cat-row {
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  margin-bottom: 24px;
  gap: 12px;
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-dark);
}

.cat-icon {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.cat-icon.green {
  background: #e6f9f0;
  color: #10b981;
}

.cat-icon.blue {
  background: #eff6ff;
  color: #3b82f6;
}

.cat-icon.gray {
  background: #f3f4f6;
  color: #4b5563;
}

.cat-name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== SUGGESTION LIST ===== */
.suggestion-list {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sugg-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--text-dark);
}

.sugg-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.sugg-icon.orange {
  background: #fff7ed;
  color: #f97316;
}

.sugg-icon.blue {
  background: #eff6ff;
  color: #3b82f6;
}

.sugg-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-dark);
}

.sugg-content p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sugg-arrow {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  transition: var(--transition);
}

.sugg-item:hover .sugg-arrow {
  background: #f1f3f5;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-width);
  height: 65px;
  background: white;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: var(--shadow-bottom-nav);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #9ca3af;
  text-decoration: none;
  flex: 1;
  height: 100%;
  transition: var(--transition);
}

.nav-item i {
  font-size: 1.4rem;
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 600;
}

.nav-item.active {
  color: var(--primary);
}

/* ===== HERO BANNER ===== */
.hero-banner {
  margin: 0 20px 24px 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: 180px;
  background: linear-gradient(135deg, #1a3a2a 0%, #2d6a4f 50%, #52b788 100%);
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.1) 100%);
}

.hero-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
}

.hero-tag {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  text-transform: uppercase;
  align-self: flex-start;
}

.hero-title {
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.hero-sub {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.hero-btn {
  background: white;
  color: var(--text-dark);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  text-decoration: none;
}

/* PROGRESS BAR */
.progress-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.progress-pct {
  font-size: 1.2rem;
  font-weight: 800;
}

.progress-sub {
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.track-bar {
  height: 10px;
  background: #e6f9f0;
  border-radius: 5px;
  overflow: hidden;
}

.track-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 5px;
}

/* FORMS & AUTH */
.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: white;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.form-control-app {
  width: 100%;
  background: #f1f3f5;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 16px;
  color: var(--text-dark);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-control-app:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(0, 210, 106, 0.1);
}

.btn-primary-app {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary-app:hover {
  background: var(--primary-dark);
}

/* CHAT BUBBLES */
.chat-container {
  padding: 20px;
}

.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

.chat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 1rem;
  line-height: 1.5;
  position: relative;
  display: inline-block;
  max-width: 85%;
  font-weight: 500;
}

.chat-bubble.bru {
  background: var(--primary);
  color: white;
  border-top-left-radius: 4px;
}

.chat-bubble.vi {
  background: white;
  color: var(--text-dark);
  border: 1px solid #e5e7eb;
  border-top-left-radius: 4px;
}

.chat-play {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  cursor: pointer;
  vertical-align: middle;
}

.chat-bubble.bru .chat-play {
  background: rgba(0, 0, 0, 0.15);
  color: white;
}

.chat-bubble.vi .chat-play {
  background: #e6f9f0;
  color: var(--primary);
}

.chat-avatar-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e6f9f0;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* QUIZ OPTIONS */
.app-header-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-secondary .back-btn {
  font-size: 1.4rem;
  color: var(--text-dark);
  text-decoration: none;
}

.app-header-secondary .title {
  font-size: 1.15rem;
  font-weight: 700;
}

.app-header-secondary .action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 1rem;
}

.quiz-option {
  padding: 18px 20px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: white;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  transition: var(--transition);
}

.quiz-option.active {
  border-color: var(--primary);
  background: #e6f9f0;
}

.quiz-option.correct {
  border-color: var(--success);
  background: #e6f9f0;
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.quiz-option i {
  color: var(--text-muted);
  font-size: 1.2rem;
  opacity: 0.5;
}

.bottom-action-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-width);
  padding: 20px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 16px;
  z-index: 10;
}

.btn-secondary-app {
  flex: 1;
  background: #f1f3f5;
  color: var(--text-dark);
  border: none;
  border-radius: 20px;
  padding: 16px;
  font-weight: 700;
  font-size: 0.95rem;
}

.btn-primary-action {
  flex: 2;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 16px;
  font-weight: 700;
  font-size: 0.95rem;
}

/* DICTIONARY BARS */
.dict-filter {
  display: flex;
  background: #f1f3f5;
  border-radius: 24px;
  padding: 4px;
  margin: 0 20px 24px 20px;
}

.dict-filter button {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 20px;
}

.dict-filter button.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alpha-slider {
  position: fixed;
  right: 0;
  top: 250px;
  bottom: 80px;
  width: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 0;
  z-index: 10;
  background: rgba(248, 249, 250, 0.9);
  border-left: 1px solid #f3f4f6;
}

.alpha-slider a {
  color: inherit;
  text-decoration: none;
  padding: 2px 0;
}

.alpha-slider a.active {
  color: var(--primary);
}

/* FLASHCARDS DICTIONARY */
.dict-card {
  background: #e6f9f0;
  border-radius: var(--radius-md);
  padding: 30px 24px;
  margin: 0 20px 24px 20px;
  position: relative;
}

.dict-word {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}

.dict-phonetic {
  color: rgba(0, 210, 106, 0.7);
  font-size: 1rem;
  margin-bottom: 12px;
  font-style: italic;
}

.dict-badge {
  display: inline-block;
  background: rgba(0, 210, 106, 0.15);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dict-play-btn {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 210, 106, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 20px 12px 20px;
  display: flex;
  justify-content: space-between;
}

.section-label a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.8rem;
}

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  margin: 0 20px 12px 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.fav-item-word {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.fav-item-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fav-item i {
  color: var(--primary);
  font-size: 1.4rem;
}

/* UTILITIES */
.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 16px;
}

.mb-4 {
  margin-bottom: 24px;
}

.mt-3 {
  margin-top: 16px;
}

.mt-4 {
  margin-top: 24px;
}

/* Admin Base Override (For compatibility) */
.sidebar {
  background: #1f2937;
}

/* Biểu tượng thông báo toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: white;
  color: var(--text-dark);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

.toast-success {
  border-left: 4px solid var(--primary);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-info {
  border-left: 4px solid var(--info);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* ===== APP CORE BUTTON (btn-primary-app) ===== */
/* Nút xanh lá chính - Dùng cho form thêm mới / submit */
.btn-primary-app {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  text-align: center;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 210, 106, 0.3);
}

.btn-primary-app:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 210, 106, 0.4);
  color: white;
}

.btn-primary-app:active {
  transform: translateY(0);
}

/* ===== APP CARD (app-card) ===== */
/* Card dùng trong các trang admin / form */
.app-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}

/* ===== INPUT GROUP (input-group-app) ===== */
/* Khung nhập liệu với icon bên trái */
.input-group-app {
  position: relative;
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 0 16px;
  height: 52px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.input-group-app:focus-within {
  border-color: var(--primary);
  background: white;
}

.input-group-app .icon-left {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.input-group-app input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.input-group-app input::placeholder {
  color: #d1d5db;
}

.input-group-app .icon-right {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.form-label-app {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  margin-top: 4px;
}