/* ==========================================================================
   KNOWOOD Premium CSS Design System
   ========================================================================== */

/* 1. Theme Configuration & Variables */
:root {
  /* Common Core Tokens */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --box-shadow-glow: 0 0 20px rgba(220, 100, 30, 0.15);

  /* Dark Theme Variables (Default) */
  --bg-primary: hsl(210, 20%, 9%);
  --bg-secondary: hsl(210, 16%, 12%);
  --bg-glass: rgba(18, 24, 32, 0.7);
  --border-color: hsl(210, 12%, 22%);
  --border-glass: rgba(255, 255, 255, 0.07);
  
  --text-main: hsl(210, 17%, 85%);
  --text-muted: hsl(210, 10%, 60%);
  --text-highlight: hsl(28, 100%, 65%); /* Premium Wood Amber */

  --primary-color: hsl(28, 85%, 52%);
  --primary-glow: rgba(220, 100, 30, 0.4);
  --secondary-color: hsl(210, 14%, 20%);
  
  --success-color: hsl(145, 80%, 40%);
  --error-color: hsl(355, 80%, 50%);
  
  --gradient-primary: linear-gradient(135deg, hsl(28, 85%, 52%) 0%, hsl(15, 85%, 45%) 100%);
  --gradient-glow: radial-gradient(circle at 50% 50%, rgba(220, 100, 30, 0.12) 0%, transparent 70%);
}

.light-theme {
  /* Light Theme Overrides */
  --bg-primary: hsl(210, 30%, 96%);
  --bg-secondary: hsl(0, 0%, 100%);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-color: hsl(210, 14%, 86%);
  --border-glass: rgba(0, 0, 0, 0.05);

  --text-main: hsl(210, 24%, 15%);
  --text-muted: hsl(210, 12%, 45%);
  --text-highlight: hsl(28, 85%, 45%);

  --primary-color: hsl(28, 85%, 48%);
  --primary-glow: rgba(220, 100, 30, 0.25);
  --secondary-color: hsl(210, 16%, 90%);
  
  --success-color: hsl(145, 75%, 35%);
  --error-color: hsl(355, 75%, 45%);
  
  --gradient-primary: linear-gradient(135deg, hsl(28, 85%, 48%) 0%, hsl(15, 85%, 42%) 100%);
  --gradient-glow: radial-gradient(circle at 50% 50%, rgba(220, 100, 30, 0.06) 0%, transparent 65%);
}

/* 2. Global Resets & Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Background animated glow grid */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-glow);
  z-index: -1;
  pointer-events: none;
}

/* 3. Header Section (Glassmorphism & Branding) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  transition: background var(--transition-normal);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform var(--transition-slow);
}

.brand:hover .brand-logo {
  transform: rotate(360deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.1;
  letter-spacing: 0.05em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Navigation Menu */
.main-nav {
  display: flex;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--secondary-color);
}

.nav-btn.active {
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-weight: 600;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--secondary-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--primary-color);
}

/* Toggle Sun/Moon icon displays */
.sun-icon { display: block; }
.moon-icon { display: none; }

.light-theme .sun-icon { display: none; }
.light-theme .moon-icon { display: block; }

/* 4. Common Design Components (Buttons, Badges, Cards) */
.badge {
  display: inline-flex;
  align-items: center;
  background: var(--primary-glow);
  color: var(--text-highlight);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
  margin-bottom: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-secondary:hover {
  background: var(--border-color);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-full {
  width: 100%;
}

.section-header {
  max-width: 800px;
  margin: 0 auto 3rem auto;
  text-align: center;
}

.section-header h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* 5. Main Content Area & Layouts */
.app-main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.tab-content {
  display: none;
  animation: fadeIn var(--transition-slow);
}

.tab-content.active-content {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 6. TAB 1: HOME PAGE & HERO SECTION */
.hero-section {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 4rem;
  margin-bottom: 6rem;
}

.hero-text {
  display: flex;
  flex-direction: column;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-desc {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2.2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

/* Quick stats grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2rem 1rem;
  border-radius: var(--border-radius-lg);
  text-align: center;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
}

.stat-card h3 {
  font-size: 2.5rem;
  color: var(--text-highlight);
  margin-bottom: 0.5rem;
}

.stat-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
}

/* 7. DYNAMIC YOUTUBE VIDEO LIBRARY & PORTAL */
.video-section-wrapper {
  margin-top: 3.5rem;
  padding: 4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.video-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.video-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
}

.video-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--box-shadow-glow);
  border-color: var(--primary-color);
}

.video-thumbnail-box {
  width: 100%;
  height: 170px;
  overflow: hidden;
  position: relative;
  background: #000;
}

.video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.video-card:hover .video-thumbnail {
  transform: scale(1.05);
}

/* Play button overlay */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 52px;
  height: 52px;
  background: rgba(229, 9, 20, 0.9); /* YouTube Red */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
  transition: all var(--transition-normal);
  z-index: 5;
  color: #ffffff;
}

.video-play-btn svg {
  margin-left: 3px;
  transition: transform var(--transition-normal);
}

.video-card:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background: #ff3344;
  box-shadow: 0 0 20px rgba(255, 51, 68, 0.6);
}

.video-card:hover .video-play-btn svg {
  transform: scale(1.1);
}

.video-card-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.video-card-title {
  font-family: var(--font-display);
}


.video-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.video-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Admin CMS thumb preview */
.admin-video-thumb-preview {
  width: 90px;
  height: 55px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}


/* 8. TAB 2: KNOWLEDGE LIBRARY & READER LAYOUT */
.knowledge-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.kb-sidebar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: 80vh;
  position: sticky;
  top: 100px;
}

.kb-sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.kb-search-box {
  position: relative;
}

.kb-search-box input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.kb-search-box input:focus {
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tag:hover, .filter-tag.active {
  background: var(--primary-glow);
  color: var(--text-highlight);
  border-color: var(--primary-color);
}

/* Sidebar Chapters list */
.kb-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.kb-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  line-height: 1.4;
}

.kb-menu-item:hover {
  background: var(--bg-primary);
  color: var(--text-main);
}

.kb-menu-item.active {
  background: var(--primary-glow);
  color: var(--text-highlight);
  font-weight: 600;
}

.kb-item-num {
  font-family: var(--font-display);
  font-size: 0.95rem;
  opacity: 0.7;
}

/* Article Reading Pane */
.kb-viewer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 3.5rem;
  min-height: 60vh;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.kb-viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  gap: 1rem;
  height: 50vh;
}

.kb-viewer-placeholder svg {
  stroke: var(--text-muted);
  opacity: 0.5;
}

.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.article-header h2 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin: 0.5rem 0 1rem 0;
}

.article-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Article Typography inside reader */
.article-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-main);
}

.article-text p {
  margin-bottom: 1.6rem;
}

.article-text h2 {
  font-size: 1.6rem;
  margin: 3rem 0 1.2rem 0;
}

.article-text h3 {
  font-size: 1.3rem;
  margin: 2.2rem 0 1rem 0;
  color: var(--text-highlight);
}

.article-text ul, .article-text ol {
  margin: 0 0 2rem 1.5rem;
}

.article-text li {
  margin-bottom: 0.6rem;
}

.article-text strong {
  font-weight: 600;
  color: var(--text-highlight);
}

/* Markdown Style Tables rendered via JSON */
.article-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  text-align: left;
}

.article-table th {
  background: var(--bg-primary);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 1rem 1.2rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
}

.article-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  background: var(--bg-secondary);
}

.article-table tr:last-child td {
  border-bottom: none;
}

/* Quiz UI inside reader */
.kb-quiz-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 2rem;
  margin-top: 4rem;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.quiz-q {
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.quiz-opt-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: left;
  padding: 1rem 1.2rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.quiz-opt-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-glow);
}

.quiz-opt-btn.correct-choice {
  border-color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  font-weight: 600;
}

.quiz-opt-btn.wrong-choice {
  border-color: var(--error-color);
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
  font-weight: 600;
}

.quiz-feedback {
  padding: 1rem 1.2rem;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 500;
  animation: fadeIn var(--transition-fast);
}

.quiz-feedback.success {
  background: rgba(16, 185, 129, 0.08);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.quiz-feedback.error {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error-color);
  border: 1px solid var(--error-color);
}

/* 9. TAB 3: PUBLIC PRODUCTS CATALOG */
.products-filter-bar {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.prod-filter-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.prod-filter-btn:hover, .prod-filter-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.product-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--box-shadow-glow);
  border-color: var(--primary-color);
}

.product-img-box {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #0d1117;
  position: relative;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-img {
  transform: scale(1.06);
}

.product-info {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-code-tag {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-highlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.product-name {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  line-height: 1.25;
}

.product-category-label {
  font-size: 0.75rem;
  background: var(--secondary-color);
  color: var(--text-muted);
  width: fit-content;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.product-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 10. TAB 4: DYNAMIC PHOTO GALLERY & LIGHTBOX */
.gallery-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.gallery-tab-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.gallery-tab-btn:hover, .gallery-tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  height: 220px;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-glow);
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

.gallery-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 1.2rem 1rem 1.2rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  color: #fff;
  z-index: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-normal);
}

.gallery-item:hover .gallery-meta {
  opacity: 1;
  transform: translateY(0);
}

.gallery-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Lightbox Fullscreen Modal */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 16, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-fast);
}

.lightbox.active {
  display: flex !important;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  z-index: 1010;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.5rem;
  padding: 1rem 1.2rem;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 1010;
}

.lightbox-nav:hover {
  background: var(--primary-color);
  box-shadow: 0 0 15px var(--primary-glow);
}

.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }

.lightbox-content {
  max-width: 80%;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-caption {
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-align: center;
}

/* 11. TAB 5: ABOUT COMPANY & SECURE CONTACT FORM */
.about-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 4rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
}

.about-info {
  display: flex;
  flex-direction: column;
}

.about-info h2 {
  font-size: 2.2rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.about-info p {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contact-item svg {
  color: var(--primary-color);
  stroke-width: 1.5;
  flex-shrink: 0;
}

.contact-item p {
  margin-bottom: 0;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* Form Styling */
.contact-card-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 2.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.contact-card-box h3 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.contact-card-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.required {
  color: var(--error-color);
}

.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary-color);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  font-style: italic;
}

/* 12. TAB 6: ADMIN CMS DASHBOARD STYLING */
.admin-cms-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.admin-title-box h2 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.admin-title-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.admin-sub-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 1.5rem;
}

.admin-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.8rem 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.admin-tab-btn:hover {
  color: var(--text-main);
}

.admin-tab-btn.active {
  color: var(--text-highlight);
  border-color: var(--primary-color);
}

.admin-pane {
  display: none;
  animation: fadeIn var(--transition-fast);
}

.admin-pane.active-pane {
  display: block;
}

.pane-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
  align-items: start;
}

.pane-grid-large {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.pane-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.pane-card h3 {
  font-size: 1.3rem;
  color: var(--text-main);
}

.pane-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pane-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.pane-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* CMS Images Manage Thumbnails list */
.admin-image-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.2rem;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.admin-image-item {
  position: relative;
  height: 110px;
  background: #0d1117;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.admin-image-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-image-delete-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(239, 68, 68, 0.95);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: all var(--transition-fast);
}

.admin-image-delete-btn:hover {
  transform: scale(1.15);
  background: hsl(355, 80%, 45%);
}

/* CRUD Tables */
.admin-table-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--secondary-color);
  padding: 1rem 1.2rem;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.admin-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.admin-table tr:hover td {
  background: var(--border-glass);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.form-actions-row {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
}

.sub-form-card {
  animation: slideIn var(--transition-fast);
  border-color: var(--primary-color);
  box-shadow: var(--box-shadow-glow);
}

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

/* 13. Custom Alert Dialog (Replaces native browser alert) */
.alert-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.alert-modal.active {
  display: flex;
  animation: fadeIn var(--transition-fast);
}

.alert-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.alert-modal-content h3 {
  font-size: 1.3rem;
  color: var(--text-highlight);
}

.alert-modal-content p {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* 14. Footer Section */
.app-footer {
  border-top: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  padding: 2.5rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.security-note {
  font-weight: 500;
  color: var(--text-highlight);
  opacity: 0.8;
}

/* 15. Responsive Viewports Styling (Mobile and Tablets) & Mobile Drawer Navigation */

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Hamburger Toggle Button */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1010;
}

.hamburger-bar {
  width: 100%;
  height: 3px;
  background-color: var(--text-main);
  border-radius: 4px;
  transition: all var(--transition-fast);
  transform-origin: left center;
}

.mobile-nav-toggle.active .hamburger-bar:nth-child(1) {
  transform: rotate(45deg) translate(2px, -2px);
  background-color: var(--text-highlight);
}

.mobile-nav-toggle.active .hamburger-bar:nth-child(2) {
  width: 0%;
  opacity: 0;
}

.mobile-nav-toggle.active .hamburger-bar:nth-child(3) {
  transform: rotate(-45deg) translate(2px, 2px);
  background-color: var(--text-highlight);
}

/* Mobile Drawer Overlay */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  display: none;
  overflow: hidden;
}

.mobile-nav-drawer.active {
  display: block;
}

.mobile-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 16, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mobile-nav-drawer.active .mobile-drawer-backdrop {
  opacity: 1;
}

.mobile-drawer-content {
  position: absolute;
  top: 0;
  right: -320px;
  width: 320px;
  max-width: 85%;
  height: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-glass);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transition: right var(--transition-normal);
  padding: 1.5rem;
  z-index: 2;
}

.mobile-nav-drawer.active .mobile-drawer-content {
  right: 0;
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.mobile-drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.mobile-drawer-close:hover {
  color: var(--text-highlight);
}

.mobile-nav-menu {
  flex: 1;
  overflow-y: auto;
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  list-style: none;
}

.mobile-nav-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.mobile-nav-btn:hover {
  color: var(--text-main);
  background: var(--secondary-color);
}

.mobile-nav-btn.active {
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.2rem;
}

/* Collapsible Sidebar Button - Hidden by default on Desktop */
.kb-sidebar-toggle {
  display: none;
}

@media (max-width: 1024px) {
  .header-container {
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    gap: 0 !important;
  }

  .main-nav {
    display: none !important;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .hero-section {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .simulator-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  
  .knowledge-container {
    grid-template-columns: 1fr;
  }
  
  .kb-sidebar {
    position: static;
    max-height: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.2rem;
  }
  
  .kb-sidebar-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.8rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .kb-sidebar-toggle:hover {
    background: var(--secondary-color);
    border-color: var(--primary-color);
  }

  .kb-sidebar-toggle .toggle-arrow {
    transition: transform var(--transition-fast);
  }

  .kb-sidebar.sidebar-collapsed .kb-sidebar-content {
    display: none;
  }

  .kb-sidebar.sidebar-expanded .kb-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.2rem;
    animation: slideDown var(--transition-fast);
  }

  .kb-sidebar.sidebar-expanded .toggle-arrow {
    transform: rotate(180deg);
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .pane-grid, .pane-grid-large {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .app-main {
    padding: 2rem 1rem;
  }
  
  .about-wrapper {
    padding: 2rem;
  }
  
  .kb-viewer {
    padding: 2rem 1.5rem;
  }
  
  .footer-container {
    flex-direction: column;
    text-align: center;
  }
  
  .lightbox-nav {
    padding: 0.8rem 1rem;
  }
  
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

@media (max-width: 480px) {
  .brand-tagline-trimoc {
    display: none !important;
  }
  .hero-title {
    font-size: 2rem;
  }
  .hero-desc {
    font-size: 1rem;
    line-height: 1.5;
  }
  .section-header h2 {
    font-size: 1.8rem;
  }
}

/* --- CÔNG TY TRI MỘC Overrides & Footer Branding Styles --- */
.brand-tagline-trimoc {
  font-size: 0.75rem !important;
  color: #ff3344 !important; /* Vibrant accent red as in image */
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
}

/* Footer Upper Branding & Contact Layout */
.footer-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-bottom: 2rem;
  flex-wrap: wrap;
  gap: 2.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.footer-logo {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform var(--transition-normal);
}

.footer-brand:hover .footer-logo {
  transform: scale(1.05);
}

.footer-brand-text {
  display: flex;
  flex-direction: column;
}

.footer-company-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.footer-company-tagline {
  color: #ff3344; /* Vibrant accent red as in image */
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.3rem;
  margin-bottom: 0;
  letter-spacing: 0.02em;
}

/* Right Column Contact Info */
.footer-contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-family: var(--font-body);
}

.footer-contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e0e0e0;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.footer-icon {
  margin-right: 0.2rem;
  display: inline-block;
  font-size: 1.1rem;
}

.footer-label-prefix {
  font-weight: 500;
  color: #aaaaaa;
}

.footer-value {
  color: #ffffff;
  font-weight: 400;
}

.footer-value a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
  transition: border-bottom-color 0.2s;
}

.footer-value a:hover {
  border-bottom-color: #ffffff;
}

.footer-divider {
  color: #555555;
  margin: 0 0.5rem;
}

.footer-divider-line {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border-glass);
  margin-bottom: 1.5rem;
}

.footer-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-security-admin {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .footer-main-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }
  .footer-brand {
    flex-direction: column;
    text-align: center;
  }
  .footer-contact-info {
    align-items: center;
  }
  .footer-contact-item {
    justify-content: center;
    text-align: center;
  }
  .footer-sub-row {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .footer-security-admin {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* ==========================================================================
   WYSIWYG RICH TEXT EDITOR STYLING OVERRIDES (CMS Portal)
   ========================================================================== */

/* Word Paste Hint Alert Box */
.editor-hint-box {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: rgba(0, 180, 216, 0.06);
  border: 1px solid rgba(0, 180, 216, 0.25);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  color: #7ad1f3;
  font-size: 0.9rem;
  line-height: 1.6;
}

.editor-hint-box .hint-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.editor-hint-box kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* WYSIWYG Editor Layout Container */
.wysiwyg-editor-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md, 8px);
  background: #0b0e14;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Editor Toolbar */
.wysiwyg-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem;
  background: #111622;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #b0b8c6;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast, 0.2s);
  min-width: 28px;
  height: 28px;
}

.tb-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
}

.tb-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: transparent;
}

.tb-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 0.3rem;
  display: inline-block;
}

/* Color Overrides for Buttons as requested in the Mockup */
.tb-btn.text-red {
  color: #ff3344;
  font-weight: 700;
}
.tb-btn.text-red:hover {
  background: rgba(255, 51, 68, 0.15);
  color: #ff3344;
}

.tb-btn.text-white {
  color: #ffffff;
  font-weight: 700;
}
.tb-btn.text-white:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.tb-btn.text-gray {
  color: #8a99ad;
  font-weight: 700;
}
.tb-btn.text-gray:hover {
  background: rgba(138, 153, 173, 0.15);
  color: #a4b4c9;
}

/* View HTML Button styled exactly like mockup */
.tb-btn.btn-view-html {
  margin-left: auto;
  background: rgba(0, 120, 150, 0.3);
  border: 1px solid rgba(0, 150, 200, 0.5);
  color: #4ec3e6;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  height: 28px;
}

.tb-btn.btn-view-html:hover {
  background: rgba(0, 150, 200, 0.5);
  color: #ffffff;
}

/* Editor Body Area */
.wysiwyg-content-wrapper {
  position: relative;
  width: 100%;
}

.wysiwyg-content {
  min-height: 380px;
  max-height: 600px;
  overflow-y: auto;
  padding: 1.5rem;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  color: #e2e8f0;
  background: #0b0e14;
}

/* Placeholder for ContentEditable Area */
.wysiwyg-content:empty::before {
  content: attr(placeholder);
  color: #566275;
  font-style: italic;
  cursor: text;
}

/* Raw HTML editing textarea (styled identical to the workspace, hidden by default) */
textarea.wysiwyg-html-textarea {
  display: block;
  width: 100%;
  min-height: 380px;
  max-height: 600px;
  padding: 1.5rem;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4ec3e6;
  background: #06090e;
  border: none;
  outline: none;
  resize: vertical;
}

/* Style parsed table / list / image content in the editor to look modern & responsive */
.wysiwyg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.wysiwyg-content th {
  background: #151a26;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.6rem 1rem;
  color: #ffffff;
  font-weight: 600;
  text-align: left;
}

.wysiwyg-content td {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.02);
}

.wysiwyg-content tr:hover td {
  background: rgba(255,255,255,0.05);
}

.wysiwyg-content ul, .wysiwyg-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.wysiwyg-content li {
  margin-bottom: 0.4rem;
}

.wysiwyg-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.wysiwyg-content h1, .wysiwyg-content h2, .wysiwyg-content h3 {
  margin: 1.8rem 0 1rem 0;
  font-family: var(--font-display);
  color: #ffffff;
  font-weight: 600;
}

.wysiwyg-content h1 { font-size: 1.6rem; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 0.4rem; }
.wysiwyg-content h2 { font-size: 1.35rem; }
.wysiwyg-content h3 { font-size: 1.15rem; color: #ff3344; }

.wysiwyg-content p {
  margin-bottom: 1rem;
}

/* ==========================================================================
   Premium Interactive Chatbot UI Styles
   ========================================================================== */
.chatbot-card-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  height: 480px;
  max-height: 80vh;
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.2rem;
}

.chat-bot-avatar {
  font-size: 1.8rem;
  background: var(--primary-glow);
  padding: 0.5rem;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-color);
}

.chat-bot-title-area h3 {
  font-size: 1.15rem;
  margin: 0;
}

.chat-bot-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--success-color);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--success-color);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.5rem;
  margin-bottom: 1.2rem;
}

.chat-message {
  max-width: 80%;
  padding: 0.8rem 1.2rem;
  border-radius: var(--border-radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  animation: fadeIn var(--transition-fast);
}

.chat-message ul, .chat-message ol {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.chat-message li {
  margin-bottom: 0.25rem;
}

.chat-message table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.chat-message th, .chat-message td {
  border: 1px solid var(--border-color);
  padding: 0.4rem;
  text-align: left;
}

.chat-message th {
  background: var(--secondary-color);
  font-weight: 600;
}

.chat-message a {
  color: #ff3344;
  text-decoration: underline;
}

.chat-message strong {
  color: var(--text-highlight);
}

.user-message a {
  color: #ffffff;
  text-decoration: underline;
}

.user-message strong {
  color: #ffffff;
}

.message-content {
  word-break: break-word;
}

.bot-message {
  background: var(--secondary-color);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

.user-message {
  background: var(--gradient-primary);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.6;
  align-self: flex-end;
}

.bot-message .message-time {
  color: var(--text-muted);
}

.user-message .message-time {
  color: rgba(255, 255, 255, 0.8);
}

.chatbot-input-area {
  display: flex;
  gap: 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.4rem;
}

.chatbot-input-area input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  outline: none !important;
}

.chatbot-input-area button {
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.6rem 1rem;
  background: var(--secondary-color);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  width: fit-content;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ==========================================================================
   16. HOME PAGE KNOWLEDGE ARTICLES SECTION & CARDS
   ========================================================================== */
.home-articles-section-wrapper {
  margin-top: 4rem;
  padding: 4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: fadeIn var(--transition-slow);
}

.home-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.home-article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.home-article-thumb-box {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
  background: #000;
}

.home-article-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.home-article-card:hover .home-article-thumb {
  transform: scale(1.05);
}

.home-article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 3;
}

.home-article-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--box-shadow-glow);
  border-color: var(--primary-color);
}

.home-article-card:hover::before {
  opacity: 1;
}

.home-article-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.home-article-category {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Category Badge Colors */
.cat-chemistry {
  background: rgba(56, 189, 248, 0.1); /* Sky Blue */
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.home-article-card:hover .cat-chemistry {
  background: #38bdf8;
  color: #0b0f19;
}

.cat-process {
  background: rgba(251, 146, 60, 0.1); /* Amber Orange */
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.2);
}

.home-article-card:hover .cat-process {
  background: #fb923c;
  color: #0b0f19;
}

.cat-additive {
  background: rgba(192, 132, 252, 0.1); /* Purple */
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.2);
}

.home-article-card:hover .cat-additive {
  background: #c084fc;
  color: #0b0f19;
}

.cat-general {
  background: rgba(156, 163, 175, 0.1); /* Gray */
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

.home-article-card:hover .cat-general {
  background: #9ca3af;
  color: #0b0f19;
}

.home-article-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin: 0;
  transition: color var(--transition-fast);
}

.home-article-card:hover .home-article-title {
  color: var(--text-highlight);
}

.home-article-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.home-article-readmore {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-top: 1rem;
  transition: color var(--transition-fast);
}

.home-article-card:hover .home-article-readmore {
  color: var(--text-highlight);
}

.home-article-card:hover .home-article-readmore svg {
  transform: translateX(4px);
}

