* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f0f1f 100%);
  background-attachment: fixed;
  min-height: 100vh;
  margin-left: 250px;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  height: 100vh;
  padding: 25px 15px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 1000;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 20% 50%,
    rgba(37, 99, 235, 0.1),
    transparent
  );
  pointer-events: none;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 40px;
  text-align: start;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeIn 0.6s ease;
  letter-spacing: 2px;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar li::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left 0.3s ease;
}

.sidebar li:hover::before {
  left: 100%;
}

.sidebar li:hover {
  background: #334155;
  transform: translateX(5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.active {
  background: rgb(37, 99, 235);
  backdrop-filter: blur(10px);
  color: white;
}

/* MAIN */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* TOPBAR */
.topbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 0 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logoutBtn {
  background: rgba(239, 68, 68, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.logoutBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.3);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.logoutBtn:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.logoutBtn:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(239, 68, 68, 0.4);
}

.logoutBtn:active {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(239, 68, 68, 0.4);
}

/* TOPBAR RIGHT (Profile + Logout) */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.notification-bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.65);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-bell:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #ffffff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.notification-count.hidden {
  display: none;
}

.notification-popup {
  position: fixed;
  right: 22px;
  top: 76px;
  width: min(360px, 90vw);
  max-height: 440px;
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  z-index: 1500;
  padding: 14px;
}

.notification-popup.hidden {
  display: none;
}

.notification-popup h4 {
  margin: 0 0 10px;
  color: #e2e8f0;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.notification-item {
  margin-bottom: 10px;
  border: 1px solid rgba(100, 116, 139, 0.45);
  border-radius: 8px;
  padding: 10px;
  background: rgba(30, 41, 59, 0.88);
}

.notification-item:last-child {
  margin-bottom: 4px;
}

.notification-item .notification-message {
  font-size: 13px;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.notification-item .notification-meta {
  font-size: 11px;
  color: #94a3b8;
}

.notification-popup .no-notifications {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

.notification-popup .popup-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.notification-popup .clear-btn {
  background: #334155;
  color: white;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.notification-popup .clear-btn:hover {
  background: #475569;
}

/* PROFILE SECTION */
.profile-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50px;
  transition: all 0.3s ease;
  position: relative;
}

.profile-section:hover {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  box-shadow:
    0 8px 20px rgba(99, 102, 241, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* PROFILE DROPDOWN MENU */
.profile-section {
  position: relative;
}
.profile-menu {
  position: fixed; /* use fixed to avoid being clipped by ancestor stacking contexts */
  right: auto;
  top: auto;
  width: 220px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 10px;
  padding: 28px;
  transform-origin: top right;
  transition: all 0.25s ease;
  will-change: transform, opacity, left, top;
}
.profile-menu.hidden {
  opacity: 0;
  transform: scale(0.95) translateY(-6px);
  pointer-events: none;
}
.profile-menu:not(.hidden) {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
}
.profile-item + .profile-item {
  margin-top: 6px;
}
.profile-name {
  color: #cbd5e1;
  font-size: 13px;
}
.profile-action {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.logout-action {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.profile-action:active {
  transform: translateY(1px);
}
.profile-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
  cursor: pointer;
}

.profile-img:hover {
  border-color: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* AVATAR HELLO BUBBLE & WAVE ANIMATION */
/* Animated welcome text */
.welcome-anim {
  display: flex;
  align-items: center;
  gap: 10px;
}
.welcome-anim .welcome-label {
  font-size: 20px;
  font-weight: 700;
  color: #e6eefc;
  letter-spacing: 1px;
  transform-origin: left center;
}
.welcome-anim.play .welcome-label {
  animation: welcomePulse 1200ms ease-in-out 0s 1;
}
@keyframes welcomePulse {
  0% {
    transform: translateY(6px) scale(0.98);
    opacity: 0;
  }
  40% {
    transform: translateY(0) scale(1.02);
    opacity: 1;
  }
  70% {
    transform: translateY(-4px) scale(1.01);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* 3D username text effect */
#roleBadge {
  display: inline-block;
  margin-left: 6px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.6px;
  transform-origin: center bottom;
  transition:
    transform 300ms ease,
    text-shadow 300ms ease;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 0 rgba(0, 0, 0, 0.06),
    0 4px 0 rgba(0, 0, 0, 0.06),
    0 6px 8px rgba(0, 0, 0, 0.35);
}

/* extruded layers (simulated 3D) */
.username-3d {
  animation: username3D 1200ms cubic-bezier(0.22, 1, 0.36, 1) 0s 1;
}

@keyframes username3D {
  0% {
    transform: translateY(8px) rotateX(10deg) scale(0.98);
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.03),
      0 2px 0 rgba(0, 0, 0, 0.06),
      0 6px 12px rgba(0, 0, 0, 0.45);
    filter: saturate(0.95);
  }
  40% {
    transform: translateY(-2px) rotateX(0deg) scale(1.03);
    text-shadow:
      0 2px 0 rgba(255, 255, 255, 0.08),
      0 6px 0 rgba(0, 0, 0, 0.08),
      0 12px 20px rgba(0, 0, 0, 0.55);
    filter: saturate(1.1);
  }
  70% {
    transform: translateY(-1px) rotateX(0deg) scale(1.01);
  }
  100% {
    transform: translateY(0) rotateX(0deg) scale(1);
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.06),
      0 2px 0 rgba(0, 0, 0, 0.06),
      0 4px 0 rgba(0, 0, 0, 0.06),
      0 6px 12px rgba(0, 0, 0, 0.35);
  }
}

.photo-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.photo-upload-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0);
  border-radius: 50%;
  transition: transform 0.4s ease;
}

.photo-upload-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.photo-upload-btn:hover::before {
  transform: scale(1);
}

.photo-upload-btn:active {
  transform: scale(0.95);
}

/* CONTENT */
.dashboard-content {
  padding: 25px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* CARDS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  padding: 25px;
  border-radius: 16px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: cardSlideIn 0.6s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 0 20px rgba(37, 99, 235, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.card p {
  font-size: 32px;
  font-weight: bold;
  color: #f0f4f8;
  animation: countUp 1s ease-out;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* CONTENT AREA */
.content-area {
  flex: 1;
  overflow-y: auto;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: slideUp 0.5s ease;
  transition: all 0.3s ease;
  color: #e2e8f0;
}

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

@keyframes cardPop {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdropFadeIn {
  from {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
  to {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
}

@keyframes backdropFadeOut {
  from {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
  to {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }

  .topbar {
    padding: 0 15px;
  }
}

/* ========================= */
/* TOAST NOTIFICATION SYSTEM */
/* ========================= */

#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  min-width: 250px;
  margin-bottom: 15px;
  padding: 14px 18px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  animation:
    slideIn 0.4s ease,
    fadeOut 0.4s ease 3.6s forwards;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.toast.success {
  background: #16a34a;
}
.toast.error {
  background: #dc2626;
}
.toast.info {
  background: #2563eb;
}

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

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(120%);
  }
}

/* ========================= */
/* LOADING SPINNER */
/* ========================= */

.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.hidden {
  display: none;
}

.spinner {
  width: 55px;
  height: 55px;
  border: 5px solid #e2e8f0;
  border-top: 5px solid #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================= */
/* FORM STYLES */
/* ========================= */

.crm-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.crm-form input,
.crm-form textarea,
.crm-form select {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(8px);
  color: #f0f4f8;
  font-weight: 500;
}

.crm-form input:focus,
.crm-form textarea:focus,
.crm-form select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.3),
    inset 0 1px 3px rgba(0, 0, 0, 0.2);
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  transform: translateY(-2px);
}

.crm-form select {
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23f0f4f8" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  padding-right: 40px;
}

.crm-form select option {
  background: #1e293b;
  color: #f0f4f8;
  padding: 8px 12px;
  font-weight: 500;
}

.crm-form select option:hover {
  background: #334155;
  color: #ffffff;
}

.crm-form select option:checked {
  background: linear-gradient(#667eea, #667eea);
  background-color: #667eea;
  color: #ffffff;
}

.crm-form textarea {
  min-height: 100px;
  resize: vertical;
}

.crm-form button {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.8),
    rgba(118, 75, 162, 0.8)
  );
  backdrop-filter: blur(8px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 13px;
  box-shadow:
    0 8px 20px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.crm-form button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.crm-form button:hover {
  background: linear-gradient(
    135deg,
    rgba(118, 75, 162, 0.9),
    rgba(99, 102, 241, 0.9)
  );
  backdrop-filter: blur(12px);
  transform: translateY(-3px);
  box-shadow:
    0 12px 30px rgba(102, 126, 234, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.crm-form button:hover::before {
  width: 300px;
  height: 300px;
}

.crm-form button:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ========================= */
/* TOPIC GRID AND CARDS */
/* ========================= */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.topic-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 15px;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  position: relative;
  animation: cardPop 0.6s ease-out backwards;
}

.topic-card:nth-child(1) {
  animation-delay: 0.05s;
}
.topic-card:nth-child(2) {
  animation-delay: 0.1s;
}
.topic-card:nth-child(3) {
  animation-delay: 0.15s;
}
.topic-card:nth-child(4) {
  animation-delay: 0.2s;
}
.topic-card:nth-child(5) {
  animation-delay: 0.25s;
}
.topic-card:nth-child(n + 6) {
  animation-delay: 0.3s;
}

.topic-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.topic-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(15px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 20px rgba(99, 102, 241, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

.topic-card:hover::after {
  opacity: 1;
}

.topic-card h3 {
  margin: 0 0 8px;
  color: #f0f4f8;
  font-size: 16px;
  transition: color 0.3s ease;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.topic-card:hover h3 {
  color: #fbbf24;
}

.topic-card p {
  color: #e2e8f0;
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.5;
  transition: color 0.3s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  text-indent: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-card:hover p {
  color: #ffffff;
}

.topic-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.3s ease;
}

.topic-card:hover img {
  transform: scale(1.08) rotate(1deg);
  filter: brightness(1.1);
}

.topic-card .category-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.5);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.topic-card .subheading-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.5); /* greenish tint */
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
  margin-bottom: 10px;
  text-transform: capitalize;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Global button styles for edit/delete buttons */
.edit-btn,
.delete-btn {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.edit-btn:hover,
.delete-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.edit-btn:active,
.delete-btn:active {
  transform: scale(0.97);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.actions button {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.actions button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    width 0.5s,
    height 0.5s;
}

.actions button:active {
  transform: scale(0.95);
}

.actions .delete-btn {
  background: rgba(239, 68, 68, 0.55);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.actions .delete-btn::before {
  background: rgba(255, 255, 255, 0.15);
}

.actions .delete-btn:hover {
  background: rgba(239, 68, 68, 0.75);
  backdrop-filter: blur(10px);
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(239, 68, 68, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.actions .delete-btn:hover::before {
  width: 200px;
  height: 200px;
}

.actions .edit-btn {
  background: rgba(59, 130, 246, 0.55);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.actions .edit-btn::before {
  background: rgba(255, 255, 255, 0.15);
}

.actions .edit-btn:hover {
  background: rgba(59, 130, 246, 0.75);
  backdrop-filter: blur(10px);
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(59, 130, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.actions .edit-btn:hover::before {
  width: 200px;
  height: 200px;
}

/* ========================= */
/* MODAL STYLES */
/* ========================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(0);
  animation: backdropFadeIn 0.4s ease-out;
  transition:
    background 0.3s ease,
    backdrop-filter 0.3s ease;
}

.modal:not(.hidden) {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
  animation: backdropFadeOut 0.3s ease-out forwards;
}

.modal-content {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(20px);
  padding: 30px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.3s;
}

.close-btn:hover {
  color: #f0f4f8;
  transform: rotate(90deg) scale(1.1);
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #f0f4f8;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========================= */
/* USER LIST CARDS (Compact) */
/* ========================= */

.user-list-card {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: cardPop 0.6s ease-out backwards;
}

.user-list-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.user-list-content {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.user-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.user-list-card:hover .user-list-avatar {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.user-list-info {
  flex: 1;
  min-width: 150px;
}

.user-list-name {
  font-weight: 700;
  color: #f0f4f8;
  font-size: 14px;
  margin-bottom: 2px;
}

.user-list-email {
  font-size: 12px;
  color: #94a3b8;
}

.user-list-role {
  min-width: 80px;
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: capitalize;
}

.user-list-categories {
  flex: 1;
  min-width: 120px;
  color: #cbd5e1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px;
}

.user-list-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.user-list-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-list-btn-edit {
  background: rgba(59, 130, 246, 0.5);
  color: #ffffff;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.user-list-btn-edit:hover {
  background: rgba(59, 130, 246, 0.8);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.user-list-btn-delete {
  background: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.user-list-btn-delete:hover {
  background: rgba(239, 68, 68, 0.8);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.user-list-btn:active {
  transform: scale(0.96);
}

/* ========================= */
/* MOBILE MENU BUTTON */
/* ========================= */

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: all 0.3s ease;
}

.mobile-menu-btn span {
  width: 24px;
  height: 3px;
  background: #f0f4f8;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn:hover span {
  background: #c7d2fe;
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ========================= */
/* MOBILE RESPONSIVENESS */
/* ========================= */

@media (max-width: 768px) {
  /* BODY & LAYOUT */
  body {
    margin-left: 0;
    margin-top: 0;
  }

  /* SIDEBAR MOBILE */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 280px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* OVERLAY FOR MOBILE */
  body.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(3px);
  }

  /* TOPBAR MOBILE */
  .topbar {
    height: 70px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 15px;
  }

  .mobile-menu-btn {
    display: flex;
    order: -1;
  }

  .welcome {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }

  .topbar-right {
    gap: 10px;
  }

  .profile-section {
    padding: 6px 8px;
    gap: 8px;
  }

  .profile-img {
    width: 30px;
    height: 30px;
  }

  .photo-upload-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .logoutBtn {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* MAIN CONTENT */
  .main {
    width: 100%;
    flex-direction: column;
  }

  .dashboard-content {
    padding: 15px;
    max-width: 100%;
  }

  /* CARDS GRID */
  .cards {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
  }

  .card {
    padding: 20px;
    border-radius: 14px;
  }

  .card h3 {
    font-size: 14px;
  }

  .card p {
    font-size: 28px;
  }

  /* TOPIC GRID */
  .topic-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .topic-card {
    border-radius: 12px;
    padding: 12px;
  }

  .topic-card h3 {
    font-size: 15px;
  }

  .topic-card p {
    font-size: 13px;
  }

  .topic-card img {
    height: 120px;
  }

  /* Manage Users - responsive user cards */
  #manageUsersPanel h3 {
    color: #e6eefc;
    margin-bottom: 8px;
  }
  #manageUsersPanel > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }

  .user-card {
    background: white;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .user-card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }

  .user-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e6eef8;
    flex: 0 0 64px;
  }

  .user-card-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
  }

  .user-card-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .user-card-meta {
    min-width: 0;
  }

  .user-card-name {
    display: block;
    font-size: 16px;
    color: #0f172a;
  }
  .user-card-email {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
  }

  .user-card-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #f8fafc;
  }
  .btn-sm {
    padding: 6px 8px;
    font-size: 12px;
  }
  .btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
  }

  /* Primary button variant for consistent action color */
  .btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.12);
  }

  .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.12);
  }

  .user-card-role,
  .user-card-cats {
    margin-top: 8px;
    font-size: 13px;
    color: #475569;
    word-break: break-word;
  }

  @media (max-width: 640px) {
    .user-card-title-row {
      flex-direction: column;
      align-items: flex-start;
    }
    .user-card-actions {
      margin-left: 0;
      margin-top: 8px;
    }
    .user-card-email {
      max-width: 100%;
    }
  }

  .actions {
    gap: 8px;
    margin-top: 10px;
  }

  .actions button {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* FORMS */
  .crm-form {
    gap: 12px;
  }

  .crm-form input,
  .crm-form textarea,
  .crm-form select {
    padding: 10px;
    font-size: 14px;
  }

  .crm-form textarea {
    min-height: 80px;
  }

  .crm-form button {
    padding: 10px;
    font-size: 12px;
  }

  /* MODAL */
  .modal-content {
    width: 95%;
    max-width: 100%;
    padding: 20px;
    border-radius: 16px;
  }

  .modal-content h2 {
    font-size: 18px;
  }

  .close-btn {
    font-size: 24px;
    top: 10px;
    right: 15px;
  }

  /* CONTENT AREA */
  .content-area {
    padding: 15px;
  }

  /* ANALYTICS GRID */
  .analytics-grid {
    grid-template-columns: 1fr !important;
  }

  /* LIST ITEMS */
  .sidebar li {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
  }

  .logo {
    font-size: 18px;
    margin-bottom: 30px;
  }
}

/* ========================= */
/* SMALL MOBILE (< 480px) */
/* ========================= */

@media (max-width: 480px) {
  /* BODY & LAYOUT */
  body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f0f1f 100%);
  }

  /* TOPBAR EXTRA SMALL */
  .topbar {
    height: 60px;
    padding: 0 10px;
  }

  .welcome {
    display: none;
  }

  .topbar-right {
    gap: 8px;
  }

  .profile-section {
    padding: 5px 6px;
  }

  .profile-img {
    width: 32px;
    height: 32px;
  }

  .logoutBtn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* DASHBOARD CONTENT */
  .dashboard-content {
    padding: 12px;
  }

  /* CARDS SMALL SCREEN */
  .cards {
    gap: 12px;
  }

  /* Strong overrides for top-right avatar and header actions */
  #profilePhoto {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
  }

  .topbar-right {
    gap: 8px !important;
    align-items: center;
  }

  /* Ensure primary actions use primary look by default where class applied */
  .btn-primary,
  button.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  /* Small tweak: make profile menu button icons slightly smaller */
  .profile-section .photo-upload-btn {
    width: 26px;
    height: 26px;
  }
  .card {
    padding: 16px;
  }

  .card h3 {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .card p {
    font-size: 24px;
  }

  /* TOPIC CARD SMALL */
  .topic-grid {
    gap: 12px;
  }

  .topic-card {
    padding: 10px;
    border-radius: 10px;
  }

  .topic-card h3 {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .topic-card p {
    font-size: 12px;
  }

  .topic-card img {
    height: 100px;
    margin-bottom: 8px;
  }

  .topic-card .category-badge {
    padding: 4px 8px;
    font-size: 10px;
  }

  .actions {
    gap: 6px;
  }

  .actions button {
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 6px;
  }

  /* MODAL SMALL */
  .modal-content {
    padding: 16px;
  }

  .modal-content h2 {
    font-size: 16px;
    margin-bottom: 15px;
  }

  .close-btn {
    font-size: 20px;
  }

  /* FORMS SMALL */
  .crm-form input,
  .crm-form textarea,
  .crm-form select {
    padding: 8px;
    font-size: 13px;
  }

  .crm-form button {
    padding: 8px;
    font-size: 11px;
  }

  .crm-form textarea {
    min-height: 70px;
  }

  /* SIDEBAR SMALL */
  .sidebar {
    max-width: 260px;
  }

  .logo {
    font-size: 16px;
    margin-bottom: 25px;
  }

  .sidebar li {
    padding: 10px;
    font-size: 13px;
    margin-bottom: 5px;
  }
}

/* ========================= */
/* LANDSCAPE MOBILE */
/* ========================= */

@media (max-height: 600px) and (max-width: 768px) {
  .sidebar {
    overflow-y: auto;
  }

  .topbar {
    height: 60px;
  }

  .cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 15px;
  }

  .dashboard-content {
    padding: 10px;
  }
}

/* ========================= */
/* USER EDIT FORM */
/* ========================= */

#editUserContainer {
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-edit-container {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 32px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: cardPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-edit-title {
  font-size: 24px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.user-edit-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Segoe UI", sans-serif;
}

.form-input::placeholder,
.form-select::placeholder {
  color: #64748b;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow:
    0 0 0 3px rgba(96, 165, 250, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.form-input:hover,
.form-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(30, 41, 59, 0.5);
}

.form-select {
  cursor: pointer;
}

.form-select option {
  background: #1e293b;
  color: #e2e8f0;
  padding: 8px;
}

/* Categories Grid */
.categories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  width: 100%;
  background: rgba(12, 18, 28, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  color: #dbeafe;
  transition: all 0.18s ease-in-out;
  font-family: "Segoe UI", sans-serif;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    inset 0 -8px 24px rgba(0, 0, 0, 0.35);
  .category-checkbox:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(96, 165, 250, 0.3);
  }
  color: #7b8794;
  .category-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #60a5fa;
    background: rgba(12, 18, 28, 0.6);
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow:
      0 6px 20px rgba(37, 99, 235, 0.06),
      0 0 0 4px rgba(96, 165, 250, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);
    outline: 2px solid rgba(96, 165, 250, 0.5);
    outline-offset: 2px;
  }

  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 18, 28, 0.52);
  color: #cbd5e1;
  font-weight: 500;
}

.category-checkbox:has(input:checked) {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);

  /* textarea specifics to match screenshot */
  .user-edit-form textarea,
  .form-input[type="textarea"] {
    min-height: 90px;
    resize: vertical;
  }

  /* align actions right for a compact footer */
  .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
  }
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.05);
}

.category-checkbox:has(input:checked) span {
  color: #60a5fa;
  font-weight: 600;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  flex: 1;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.9),
    rgba(96, 165, 250, 0.9)
  );
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 8px 16px rgba(37, 99, 235, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 1),
    rgba(96, 165, 250, 1)
  );
  transform: translateY(-2px);
  box-shadow:
    0 12px 24px rgba(37, 99, 235, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: rgba(100, 116, 139, 0.3);
  color: #e2e8f0;
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========================= */
/* CATEGORIES PAGE STYLES */
/* ========================= */
.categories-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  padding: 20px 0;
  max-width: 100%;
}

.category-card {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.8),
    rgba(30, 41, 59, 0.9)
  );
  border: 1px solid rgba(100, 150, 255, 0.2);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s ease,
    filter 0.5s ease,
    border-color 0.4s ease;
  filter: blur(0px);
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.category-card.blur-enter {
  filter: blur(8px);
  opacity: 0.7;
}

.category-card.blur-exit {
  filter: blur(6px);
  opacity: 0.6;
}

.category-card.focus {
  filter: blur(0px);
  opacity: 1;
  transform: scale(1.05);
  border-color: rgba(100, 150, 255, 0.6);
  box-shadow: 0 20px 50px rgba(59, 130, 246, 0.3);
}

.category-card:hover {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 25px 60px rgba(59, 130, 246, 0.4);
  border-color: rgba(100, 180, 255, 0.8);
}

.category-image {
  background-size: cover;
  background-position: center;
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
}

.category-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at center,
    transparent 0%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
}
.category-meta {
  padding: 18px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 70px;
}
.category-name {
  color: #f1f5f9;
  font-weight: 800;
  font-size: 20px;
  line-height: 1.3;
  flex: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.3px;
}
.category-overlay {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateY(-50%) scale(0.8);
}
.category-card:hover .category-overlay {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}
.category-overlay .view-topics {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.25),
    rgba(88, 166, 255, 0.15)
  );
  color: #60a5fa;
  border: 1.5px solid rgba(96, 165, 250, 0.4);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}
.category-overlay .view-topics:hover {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.4),
    rgba(88, 166, 255, 0.3)
  );
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subheading-header {
  font-size: 14px;
  font-weight: 700;
  color: #a5b4fc;
  margin: 12px 0 4px;
}
.topic-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: rgba(12, 18, 28, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.topic-row:hover {
  background: rgba(12, 18, 28, 0.7);
  border-color: rgba(100, 116, 139, 0.3);
}

.topic-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.topic-title {
  color: #e2e8f0;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-word;
}

.topic-description {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
  max-width: 100%;
  margin-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  overflow-y: auto;
  transition: all 0.4s ease;
  margin: 0;
  padding: 0;
}

.topic-row:hover .topic-description {
  opacity: 1;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 8px;
  padding-top: 8px;
}

.topic-row:hover .topic-description::-webkit-scrollbar {
  width: 4px;
}
.topic-row:hover .topic-description::-webkit-scrollbar-track {
  background: transparent;
}
.topic-row:hover .topic-description::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 2px;
}

.topic-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}
.topic-preview-btn {
  background: rgba(59, 130, 246, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #60a5fa;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.topic-preview-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.6);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.topic-preview-btn:active {
  transform: scale(0.85);
}

.topic-preview-btn svg {
  width: 16px;
  height: 16px;
}

/* Modal */
.preview-modal.hidden {
  display: none;
}
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}
.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}
.preview-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(6, 10, 18, 0.95);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}
.preview-close {
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #e2e8f0;
  font-size: 28px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 10;
}
.preview-close:hover {
  background: rgba(0, 0, 0, 0.8);
}
.preview-iframe-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}
.preview-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.preview-fallback {
  padding: 20px;
  color: #cbd5e1;
}

/* Preview Modal Title and Description */
#previewTitle {
  flex-shrink: 0;
  padding: 16px 20px 0 20px;
  margin: 0;
  color: #e2e8f0;
  font-size: 20px;
  font-weight: 600;
}

/* Preview Description wrapper and heading */
#previewDescriptionWrap {
  flex: 0 0 auto;
  width: 100%;
  padding: 0 20px 16px 20px;
  box-sizing: border-box;
}

#previewDescriptionHeading {
  margin: 8px 0 6px 0;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
}

#previewDescription {
  flex: 0 0 auto;
  padding: 16px 20px;
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 0;
  width: 100%;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
}

#previewDescription::-webkit-scrollbar {
  width: 6px;
}
#previewDescription::-webkit-scrollbar-track {
  background: transparent;
}
#previewDescription::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 3px;
}
#previewDescription::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.6);
}

/* Topics Modal */
.topics-modal.hidden {
  display: none;
}
.topics-modal {
  position: fixed;
  inset: 0;
  z-index: 1999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topics-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.topics-modal-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  background: rgba(6, 10, 18, 0.95);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #60a5fa;
}

/* Topics Modal Header */
.topics-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.2);
  background: rgba(10, 14, 24, 0.8);
  flex-shrink: 0;
}

/* ensure Swal dialogs float above topics modal */
.swal2-container {
  z-index: 100000 !important;
}

.topics-header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 60px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px;
  flex-shrink: 0;
}

.header-category {
  text-align: center;
}

.header-category h2 {
  color: #e2e8f0;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.topics-header-middle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  text-align: center;
}

.header-contact-info {
  color: #acacac;
  font-size: 12px;
  line-height: 1.4;
}

.topics-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-icon {
  background: rgba(100, 116, 139, 0.1);
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
}

.header-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.header-icon:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  color: #60a5fa;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

.header-icon:hover svg {
  transform: translateY(2px);
}

.header-icon:active {
  transform: scale(0.95);
}
#topicsList {
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 20px;
  flex: 1;
}

/* Custom scrollbar styling - Webkit (Chrome, Safari, Edge) */
#topicsList::-webkit-scrollbar {
  width: 8px;
}
#topicsList::-webkit-scrollbar-track {
  background: transparent;
}
#topicsList::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.5);
  border-radius: 4px;
}
#topicsList::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.8);
}

/* Firefox scrollbar */
#topicsList {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}
.topics-close {
  position: fixed;
  right: 16px;
  top: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #e2e8f0;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 2000;
  transition: all 0.2s ease;
}
.topics-close:hover {
  background: rgba(0, 0, 0, 0.6);
  color: #60a5fa;
}

@media (max-width: 1200px) {
  .categories-page-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
  }
}

@media (max-width: 900px) {
  .categories-page-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .categories-page-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .category-name {
    font-size: 18px;
  }
}

@media (max-width: 520px) {
  .categories-page-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .category-name {
    font-size: 16px;
  }

  .preview-modal-content {
    margin: 12px;
  }
}

/* Print Styles for PDF */
@media print {
  /* Ensure modal content is visible when printing */
  .topics-modal {
    display: block !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    z-index: auto !important;
    background: white !important;
  }

  .topics-modal-backdrop {
    display: none !important;
  }

  /* Ensure header is visible */
  .topics-modal-header {
    background: white !important;
    color: #000 !important;
    border-bottom: 2px solid #ddd !important;
    display: flex !important;
    page-break-after: avoid !important;
  }

  /* Logo should be visible */
  .header-logo {
    width: 80px !important;
    height: 80px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent !important;
  }

  .header-category h2,
  .header-contact-info {
    color: #000 !important;
  }

  /* Hide download button in print */
  .header-icon {
    display: none !important;
  }

  /* Make topics list printable */
  #topicsList {
    max-height: none !important;
    overflow: visible !important;
    color: #000 !important;
  }

  /* Topic cards styling for print */
  .topic-card {
    page-break-inside: avoid !important;
    color: #000 !important;
    background: white !important;
    border: 1px solid #ddd !important;
  }

  /* Close button should not print */
  .topics-close {
    display: none !important;
  }

  /* Ensure body background doesn't print */
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ========================= */
/* CUSTOM SCROLLBAR STYLING */
/* ========================= */

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #ffffff;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgb(16, 41, 94);
  border-radius: 10px;
  border: 1px solid #ffffff;
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgb(37, 99, 235);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgb(16, 41, 94) #ffffff;
}

/* Category management custom scroll */
#categoryManagement {
  scrollbar-width: thin;
  scrollbar-color: rgb(16, 41, 94) #ffffff;
}

#categoryManagement::-webkit-scrollbar {
  width: 8px;
}

#categoryManagement::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 8px;
}

#categoryManagement::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#categoryManagement::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.5);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.8);
}
