/* Core Design System - E-learning & Community */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap&subset=vietnamese');

:root {
  /* Light Mode Palette (Harmony HSL Blue/Indigo theme) */
  --primary: 222 47% 11%;     /* #0f172a - Slate 900 */
  --primary-light: 217 91% 60%; /* #3b82f6 - Blue 500 */
  --accent: 250 89% 65%;       /* Indigo 500 */
  --background: 210 40% 98%;   /* Light grayish blue */
  --surface: 0 0% 100%;        /* Pure White */
  --text-main: 222 47% 11%;    /* Dark slate */
  --text-muted: 215 16% 47%;   /* Gray */
  --border: 214 32% 91%;       /* Light gray border */
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
}

body.dark-mode {
  /* Dark Mode Palette (Sleek Space Indigo) */
  --primary: 0 0% 100%;
  --primary-light: 217 91% 65%;
  --accent: 250 89% 68%;
  --background: 222 47% 6%;     /* Deep Dark Slate */
  --surface: 222 47% 11%;       /* Slate 900 */
  --text-main: 210 40% 98%;
  --text-muted: 215 20% 65%;
  --border: 217 32% 17%;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--text-main));
  transition: var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

.rich-text-editor {
  min-height: 280px;
  padding: 18px 20px;
  border: 1px solid hsl(var(--border));
  border-radius: 0 0 var(--radius) var(--radius);
  background: hsl(var(--surface));
  color: hsl(var(--text-main));
  line-height: 1.75;
  outline: none;
  overflow-y: auto;
}

.rich-text-editor:focus {
  border-color: hsl(var(--primary-light));
  box-shadow: 0 0 0 3px hsla(var(--primary-light), 0.12);
}

.rich-text-editor:empty::before {
  content: attr(data-placeholder);
  color: hsl(var(--text-muted));
  pointer-events: none;
}

.rich-text-editor h2,
.rich-text-editor h3,
.rich-text-editor h4,
.post-rich-content h2,
.post-rich-content h3,
.post-rich-content h4 {
  margin: 0.8em 0 0.4em;
  line-height: 1.35;
}

.rich-text-editor ul,
.rich-text-editor ol,
.post-rich-content ul,
.post-rich-content ol {
  padding-left: 1.6em;
  margin: 0.6em 0;
}

.rich-text-editor blockquote,
.post-rich-content blockquote {
  margin: 0.8em 0;
  padding: 10px 16px;
  border-left: 4px solid hsl(var(--primary-light));
  color: hsl(var(--text-muted));
  background: hsla(var(--primary-light), 0.08);
}

.rich-text-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid hsl(var(--border));
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: hsl(var(--surface));
}

.rich-text-toolbar button,
.rich-text-select,
.rich-text-color {
  min-height: 34px;
  border: 1px solid hsl(var(--border));
  border-radius: 7px;
  background: transparent;
  color: hsl(var(--text-main));
  font: inherit;
}

.rich-text-toolbar button {
  min-width: 36px;
  padding: 5px 9px;
  cursor: pointer;
}

.rich-text-toolbar button:hover {
  color: hsl(var(--primary-light));
  background: hsla(var(--primary-light), 0.1);
}

.rich-text-select {
  padding: 5px 9px;
}

.rich-text-divider {
  width: 1px;
  height: 24px;
  background: hsl(var(--border));
}

.rich-text-color {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  cursor: pointer;
}

.rich-text-color input {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.post-rich-content {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.seo-panel {
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsla(var(--primary-light), 0.04);
}

.seo-panel summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 18px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.seo-full-width {
  grid-column: 1 / -1;
}

.seo-panel small {
  display: block;
  margin-top: 6px;
  color: hsl(var(--text-muted));
}

.featured-image-preview {
  width: 100%;
  max-height: 260px;
  margin-top: 12px;
  border-radius: var(--radius);
  object-fit: cover;
}

.article-detail-container {
  max-width: 920px;
  padding-top: 48px;
  padding-bottom: 80px;
}

.article-detail-card {
  padding: clamp(24px, 5vw, 56px);
}

.article-detail-card h1 {
  margin: 18px 0 12px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.2;
}

.article-featured-image {
  width: 100%;
  max-height: 480px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  object-fit: cover;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.article-tags span {
  padding: 5px 10px;
  border-radius: 999px;
  color: hsl(var(--primary-light));
  background: hsla(var(--primary-light), 0.1);
}

.post-management-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

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

  .seo-full-width {
    grid-column: auto;
  }
}

/* Glassmorphism utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid hsl(var(--border));
  transition: var(--transition);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.logo {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, hsl(var(--primary-light)), hsl(var(--accent)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  padding: 10px 16px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover {
  background-color: rgba(120, 120, 120, 0.08);
  color: hsl(var(--primary-light));
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: var(--transition);
  padding: 8px;
  z-index: 10;
  list-style: none; /* Bỏ chấm tròn list */
}

.dropdown-menu li {
  list-style: none; /* Bỏ chấm tròn list cho thẻ li con */
}

.nav-item:hover .dropdown-menu {
  opacity: 1;
  transform: translateY(4px);
  pointer-events: auto;
}

.dropdown-link {
  display: block;
  padding: 10px 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition);
}

.dropdown-link:hover {
  background-color: rgba(120, 120, 120, 0.08);
  color: hsl(var(--primary-light));
  padding-left: 18px;
}

/* User Actions & Dark Mode Toggle */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-toggle {
  background: none;
  border: none;
  color: hsl(var(--text-main));
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle:hover {
  background-color: rgba(120, 120, 120, 0.08);
}

.btn {
  padding: 12px 24px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary-light)), hsl(var(--accent)));
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--text-main));
}

.btn-outline:hover {
  background-color: rgba(120, 120, 120, 0.05);
}

/* Hero Section */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 60%);
}

.hero h1 {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 24px;
}

.hero h1 span {
  background: linear-gradient(135deg, hsl(var(--primary-light)), hsl(var(--accent)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 18px;
  color: hsl(var(--text-muted));
  max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* Grid layout for Course Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  padding: 40px 0;
}

/* Card design with Premium Hover effect */
.card {
  background-color: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  border-color: hsl(var(--primary-light));
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-content {
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: hsl(var(--primary-light));
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}

.card-desc {
  font-size: 14px;
  color: hsl(var(--text-muted));
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid hsl(var(--border));
  padding-top: 16px;
  font-size: 13px;
  color: hsl(var(--text-muted));
}

.instructor {
  font-weight: 600;
  color: hsl(var(--text-main));
}

/* Auth Pages Styling */
.auth-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  border-radius: 16px;
}

.auth-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
}

.auth-subtitle {
  color: hsl(var(--text-muted));
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--text-main));
  outline: none;
  transition: var(--transition);
  font-size: 15px;
}

.form-input:focus {
  border-color: hsl(var(--primary-light));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.auth-switch {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: hsl(var(--text-muted));
}

.auth-switch a {
  color: hsl(var(--primary-light));
  font-weight: 600;
}

/* Learning Dashboard Layout */
.learning-layout {
  display: flex;
  flex-grow: 1;
  height: calc(100vh - 80px);
}

.learning-sidebar {
  width: 320px;
  border-right: 1px solid hsl(var(--border));
  background-color: hsl(var(--surface));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-title {
  padding: 24px;
  font-weight: 700;
  font-size: 18px;
  border-bottom: 1px solid hsl(var(--border));
}

.lesson-list {
  list-style: none;
}

.lesson-item {
  border-bottom: 1px solid hsl(var(--border));
}

.lesson-btn {
  width: 100%;
  padding: 18px 24px;
  text-align: left;
  background: none;
  border: none;
  color: hsl(var(--text-main));
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.lesson-btn:hover {
  background-color: rgba(120, 120, 120, 0.05);
}

.lesson-btn.active {
  background-color: rgba(59, 130, 246, 0.08);
  color: hsl(var(--primary-light));
  font-weight: 600;
}

.learning-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  background-color: black;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.learning-details h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.learning-details p {
  color: hsl(var(--text-muted));
  line-height: 1.6;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 24px;
}

/* Community Blog Feed */
.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.badge-languages { background-color: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.badge-finance { background-color: rgba(16, 185, 129, 0.12); color: #10b981; }
.badge-softskills { background-color: rgba(139, 92, 246, 0.12); color: #8b5cf6; }

.post-card {
  padding: 24px;
  margin-bottom: 24px;
}

.post-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.post-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: hsl(var(--text-muted));
  margin-bottom: 16px;
}

.post-author {
  font-weight: 600;
  color: hsl(var(--text-main));
}

.post-excerpt {
  line-height: 1.6;
  color: hsl(var(--text-muted));
}

/* Form Styles for post creation */
.form-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 40px;
  border-radius: 16px;
}

.select-input {
  width: 100%;
  padding: 14px 16px;
  background-color: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--text-main));
  outline: none;
  cursor: pointer;
}

/* Toast Messages */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--radius);
  background-color: hsl(var(--surface));
  border-left: 4px solid hsl(var(--primary-light));
  color: hsl(var(--text-main));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  font-weight: 500;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.success {
  border-left-color: #10b981;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer styling */
footer {
  border-top: 1px solid hsl(var(--border));
  padding: 40px 0;
  text-align: center;
  color: hsl(var(--text-muted));
  font-size: 14px;
  margin-top: auto;
}
