:root {
  --bg-main: #11121a;
  --bg-card: #1a1b2e;
  --primary: #8b7cf6;
  --primary-soft: #a99cff;
  --accent: #f4a340;
  --text-main: #f2f3f7;
  --text-muted: #cfd3ff;
  --border-soft: #2a2d4a;
}

/* Light Mode Variables */
body.light-mode {
  --bg-main: #f8f9fc;
  --bg-card: #ffffff;
  --primary: #6a5be9;
  --primary-soft: #8b7cf6;
  --accent: #e68a00;
  --text-main: #1a1b2e;
  --text-muted: #6c757d;
  --border-soft: #d0d4ff;
}

/* ===== BASE ===== */
body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== NAVBAR ===== */
.navbar {
  background: transparent;
  padding: 24px 0;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.navbar-brand img {
  height: 36px;
}
.btn-primary {
  background: var(--primary);
  border: none;
  color: #0e0f1a;
  font-weight: 600;
  border-radius: 12px;
}
.btn-primary:hover {
  background: var(--primary-soft);
}

/* ===== THEME TOGGLE ===== */
#themeToggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  color: var(--text-main);
  transition: all 0.3s ease;
  margin-left: 8px;
}
#themeToggle:hover {
  transform: rotate(15deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(139, 124, 246, 0.3);
}

/* ===== OUTLINE BUTTONS ===== */
.btn-outline-light {
  border-radius: 12px;
  color: var(--text-main);
  border-color: var(--border-soft);
}
body.light-mode .btn-outline-light {
  color: #4a4a7a !important;
  border-color: #c0c4e0 !important;
}
body.light-mode .btn-outline-light:hover {
  background-color: #f0f2ff !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* ===== FILTER BUTTONS ===== */
.filter-btn,
.filter-lab-btn {
  transition: all 0.2s ease;
}
body.light-mode .filter-btn,
body.light-mode .filter-lab-btn {
  color: #4a4a7a !important;
  border-color: #c0c4e0 !important;
  background: #ffffff !important;
}
body.light-mode .filter-btn.active,
body.light-mode .filter-lab-btn.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}
body.light-mode .filter-btn:hover,
body.light-mode .filter-lab-btn:hover {
  background: #f0f2ff !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* ===== HERO ===== */
.hero {
  padding: 130px 0 100px;
  background:
    radial-gradient(circle at top right, #8b7cf622, transparent 45%),
    radial-gradient(circle at bottom left, #f4a34018, transparent 45%);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139,124,246,0.08), transparent 70%);
  transform: translate(-50%, -50%);
  z-index: 1;
}
.hero .container {
  position: relative;
  z-index: 2;
}
.hero h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-desc {
  color: var(--text-muted);
  max-width: 720px;
  margin: 18px auto 0;
}
.section {
  padding: 90px 0;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 720px;
  margin: 12px auto 0;
}

/* ===== PROJECTS & FILTERING ===== */
.hidden-item {
  display: none !important;
}
.project-item {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: fadeUp 0.8s ease forwards;
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.card h6 {
  color: var(--text-main);
  font-weight: 600;
}
.card p {
  color: var(--text-muted);
}
.badge-category {
  background: #8b7cf622;
  color: var(--primary);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  animation: badgePulse 2s infinite alternate;
}
@keyframes badgePulse {
  from { opacity: 0.8; }
  to { opacity: 1; box-shadow: 0 0 6px rgba(139,124,246,0.3); }
}
.badge-course {
  background: #ffffff12;
  color: #d6d9ff;
  border: 1px solid var(--border-soft);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 50px;
}
body.light-mode .badge-course {
  background: #f0f0ff;
  color: #5a5a8a;
  border-color: #d0d4ff;
}
.project-thumb {
  height: 180px;
  border-radius: 14px;
  background: linear-gradient(135deg, #26285a, #16172a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
body.light-mode .project-thumb {
  background: linear-gradient(135deg, #eef2ff, #dbe4ff);
  color: #5a5a8a;
}
.card:hover .project-thumb {
  transform: scale(1.06);
  box-shadow:
    0 0 0 1px rgba(139,124,246,.4),
    0 20px 40px rgba(139,124,246,.25),
    inset 0 0 20px rgba(139,124,246,0.2);
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.view-project-btn,
.text-warning {
  color: var(--accent) !important;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.25s ease, letter-spacing 0.25s ease;
}
.view-project-btn:hover,
.text-warning:hover {
  text-decoration: underline;
  transform: translateX(6px);
  letter-spacing: 0.3px;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ===== MODAL ===== */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  animation: scaleFade .3s ease;
}
.form-control {
  background: var(--bg-main);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}
.form-control:focus {
  background: var(--bg-main);
  border-color: var(--primary);
  box-shadow: none;
}

/* ===== FOOTER ===== */
.kb-footer {
  background: var(--bg-main);
  border-top: 1px solid var(--border-soft);
  padding: 80px 0 40px;
}
.footer-logo {
  width: 90px;
  opacity: .85;
}
.footer-brand {
  font-weight: 700;
  margin-bottom: 8px;
}
.footer-title {
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-main);
}
.footer-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li {
  margin-bottom: 10px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color .2s ease;
}
.footer-links a:hover {
  color: var(--primary-soft);
}
.footer-contact,
.footer-social {
  display: flex;
  gap: 10px;
  align-items: center;
}
.footer-contact svg,
.footer-social svg {
  width: 20px;
  fill: currentColor;
}
.footer-social a {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff08;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease, transform .25s ease;
}
body.light-mode .footer-social a {
  background: #f0f2ff;
}
.footer-social a:hover {
  background: rgba(139,124,246,.25);
  transform: translateY(-3px);
}
.footer-divider {
  border-color: var(--border-soft);
  margin: 40px 0 24px;
}
.footer-bottom {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleFade {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 30px;
}
.stat-number {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
}
.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  border-radius: 12px;
}
.search-input::placeholder {
  color: var(--text-muted);
}
body.light-mode .search-input::placeholder {
  color: var(--text-muted);
}

/* ===== DOTS ANIMATION ===== */
.hero-animation {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: .6;
  filter: blur(.3px);
}
.dot-1 { top: 20%; left: 15%; background: var(--primary); animation: float 8s ease-in-out infinite; }
.dot-2 { top: 65%; left: 25%; background: var(--accent); animation: rotate 12s linear infinite; }
.dot-3 { top: 30%; right: 18%; background: var(--primary-soft); animation: float 10s ease-in-out infinite reverse; }
.dot-4 { bottom: 20%; right: 30%; background: var(--accent); animation: rotate 14s linear infinite reverse; }
.dot-5 { top: 50%; left: 50%; background: var(--primary); animation: pulse 6s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); opacity: .4; }
  50% { transform: translateY(-20px); opacity: .8; }
}
@keyframes rotate {
  0% { transform: rotate(0deg) translateX(20px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(20px) rotate(-360deg); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .3; }
  50% { transform: scale(1.8); opacity: .8; }
}

/* ===== BADGES TYPE ===== */
.badge-hardware {
  background: #ff6b6b22;
  color: #ff8e8e;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  border: 1px solid #ff6b6b33;
}
.badge-software {
  background: #4ecdc422;
  color: #6ae6de;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  border: 1px solid #4ecdc433;
}

.badge-date {
  background: #e7eb0522;
  color: #eeeeec;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  border: 1px solid #d7ec1633;
}

/* ===== SCROLL TO TOP ===== */
#scrollToTopBtn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1030;
  width: 56px;
  height: 56px;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
  background-color: var(--accent) !important;
  color: #0e0f1a !important;
  border: none;
}
#scrollToTopBtn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#scrollToTopBtn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 4px 12px rgba(244, 163, 64, 0.4);
  background-color: #ffaf5c !important;
}

/* ===== ALERT ===== */
.alert-custom {
  background: #1e1f33;
  border: 1px solid var(--border-soft);
  color: #e0e3ff;
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.95rem;
}
body.light-mode .alert-custom {
  background: #f0f2ff;
  color: #4a4a7a;
  border-color: #d0d4ff;
}

/* ===== HERO BADGE ===== */
.hero-badge {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg,
    var(--accent),
    var(--primary),
    #ff6b6b,
    var(--accent)
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation:
    heroGlow 3s ease-in-out infinite,
    heroShift 8s linear infinite;
  text-shadow: 0 0 10px rgba(244, 163, 64, 0.4);
  padding: 6px 16px;
  border-radius: 50px;
  position: relative;
  display: inline-block;
}
.hero-badge::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: inherit;
  filter: blur(12px);
  opacity: 0.6;
  z-index: -1;
  border-radius: 50px;
}
@keyframes heroGlow {
  0%, 100% { text-shadow: 0 0 10px rgba(244, 163, 64, 0.4); }
  50% { text-shadow: 0 0 20px rgba(139, 124, 246, 0.7), 0 0 30px rgba(244, 163, 64, 0.6); }
}
@keyframes heroShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ===== VIEW PROJECT LINK ===== */
.view-project-btn {
  position: relative;
  color: var(--accent) !important;
  text-decoration: none;
  transition: color 0.25s ease, transform 0.2s ease, letter-spacing 0.2s ease;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.view-project-btn:hover {
  color: #ffcc80 !important;
  transform: translateX(4px);
  letter-spacing: 0.5px;
}
.view-project-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.view-project-btn:hover::after {
  width: 100%;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .dot {
    animation: none !important;
    opacity: 0.2;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .btn-group {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  .filter-btn, .filter-lab-btn {
    padding: 4px 10px !important;
    font-size: 12px;
  }
  .hero h1 {
    font-size: 2rem;
    line-height: 1.3;
  }
}

/* ===== SMOOTH ROTATING TEXT ===== */
#rotating-text {
  display: inline-block;
  min-width: 220px;
  text-align: left;
  opacity: 1;
  transition: opacity 0.4s ease-in-out;
}

#rotating-text.fade-out {
  opacity: 0 !important;
}

/* ===== VIEW & LIKE STATS ===== */
.view-count,
.like-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
body.light-mode .view-count,
body.light-mode .like-count {
  color: #6c757d;
}

.btn-like {
  color: var(--text-muted) !important;
  background: transparent !important;
  transition: transform 0.2s ease;
}
.btn-like:hover {
  transform: scale(1.1);
}
.btn-like.liked i {
  color: #ff6b8b !important;
}

/* ===== DETAIL PAGE STATS ===== */
#detailLikeBtn {
  color: var(--text-muted) !important;
  background: transparent !important;
  font-size: 0.875rem;
  transition: transform 0.2s ease, color 0.2s ease;
}
#detailLikeBtn:hover {
  transform: scale(1.05);
}
#detailLikeBtn.liked i {
  color: #ff6b8b !important;
}
body.light-mode #detailLikeBtn.liked i {
  color: #e63946 !important;
}

/* ===== PROJECT DETAIL STATS ICONS ===== */
.stat-icon {
  color: var(--text-muted);
  font-size: 1rem;
  transition: color 0.2s ease;
}

/* Pastikan tetap terlihat di dark mode */
body:not(.light-mode) .stat-icon {
  color: rgba(255, 255, 255, 0.75); /* putih transparan untuk dark mode */
}

body.light-mode .stat-icon {
  color: #6c757d; /* abu-abu standar Bootstrap untuk light mode */
}

/* Efek hover pada like button */
#detailLikeBtn:hover .stat-icon,
.btn-like:hover .stat-icon {
  color: var(--accent) !important;
}

/* Saat disukai, hati berwarna merah konsisten */
#detailLikeBtn.liked .stat-icon,
.btn-like.liked .stat-icon {
  color: #ff6b8b !important;
}
body.light-mode #detailLikeBtn.liked .stat-icon,
body.light-mode .btn-like.liked .stat-icon {
  color: #e63946 !important;
}

.challenge-status {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

/* Background for event date (light & dark friendly) */
.event-date {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;

  /* same text feel as description */
  color: var(--bs-body-color);
  opacity: 0.8;

  /* subtle background */
  background-color: rgba(var(--bs-body-color-rgb), 0.05);
}

/* Dark mode tuning */
[data-bs-theme="dark"] .event-date {
  background-color: rgba(255, 255, 255, 0.08);
  opacity: 0.9;
}
