/*
Theme Name: Học Tiếng Trung
Theme URI: https://hoctiengtrung.vn
Author: CNL Team
Author URI: https://hoctiengtrung.vn
Description: Nền tảng học tiếng Trung online chuyên nghiệp cho người Việt - Dễ dàng, Hiệu quả, Bền vững.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cnl-learning
Tags: education, language-learning, chinese, responsive, custom-menu
*/

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --cnl-red: #E53935;
  --cnl-red-dark: #C62828;
  --cnl-red-light: #FFEBEE;
  --cnl-purple: #6C3FC5;
  --cnl-purple-light: #EDE7F6;
  --cnl-blue: #1565C0;
  --cnl-blue-light: #E3F2FD;
  --cnl-green: #2E7D32;
  --cnl-green-light: #E8F5E9;
  --cnl-orange: #E65100;
  --cnl-orange-light: #FFF3E0;
  --cnl-yellow: #F57F17;
  --cnl-teal: #00695C;
  --cnl-gray-50: #FAFAFA;
  --cnl-gray-100: #F5F5F5;
  --cnl-gray-200: #EEEEEE;
  --cnl-gray-300: #E0E0E0;
  --cnl-gray-400: #BDBDBD;
  --cnl-gray-500: #9E9E9E;
  --cnl-gray-600: #757575;
  --cnl-gray-700: #616161;
  --cnl-gray-800: #424242;
  --cnl-gray-900: #212121;
  --cnl-white: #FFFFFF;
  --cnl-black: #000000;
  --cnl-text-primary: #212121;
  --cnl-text-secondary: #616161;
  --cnl-text-hint: #9E9E9E;
  --cnl-border: #E0E0E0;
  --cnl-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --cnl-shadow-md: 0 2px 8px rgba(0,0,0,0.1);
  --cnl-shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --cnl-shadow-xl: 0 8px 40px rgba(0,0,0,0.15);
  --cnl-radius-sm: 6px;
  --cnl-radius-md: 10px;
  --cnl-radius-lg: 16px;
  --cnl-radius-xl: 24px;
  --cnl-radius-full: 9999px;
  --cnl-font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --cnl-font-chinese: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --cnl-transition: 0.2s ease;
  --cnl-header-height: 64px;
  --cnl-sidebar-width: 260px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--cnl-font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--cnl-text-primary);
  background: var(--cnl-white);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--cnl-red); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--cnl-text-primary); }

/* ===== UTILITY CLASSES ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.container-fluid { width: 100%; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-red { color: var(--cnl-red); }
.text-purple { color: var(--cnl-purple); }
.text-green { color: var(--cnl-green); }
.text-blue { color: var(--cnl-blue); }
.text-secondary { color: var(--cnl-text-secondary); }
.text-hint { color: var(--cnl-text-hint); }
.font-chinese { font-family: var(--cnl-font-chinese); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.rounded-sm { border-radius: var(--cnl-radius-sm); }
.rounded-md { border-radius: var(--cnl-radius-md); }
.rounded-lg { border-radius: var(--cnl-radius-lg); }
.rounded-full { border-radius: var(--cnl-radius-full); }
.shadow-sm { box-shadow: var(--cnl-shadow-sm); }
.shadow-md { box-shadow: var(--cnl-shadow-md); }
.shadow-lg { box-shadow: var(--cnl-shadow-lg); }
.bg-white { background: var(--cnl-white); }
.bg-gray { background: var(--cnl-gray-50); }
.bg-red-light { background: var(--cnl-red-light); }
.bg-purple-light { background: var(--cnl-purple-light); }
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--cnl-radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--cnl-transition); white-space: nowrap;
  text-decoration: none; line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--cnl-red); color: var(--cnl-white); box-shadow: 0 2px 8px rgba(229,57,53,0.3); }
.btn-primary:hover { background: var(--cnl-red-dark); color: var(--cnl-white); box-shadow: 0 4px 16px rgba(229,57,53,0.4); }
.btn-purple { background: var(--cnl-purple); color: var(--cnl-white); box-shadow: 0 2px 8px rgba(108,63,197,0.3); }
.btn-purple:hover { background: #5530A8; color: var(--cnl-white); }
.btn-outline { background: transparent; color: var(--cnl-red); border: 1.5px solid var(--cnl-red); }
.btn-outline:hover { background: var(--cnl-red-light); color: var(--cnl-red); }
.btn-ghost { background: transparent; color: var(--cnl-text-secondary); }
.btn-ghost:hover { background: var(--cnl-gray-100); color: var(--cnl-text-primary); }
.btn-white { background: var(--cnl-white); color: var(--cnl-red); border: 1.5px solid var(--cnl-border); }
.btn-white:hover { background: var(--cnl-gray-50); color: var(--cnl-red); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon-lg { width: 44px; height: 44px; padding: 0; }

/* ===== FORM ELEMENTS ===== */
.form-input {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--cnl-border); border-radius: var(--cnl-radius-sm);
  font-size: 14px; color: var(--cnl-text-primary); background: var(--cnl-white);
  transition: border-color var(--cnl-transition); outline: none;
}
.form-input:focus { border-color: var(--cnl-purple); box-shadow: 0 0 0 3px rgba(108,63,197,0.1); }
.form-input::placeholder { color: var(--cnl-text-hint); }
.search-box {
  display: flex; align-items: center; background: var(--cnl-white); border: 1.5px solid var(--cnl-border);
  border-radius: var(--cnl-radius-full); padding: 0 6px 0 16px; gap: 8px;
}
.search-box:focus-within { border-color: var(--cnl-purple); box-shadow: 0 0 0 3px rgba(108,63,197,0.1); }
.search-box input { flex: 1; border: none; outline: none; font-size: 14px; padding: 10px 0; background: transparent; }

/* ===== TAGS & BADGES ===== */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--cnl-radius-full);
  font-size: 12px; font-weight: 600; line-height: 1;
}
.badge-hsk1 { background: #E8F5E9; color: #2E7D32; }
.badge-hsk2 { background: #E3F2FD; color: #1565C0; }
.badge-hsk3 { background: #FFF3E0; color: #E65100; }
.badge-hsk4 { background: #F3E5F5; color: #6A1B9A; }
.badge-hsk5 { background: #FFEBEE; color: #C62828; }
.badge-hsk6 { background: #212121; color: #FFFFFF; }
.badge-basic { background: #E8F5E9; color: #2E7D32; }
.badge-elementary { background: #E3F2FD; color: #1565C0; }
.badge-intermediate { background: #FFF3E0; color: #E65100; }
.badge-advanced { background: #FFEBEE; color: #C62828; }
.badge-red { background: var(--cnl-red-light); color: var(--cnl-red); }
.badge-purple { background: var(--cnl-purple-light); color: var(--cnl-purple); }
.badge-green { background: var(--cnl-green-light); color: var(--cnl-green); }
.badge-blue { background: var(--cnl-blue-light); color: var(--cnl-blue); }
.badge-gray { background: var(--cnl-gray-200); color: var(--cnl-gray-700); }
.tag {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: var(--cnl-radius-full); font-size: 12px; font-weight: 500;
  background: var(--cnl-gray-100); color: var(--cnl-text-secondary);
  border: 1px solid transparent; cursor: pointer; transition: all var(--cnl-transition);
}
.tag:hover, .tag.active { background: var(--cnl-red-light); color: var(--cnl-red); border-color: var(--cnl-red); }

/* ===== PROGRESS BARS ===== */
.progress-bar { height: 6px; background: var(--cnl-gray-200); border-radius: var(--cnl-radius-full); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: var(--cnl-radius-full); background: var(--cnl-purple); transition: width 0.6s ease; }
.progress-bar-fill.red { background: var(--cnl-red); }
.progress-bar-fill.green { background: var(--cnl-green); }
.progress-bar-fill.blue { background: var(--cnl-blue); }
.progress-bar-fill.orange { background: var(--cnl-orange); }
.progress-bar-fill.gradient { background: linear-gradient(90deg, var(--cnl-purple), var(--cnl-red)); }

/* ===== CARDS ===== */
.card {
  background: var(--cnl-white); border-radius: var(--cnl-radius-lg); box-shadow: var(--cnl-shadow-sm);
  border: 1px solid var(--cnl-gray-100); overflow: hidden; transition: all var(--cnl-transition);
}
.card:hover { box-shadow: var(--cnl-shadow-md); transform: translateY(-2px); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--cnl-gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--cnl-gray-100); }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 20px; font-weight: 700; color: var(--cnl-text-primary); }
.section-link { font-size: 13px; color: var(--cnl-purple); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.section-link:hover { color: var(--cnl-red); }
.section-link svg { transition: transform var(--cnl-transition); }
.section-link:hover svg { transform: translateX(3px); }

/* ===== AVATAR ===== */
.avatar { border-radius: var(--cnl-radius-full); object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }
.avatar-xxl { width: 96px; height: 96px; }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--cnl-border); margin: 16px 0; }

/* ===== CIRCULAR PROGRESS ===== */
.circular-progress { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.circular-progress svg { transform: rotate(-90deg); }
.circular-progress .value { position: absolute; font-weight: 700; }

/* ===== SKELETON LOADER ===== */
.skeleton { background: linear-gradient(90deg, var(--cnl-gray-200) 25%, var(--cnl-gray-100) 50%, var(--cnl-gray-200) 75%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--cnl-radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* ===== TOAST / NOTIFICATION ===== */
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; padding: 14px 20px; background: var(--cnl-gray-900); color: var(--cnl-white); border-radius: var(--cnl-radius-md); box-shadow: var(--cnl-shadow-xl); font-size: 14px; display: flex; align-items: center; gap: 10px; max-width: 360px; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--cnl-white); border-radius: var(--cnl-radius-xl); padding: 32px; max-width: 480px; width: 100%; box-shadow: var(--cnl-shadow-xl); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--cnl-text-secondary); padding: 4px; border-radius: var(--cnl-radius-sm); }
.modal-close:hover { background: var(--cnl-gray-100); }

/* ===== DROPDOWN ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; background: var(--cnl-white);
  border-radius: var(--cnl-radius-lg); box-shadow: var(--cnl-shadow-xl); border: 1px solid var(--cnl-gray-100);
  min-width: 200px; z-index: 100; overflow: hidden; opacity: 0; visibility: hidden;
  transform: translateY(-8px); transition: all var(--cnl-transition);
}
.dropdown:hover .dropdown-menu, .dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 14px; color: var(--cnl-text-primary); cursor: pointer; transition: background var(--cnl-transition); }
.dropdown-item:hover { background: var(--cnl-gray-50); }
.dropdown-divider { height: 1px; background: var(--cnl-border); margin: 4px 0; }

/* ===== TOOLTIP ===== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--cnl-gray-900); color: var(--cnl-white); padding: 5px 10px; border-radius: var(--cnl-radius-sm);
  font-size: 12px; white-space: nowrap; opacity: 0; visibility: hidden; transition: all 0.15s;
}
[data-tooltip]:hover::after { opacity: 1; visibility: visible; }

/* ===== ICON WRAPPER ===== */
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--cnl-radius-md); }
.icon-wrap-sm { width: 32px; height: 32px; }
.icon-wrap-md { width: 40px; height: 40px; }
.icon-wrap-lg { width: 48px; height: 48px; }
.icon-wrap-xl { width: 56px; height: 56px; }
.icon-wrap-red { background: var(--cnl-red-light); color: var(--cnl-red); }
.icon-wrap-purple { background: var(--cnl-purple-light); color: var(--cnl-purple); }
.icon-wrap-green { background: var(--cnl-green-light); color: var(--cnl-green); }
.icon-wrap-blue { background: var(--cnl-blue-light); color: var(--cnl-blue); }
.icon-wrap-orange { background: var(--cnl-orange-light); color: var(--cnl-orange); }

/* ===== STREAK / CALENDAR DOTS ===== */
.streak-days { display: flex; gap: 6px; }
.streak-day { width: 28px; height: 28px; border-radius: var(--cnl-radius-full); background: var(--cnl-gray-200); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--cnl-text-secondary); }
.streak-day.done { background: var(--cnl-purple); color: var(--cnl-white); }
.streak-day.today { background: var(--cnl-red); color: var(--cnl-white); }

/* ===== STAT CARDS ===== */
.stat-card { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--cnl-white); border-radius: var(--cnl-radius-lg); border: 1px solid var(--cnl-border); }
.stat-card-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--cnl-text-secondary); margin-top: 2px; }

/* ===== SCROLL STYLES ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cnl-gray-300); border-radius: var(--cnl-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--cnl-gray-400); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.animate-fadeIn { animation: fadeIn 0.4s ease; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-bounce { animation: bounce 1s ease infinite; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .section-title { font-size: 18px; }
  .modal { padding: 24px 20px; }
}
@media (max-width: 480px) {
  .btn-lg { padding: 12px 20px; font-size: 15px; }
  .container { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
