/* ============================================================
   TANSINH Tasks — Complete Stylesheet
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #7c3aed;
  --card-bg: #ffffff;
  --text-dark: #0f172a;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #a5b4fc;
  --input-bg: #f8fafc;
  --toolbar-bg: #f8fafc;
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.2s ease;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06), 0 12px 40px rgba(79, 70, 229, 0.08);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.07), 0 20px 60px rgba(79, 70, 229, 0.09);
}

/* ---- Reset & base ---- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100svh;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: #f0f2f8;
  background-image:
    radial-gradient(at 0% 0%, rgba(129, 140, 248, 0.13) 0%, transparent 50%),
    radial-gradient(at 100% 100%, rgba(167, 139, 250, 0.10) 0%, transparent 50%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   LOGIN CARD — centered on page
   ============================================================ */
.card {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 40px 36px 44px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.subtitle {
  font-size: 0.92rem;
  color: var(--text-light);
  margin-bottom: 28px;
}

/* ---- Form fields ---- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-dark);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-light);
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---- Login button ---- */
.btn {
  width: 100%;
  padding: 15px;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
  transition: all var(--transition);
}

.btn:hover,
.btn:focus-visible {
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

/* ---- Messages ---- */
#message {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 1.2em;
}

.error {
  color: #dc2626;
}

.success {
  color: #16a34a;
}

/* ============================================================
   LOGOUT BUTTON
   ============================================================ */
/* (old logout button removed — now using sidebar menu) */

/* ============================================================
   CONTENT FORM — nearly full width
   ============================================================ */
#contentForm {
  width: 100%;
  max-width: calc(100vw - 48px);
  padding: 32px 0 40px;
  margin: 0 auto;
  animation: fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.content-card {
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.6);
  padding: 36px 40px 40px;
  position: relative;
}

/* Gradient accent bar at top */
.content-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), #ec4899);
  border-radius: 18px 18px 0 0;
}

/* ---- Header ---- */
.content-header {
  text-align: center;
  margin-bottom: 28px;
}

.content-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.28);
}

.content-header h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.content-header p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-light);
}

/* ---- Field labels ---- */
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 8px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-label i {
  color: var(--primary);
  font-size: 0.72rem;
}

/* ---- Title input ---- */
.title-input-lg {
  padding: 16px 20px !important;
  font-size: 1.08rem !important;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  border-radius: 12px !important;
  min-height: 52px;
  border: 1.5px solid var(--border) !important;
  background: var(--input-bg) !important;
  color: var(--text-dark);
  transition: all 0.2s ease !important;
}

.title-input-lg:focus {
  border-color: var(--border-focus) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08) !important;
}

/* ---- Textarea (fallback) ---- */
.content-card textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.content-card textarea:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* ---- Submit button ---- */
.submit-btn {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  padding: 15px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.28);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.submit-btn:hover {
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.38);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(1px);
}

/* ---- Submit message ---- */
#submitMessage {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 1.2em;
  text-align: center;
}

/* ============================================================
   SUGGESTION DROPDOWN
   ============================================================ */
.suggestion-wrap {
  position: relative;
}

.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.suggestions-dropdown.active {
  display: block;
}

.suggestion-item {
  padding: 11px 16px;
  font-size: 0.88rem;
  color: var(--text-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.15s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.suggestion-item i {
  color: var(--text-light);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.suggestion-item:hover i {
  color: var(--primary);
}

.suggestion-item .match-score {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   RICH TEXT EDITOR
   ============================================================ */
.editor-wrapper {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--input-bg);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.editor-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
  background: #fff;
}

/* ---- Toolbar ---- */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--border);
}

.toolbar-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-mid);
  font-size: 0.82rem;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.toolbar-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.toolbar-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: #cbd5e1;
  margin: 0 4px;
  opacity: 0.5;
  flex-shrink: 0;
}

.toolbar-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-size: 0.78rem;
  color: var(--text-mid);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.12s ease;
  flex-shrink: 0;
}

.toolbar-select:focus {
  border-color: var(--primary);
}

/* ---- Color dropdown ---- */
.toolbar-dropdown-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.color-trigger {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-bottom: 2px !important;
}

.color-bar {
  display: block;
  width: 16px;
  height: 3px;
  border-radius: 1px;
}

.toolbar-color-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  gap: 6px;
  flex-wrap: wrap;
  width: 164px;
}

.toolbar-color-panel.open {
  display: flex;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: var(--primary);
}

/* ---- Editable area ---- */
.editor-body {
  min-height: 420px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 24px 28px;
  font-size: 1rem;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.8;
  letter-spacing: -0.005em;
  color: var(--text-dark);
  outline: none;
  background: #fff;
}

.editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
  font-style: italic;
}

.editor-body h1 {
  font-size: 1.6rem;
  margin: 0.4em 0;
  font-weight: 700;
}

.editor-body h2 {
  font-size: 1.3rem;
  margin: 0.4em 0;
  font-weight: 700;
}

.editor-body h3 {
  font-size: 1.1rem;
  margin: 0.4em 0;
  font-weight: 600;
}

.editor-body ul,
.editor-body ol {
  padding-left: 24px;
  margin: 0.4em 0;
}

.editor-body a {
  color: var(--primary);
  text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Medium screens */
@media (max-width: 900px) {
  #contentForm {
    max-width: calc(100vw - 32px);
  }

  .content-card {
    padding: 28px 24px 32px;
  }
}

/* Small screens */
@media (max-width: 600px) {
  body {
    align-items: flex-start;
  }

  #contentForm {
    max-width: calc(100vw - 16px);
    padding: 16px 0 24px;
  }

  .content-card {
    padding: 24px 16px 28px;
    border-radius: 14px;
  }

  .editor-body {
    min-height: 280px;
    padding: 18px 16px;
    font-size: 0.95rem;
  }

  .toolbar-btn {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  .toolbar-select {
    font-size: 0.72rem;
    padding: 0 6px;
  }

  .title-input-lg {
    font-size: 1rem !important;
    padding: 14px 16px !important;
  }

  .toolbar-color-panel {
    left: auto;
    right: 0;
    transform: none;
  }

  .content-header h2 {
    font-size: 1.15rem;
  }

  .submit-btn {
    padding: 14px 24px;
    font-size: 0.95rem;
  }
}

/* ============================================================
   SIDEBAR MENU
   ============================================================ */
.menu-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--card-bg);
  color: var(--text-mid);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  z-index: 1100;
  border: 1.5px solid var(--border);
}

.menu-toggle i {
  font-size: 16px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.menu-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--border-focus);
}

.menu-toggle.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.menu-toggle.active i {
  transform: rotate(90deg);
}

/* Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar panel */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: var(--card-bg);
  z-index: 1080;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.1);
  overflow-y: auto;
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px 20px 20px 64px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.sidebar-subtitle {
  font-size: 0.78rem;
  color: var(--text-light);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s ease;
}

.sidebar-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-item.active-item {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-item i {
  width: 20px;
  text-align: center;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 14px;
}

.sidebar-footer {
  padding: 16px 10px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-item.logout-item {
  color: #dc2626;
}

.sidebar-item.logout-item:hover {
  background: #fef2f2;
  color: #b91c1c;
}

@media (max-width: 600px) {
  .sidebar {
    width: 260px;
  }
}


/* ============================================================
   CONTENT LAYOUT (form + side panel)
   ============================================================ */
.content-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.content-layout .content-card {
  flex: 1;
  min-width: 0;
}

/* ============================================================
   SEARCH RESULTS SIDE PANEL
   ============================================================ */
.search-results-panel {
  width: 420px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.6);
  position: sticky;
  top: 32px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-results-panel.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.search-results-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #06b6d4, var(--primary), var(--accent));
  border-radius: 18px 18px 0 0;
}

.panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  flex-shrink: 0;
}

.panel-header i {
  color: var(--primary);
  font-size: 0.9rem;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-light);
}

.panel-empty i {
  font-size: 2rem;
  opacity: 0.4;
}

.panel-empty p {
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.5;
}

/* Individual result card */
.result-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-card:last-child {
  margin-bottom: 0;
}

.result-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
}

.result-card-score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.result-card-details {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.7;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.result-card-details::-webkit-scrollbar {
  width: 4px;
}

.result-card-details::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.result-card-details img {
  max-width: 100%;
  border-radius: 8px;
}

.result-card-nodetails {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.result-card-use {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.result-card-use:hover {
  background: var(--primary);
  color: #fff;
}

/* Panel loading spinner */
.panel-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-light);
}

.panel-loading i {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* Responsive: stack on small screens */
@media (max-width: 1100px) {
  .search-results-panel {
    width: 340px;
  }
}

@media (max-width: 900px) {
  .content-layout {
    flex-direction: column;
  }

  .search-results-panel {
    width: 100%;
    position: static;
    max-height: 50vh;
    transform: translateY(10px);
  }

  .search-results-panel.visible {
    transform: translateY(0);
  }
}

/* ============================================================
   MICROPHONE VOICE INPUT BUTTON
   ============================================================ */
.editor-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px;
  background: var(--toolbar-bg);
  border-top: 1px solid var(--border);
}

.mic-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text-light);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mic-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.mic-btn.is-recording {
  background: #fee2e2;
  color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

.mic-btn.is-processing {
  background: #fef3c7;
  color: #d97706;
  opacity: 0.7;
  cursor: wait;
}

@keyframes mic-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.08);
  }
}

/* ============================================================
   CONTENT DETAIL MODAL POPUP
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 24px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15), 0 8px 24px rgba(79, 70, 229, 0.1);
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), #ec4899);
  border-radius: 20px 20px 0 0;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text-mid);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
  z-index: 1;
}

.modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-title {
  padding: 28px 56px 20px 28px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.4;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.modal-divider {
  height: 1px;
  background: var(--border);
  margin: 0 28px;
  flex-shrink: 0;
}

.modal-details {
  padding: 24px 28px 32px;
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.8;
  overflow-y: auto;
  flex: 1;
}

.modal-details::-webkit-scrollbar {
  width: 5px;
}

.modal-details::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}

.modal-details img {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
}

.modal-details a {
  color: var(--primary);
  text-decoration: underline;
}

.modal-details .modal-empty {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  padding: 24px 0;
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    max-height: 90vh;
    border-radius: 16px;
  }

  .modal-title {
    padding: 24px 48px 16px 20px;
    font-size: 1.1rem;
  }

  .modal-divider {
    margin: 0 20px;
  }

  .modal-details {
    padding: 20px 20px 28px;
    font-size: 0.9rem;
  }
}


/* ============================================================
   CARD ACTION BUTTONS (Edit & Delete)
   ============================================================ */
.result-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.card-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.card-action-btn.edit-btn {
  color: #0369a1;
  background: #e0f2fe;
}

.card-action-btn.edit-btn:hover {
  background: #0284c7;
  color: #fff;
}

.card-action-btn.delete-btn {
  color: #dc2626;
  background: #fef2f2;
}

.card-action-btn.delete-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* Cancel edit button */
.cancel-edit-btn {
  margin-top: 10px;
  background: #f1f5f9 !important;
  color: var(--text-mid) !important;
  box-shadow: none !important;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
}

.cancel-edit-btn:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
  transform: none;
}

/* Submit button editing state */
.submit-btn.is-editing {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
}

/* ============================================================
   DEPARTMENT CHIPS IN EDITOR FOOTER
   ============================================================ */
.dept-chips-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dept-chips-wrap::-webkit-scrollbar {
  display: none;
}

.dept-chips-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.dept-chips-label i {
  color: var(--primary);
  font-size: 0.75rem;
}

.dept-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-mid);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.dept-chip:hover {
  border-color: var(--border-focus);
  background: var(--primary-light);
  color: var(--primary);
}

.dept-chip.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.dept-chip.active:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent) 100%);
  color: #fff;
}

.dept-chip i {
  font-size: 0.7rem;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--toolbar-bg);
  border-top: 1px solid var(--border);
  gap: 10px;
}

@media (max-width: 600px) {
  .dept-chip {
    padding: 5px 10px;
    font-size: 0.74rem;
  }

  .dept-chips-label {
    font-size: 0.74rem;
  }

  .editor-footer {
    padding: 8px 10px;
  }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  min-width: 280px;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--primary);
  pointer-events: auto;
  animation: toast-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  overflow: hidden;
}

.toast.toast-out {
  animation: toast-out 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.toast-error {
  border-left-color: #dc2626;
}

.toast.toast-success {
  border-left-color: #16a34a;
}

.toast.toast-warning {
  border-left-color: #f59e0b;
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.toast-error .toast-icon {
  background: #fef2f2;
  color: #dc2626;
}

.toast-success .toast-icon {
  background: #f0fdf4;
  color: #16a34a;
}

.toast-warning .toast-icon {
  background: #fffbeb;
  color: #f59e0b;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.toast-text {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.toast-close:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 0 14px;
  animation: toast-progress 4s linear both;
}

.toast-error .toast-progress {
  background: #dc2626;
}

.toast-success .toast-progress {
  background: #16a34a;
}

.toast-warning .toast-progress {
  background: #f59e0b;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

@keyframes toast-progress {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

@media (max-width: 600px) {
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 3100;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 24px;
}

.confirm-overlay.active {
  opacity: 1;
  visibility: visible;
}

.confirm-card {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.confirm-overlay.active .confirm-card {
  transform: translateY(0) scale(1);
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: #fef2f2;
  color: #dc2626;
}

.confirm-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 24px;
  word-break: break-word;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.confirm-btn.cancel {
  background: #f1f5f9;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}

.confirm-btn.cancel:hover {
  background: #e2e8f0;
}

.confirm-btn.danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.confirm-btn.danger:hover {
  background: #b91c1c;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}



/* ============================================================
   CONTENT PAGE
   ============================================================ */

   #contentPage {
  width: 100%;
  max-width: calc(100vw - 48px);
  padding: 32px 0 40px;
  margin: 0 auto;
  animation: fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}



.cp-container {
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.6);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.cp-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #06b6d4, var(--primary), var(--accent));
}

.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.cp-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cp-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.28);
  flex-shrink: 0;
}

.cp-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
  margin: 0;
}

.cp-subtitle {
  font-size: 0.84rem;
  color: var(--text-light);
  margin: 2px 0 0;
}

.cp-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cp-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 240px;
  transition: all 0.2s ease;
}

.cp-search-box:focus-within {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.cp-search-box i {
  color: var(--text-light);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.cp-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-dark);
  width: 100%;
}

.cp-search-box input::placeholder {
  color: var(--text-light);
}

.cp-dept-filter {
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  font-size: 0.85rem;
  color: var(--text-mid);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.cp-dept-filter:focus {
  border-color: var(--border-focus);
}

.cp-stats {
  padding: 14px 32px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cp-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
}

.cp-stat-badge i {
  font-size: 0.75rem;
}

.cp-grid {
  padding: 20px 32px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.cp-card {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  cursor: pointer;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cp-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.1);
  transform: translateY(-2px);
}

.cp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cp-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.45;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-card-actions-top {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.cp-card:hover .cp-card-actions-top {
  opacity: 1;
}

.cp-card-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-light);
  font-size: 0.78rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.cp-card-action-btn.cp-edit-btn:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.cp-card-action-btn.cp-delete-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

.cp-card-preview {
  font-size: 0.86rem;
  color: var(--text-mid);
  line-height: 1.65;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-card-preview em {
  color: var(--text-light);
}

.cp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.cp-card-depts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cp-card-dept {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: #f3f0ff;
  border-radius: 999px;
}

.cp-card-date {
  font-size: 0.76rem;
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.cp-card-date i {
  font-size: 0.7rem;
}

.cp-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
  font-size: 0.92rem;
}

.cp-loading i {
  margin-right: 8px;
}

.cp-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-light);
}

.cp-empty i {
  font-size: 2.2rem;
  opacity: 0.35;
}

.cp-empty p {
  font-size: 0.92rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .cp-header {
    padding: 20px 20px 16px;
  }

  .cp-grid {
    padding: 16px 20px 24px;
    grid-template-columns: 1fr;
  }

  .cp-stats {
    padding: 12px 20px 0;
  }

  .cp-search-box {
    min-width: 180px;
  }
}

@media (max-width: 600px) {
  .cp-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 16px 14px;
  }

  .cp-header-right {
    width: 100%;
  }

  .cp-search-box {
    flex: 1;
    min-width: 0;
  }

  .cp-dept-filter {
    flex: 1;
  }

  .cp-grid {
    padding: 12px 16px 20px;
    grid-template-columns: 1fr;
  }

  .cp-card {
    padding: 18px 16px;
  }

  .cp-card-actions-top {
    opacity: 1;
  }

  .cp-stats {
    padding: 10px 16px 0;
  }
}

/* ============================================================
   CONTENT PAGE — SEARCH HERO
   ============================================================ */
.cp-search-hero {
  text-align: center;
  padding: 48px 32px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.5) 0%, transparent 100%);
}

.cp-search-hero-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.3);
}

.cp-search-hero-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.cp-search-hero-subtitle {
  font-size: 0.88rem;
  color: var(--text-light);
  margin: 0 0 24px;
}

.cp-search-input-wrap {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.08);
  transition: all 0.25s ease;
}

.cp-search-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(79, 70, 229, 0.15), 0 0 0 4px rgba(79, 70, 229, 0.06);
}

.cp-search-input-wrap > i {
  color: var(--text-light);
  font-size: 1rem;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.cp-search-input-wrap:focus-within > i {
  color: var(--primary);
}

.cp-search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text-dark);
  font-weight: 500;
}

.cp-search-input-wrap input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

.cp-search-spinner {
  display: flex;
  align-items: center;
  color: var(--primary);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.cp-dept-filter-wrap {
  max-width: 560px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.cp-dept-filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.cp-dept-filter-label i {
  color: var(--primary);
  font-size: 0.75rem;
}

.cp-card-score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .cp-search-hero {
    padding: 32px 16px 24px;
  }

  .cp-search-input-wrap {
    padding: 12px 16px;
  }

  .cp-search-input-wrap input {
    font-size: 0.95rem;
  }

  .cp-search-hero-title {
    font-size: 1.2rem;
  }

  .cp-dept-filter-wrap {
    flex-direction: column;
    gap: 8px;
  }
}


/* ============================================================
   HERO SEARCH - Claude-style landing experience
   ============================================================ */
.hero-search {
  width: 100%;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  position: relative;
}

.hero-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 40px;
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-search.has-results .hero-center {
  display: none;
}

/* -- Top-right greeting pill -- */
.hero-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 28px;
  z-index: 60;
  pointer-events: none;
  animation: heroFadeIn 0.5s ease both;
}

.hero-topbar-greeting {
  pointer-events: auto;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-mid);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(226,232,240,0.6);
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.hero-topbar-greeting strong {
  font-weight: 700;
  color: var(--primary);
}

.hero-search.has-results .hero-topbar {
  display: none;
}

/* -- Search block (replaces old greeting) -- */
.hero-search-block {
  text-align: center;
  margin-bottom: 28px;
  animation: heroFadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  max-width: 620px;
  width: 100%;
}

.hero-search-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.hero-search-desc {
  font-size: 0.92rem;
  color: var(--text-light);
  margin: 0 0 28px;
  font-weight: 400;
  line-height: 1.5;
}

/* ---- Role cards (teacher / learner) ---- */
.hero-role-cards {
  display: none;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 14px;
  min-width: 220px;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: default;
}

.hero-role-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
}

.hero-role-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.hero-role-icon.learner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
}

.hero-role-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.hero-role-text strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.hero-role-text span {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
  margin-top: 2px;
}

/* ---- Search hint chips ---- */
.hero-search-hints {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-hint-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.hero-hint-chip {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hero-hint-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .hero-role-cards {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .hero-role-card {
    min-width: unset;
    width: 100%;
    max-width: 300px;
    padding: 10px 16px;
  }
  .hero-search-hints {
    gap: 6px;
  }
  .hero-hint-chip {
    padding: 5px 10px;
    font-size: 0.74rem;
  }
}

.hero-or-divider {
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 0;
}

.hero-or-divider::before,
.hero-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.3), transparent);
}

.hero-or-divider span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #b0bcc8;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}


.hero-dept-section {
  width: 100%;
  max-width: 620px;
  margin-top: 20px;
  padding: 20px 24px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226,232,240,0.5);
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.02);
  animation: heroFadeIn 0.6s 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  overflow: hidden;
}

.hero-dept-section::before {
  display: none;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7, #6366f1);
  background-size: 200% 100%;
  animation: gradientMove 4s linear infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.hero-dept-label {
  font-size: 0.76rem;
  color: #94a3b8;
  font-weight: 500;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-dept-label i {
  color: var(--primary);
  font-size: 0.75rem;
  background: var(--primary-light);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-dept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 600px;
  margin: 0 auto;
}

.hero-dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-mid);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.hero-dept-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
  opacity: 0;
  transition: opacity 0.25s;
}

.hero-dept-chip:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.18);
}

.hero-dept-chip:hover::before {
  opacity: 1;
}

.hero-dept-chip.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.hero-dept-chip.active::before {
  opacity: 0;
}

.hero-dept-loading {
  color: var(--text-light);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

@media (max-width: 600px) {
  .hero-dept-chip {
    padding: 5px 10px;
    font-size: 0.72rem;
  }
  .hero-dept-section {
    margin-top: 16px;
  }
}

  
.hero-input-wrap {
  width: 100%;
  max-width: 620px;
  position: relative;
  animation: heroSlideUp 0.5s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-input-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1rem;
  pointer-events: none;
  transition: color 0.3s;
  opacity: 0.6;
}

.hero-input-wrap:focus-within .hero-input-icon {
  color: #6366f1;
  opacity: 1;
}

.hero-input-wrap input,
.hero-bottom-inner input {
  width: 100%;
  padding: 18px 24px 18px 52px;
  font-size: 1.02rem;
  font-family: 'DM Sans', sans-serif;
  border: 2px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  background: #fff;
  color: var(--text-dark);
  box-shadow: 
    0 4px 20px rgba(99, 102, 241, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  outline: none;
}

.hero-input-wrap input:focus,
.hero-bottom-inner input:focus {
  border-color: #6366f1;
  box-shadow: 
    0 4px 32px rgba(99, 102, 241, 0.14),
    0 0 0 4px rgba(99, 102, 241, 0.06);
}

.hero-input-wrap input::placeholder,
.hero-bottom-inner input::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

.hero-results-area {
  flex: 1;
  padding: 0 24px 120px;
  display: none;
}

.hero-search.has-results .hero-results-area {
  display: block;
  animation: heroFadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-results-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
  animation: heroCardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex;
  flex-direction: column;
}

.hero-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.12);
  border-color: var(--primary);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.2s;
}

.hero-card:hover::before { opacity: 1; }

.hero-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-card-details {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  flex: 1;
}

.hero-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.hero-card-score {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  color: var(--primary);
}

.hero-card-actions {
  display: flex;
  gap: 6px;
}

.hero-card-actions button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.72rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.hero-card-actions button:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.hero-card-actions .hero-delete-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.hero-bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 16px 24px 24px;
  background: linear-gradient(to top, #f0f2f8 70%, transparent);
  z-index: 50;
  animation: heroSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-bottom-inner {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-bottom-inner .hero-input-icon { left: 20px; }
.hero-bottom-inner input { flex: 1; }

/* Search clear button */
.search-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  display: none;
  transition: color 0.2s, background 0.2s;
  z-index: 2;
}
.search-clear-btn:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
}
.search-clear-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-bottom-inner .search-clear-btn {
  right: 68px;
}
.hero-bottom-inner.no-add-btn .search-clear-btn {
  right: 14px;
}
.hero-bottom-inner.no-add-btn input {
  padding-right: 44px !important;
}
.hero-input-wrap input {
  padding-right: 44px !important;
}
.hero-bottom-inner input {
  padding-right: 54px !important;
}

.hero-add-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.hero-add-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.05);
}

.hero-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  grid-column: 1 / -1;
}

.hero-no-results i {
  font-size: 2.5rem;
  opacity: 0.3;
  margin-bottom: 16px;
  display: block;
}

.hero-no-results p { font-size: 0.95rem; margin: 0; }

.hero-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  grid-column: 1 / -1;
}

.hero-loading i {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 12px;
  display: block;
}

.hero-results-header {
  max-width: 900px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.hero-results-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

@keyframes heroFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes heroSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
  .hero-search-title { font-size: 1.5rem; }
  .hero-topbar { padding: 10px 16px; }
  .hero-topbar-greeting { font-size: 0.78rem; padding: 6px 14px; }

  .hero-input-wrap input,
  .hero-bottom-inner input {
    padding: 14px 16px 14px 44px;
    font-size: 0.95rem;
  }

  .hero-results-grid { grid-template-columns: 1fr; }
  .hero-bottom-bar { padding: 12px 16px 16px; }
}


/* ============================================================
   PAGE LOADER (smooth transition between pages)
   ============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: #f0f2f8;
  background-image:
    radial-gradient(at 0% 0%, rgba(129, 140, 248, 0.13) 0%, transparent 50%),
    radial-gradient(at 100% 100%, rgba(167, 139, 250, 0.10) 0%, transparent 50%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.page-loader-inner i {
  font-size: 1.3rem;
}

#contentPage {
  animation: pageFadeIn 0.4s ease both;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Load More Pagination Button */
.cp-load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin: 24px auto 32px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.cp-load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.cp-load-more-btn:active {
  transform: translateY(0);
}


/* ============================================================
   COMPACT LOGIN — shared between index.html & content.html
   ============================================================ */
.login-compact {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100svh;
  width: 100%;
  padding: 24px 16px;
  animation: fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-compact-inner {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06), 0 12px 40px rgba(79, 70, 229, 0.07);
  padding: 32px 28px 36px;
  text-align: center;
}

.login-compact-brand {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.login-compact-sub {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 22px;
}

.login-compact-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.login-compact-fields input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-compact-fields input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.login-compact-pwd-wrap {
  position: relative;
}

.login-compact-pwd-wrap input {
  padding-right: 42px;
}

.login-compact-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  line-height: 1;
  padding: 4px;
}

.login-compact-eye:hover {
  opacity: 0.8;
}

.login-compact-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.login-compact-btn:hover {
  opacity: 0.92;
}

.login-compact-btn:active {
  transform: scale(0.98);
}

.login-compact-msg {
  margin-top: 12px;
  font-size: 0.82rem;
  min-height: 20px;
  color: var(--text-light);
}

.login-compact-msg.error {
  color: #dc3545;
}

.login-compact-msg.success {
  color: #198754;
}

/* ---- Floating Search FAB ---- */
.fab-search-btn {
  display: none;
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.35), 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  animation: fabPulse 2s ease-in-out infinite;
}

.fab-search-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(79, 70, 229, 0.45), 0 3px 12px rgba(0,0,0,0.12);
}

.fab-search-btn:active {
  transform: scale(0.95);
}

.fab-search-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(79, 70, 229, 0.35), 0 2px 8px rgba(0,0,0,0.1); }
  50% { box-shadow: 0 4px 28px rgba(79, 70, 229, 0.5), 0 2px 12px rgba(0,0,0,0.15); }
}

@media (max-width: 600px) {
  .fab-search-btn { bottom: 20px; right: 16px; width: 48px; height: 48px; font-size: 1.1rem; }
}