:root {
  --primary-color: #2563EB;
  --secondary-color: #0F172A;
  --bg-color: #F8FAFC;
  --accent-color: #22C55E;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --sidebar-width: 260px;
  --bottom-nav-height: 65px;
}

/* ===================== BASE ===================== */
body {
  background-color: var(--bg-color);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
}

/* ===================== DESKTOP SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--secondary-color);
  color: white;
  padding-top: 2rem;
  z-index: 1000;
  flex-direction: column;
}

.sidebar .nav-link {
  color: #94A3B8;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  border-radius: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link i {
  margin-right: 0.75rem;
  font-size: 1.25rem;
}

/* ===================== MOBILE DRAWER ===================== */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80%;
  max-width: 300px;
  height: 100vh;
  background-color: var(--secondary-color);
  color: white;
  z-index: 1050;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-drawer.open {
  left: 0;
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.mobile-drawer .nav-link {
  color: #94A3B8;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.mobile-drawer .nav-link:hover,
.mobile-drawer .nav-link.active {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-drawer .nav-link i {
  margin-right: 0.85rem;
  font-size: 1.2rem;
}

/* Overlay backdrop */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1049;
  backdrop-filter: blur(2px);
}

.drawer-overlay.open {
  display: block;
}

/* ===================== MOBILE BOTTOM NAV ===================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: stretch;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgb(0 0 0 / 0.08);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.4rem 0;
  transition: color 0.2s;
  gap: 3px;
}

.mobile-nav-item i {
  font-size: 1.35rem;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--primary-color);
}

.mobile-nav-item:hover {
  color: var(--primary-color);
}

/* Extra bottom padding so content doesn't hide behind bottom nav on mobile */
.pb-mobile {
  padding-bottom: 1rem;
}

@media (max-width: 991.98px) {
  .pb-mobile {
    padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
  }
}

/* ===================== MAIN CONTENT AREA ===================== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
  }
}

/* ===================== NAVBAR ===================== */
.navbar-custom {
  background: white;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  padding: 0.5rem 0;
}

.navbar-hamburger {
  color: var(--secondary-color);
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
}

.navbar-hamburger:hover {
  background: #F1F5F9;
  border-radius: 6px;
}

/* ===================== NAVBAR TOGGLER (Landing Page) ===================== */
.navbar-toggler {
  border: 2px solid var(--secondary-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  transition: all 0.2s ease;
  background-color: transparent;
}

.navbar-toggler:hover {
  background-color: rgba(15, 23, 42, 0.1);
  border-color: var(--primary-color);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
  outline: none;
  border-color: var(--primary-color);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(15, 23, 42, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 1.5rem;
  height: 1.5rem;
  display: inline-block;
}

/* Ensure navbar collapse animation is smooth */
.navbar-collapse {
  transition: height 0.3s ease-in-out;
}

/* Mobile navbar items spacing */
@media (max-width: 991.98px) {
  .navbar-collapse .navbar-nav {
    padding: 1rem 0;
  }

  .navbar-collapse .nav-item {
    padding: 0.5rem 0;
  }

  /* Language dropdown in mobile - full width */
  .navbar-collapse .dropdown-menu {
    width: 100%;
    border: none;
    box-shadow: none;
  }

  /* Login/Sign Up buttons - full width on mobile */
  .navbar-collapse .btn {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* ===================== CARDS ===================== */
.lab-card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.lab-card:hover {
  transform: translateY(-3px);
}

/* ===================== BUTTONS ===================== */
.btn-primary {
  background-color: var(--primary-color);
  border: none;
  padding: 0.6rem 1.5rem;
  font-weight: 500;
}

.btn-primary:hover {
  background-color: #1D4ED8;
}

/* ===================== TYPOGRAPHY ===================== */
h1, h2, h3 {
  font-weight: 700;
  color: var(--secondary-color);
}

.section-title {
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
}

/* ===================== EXPERIMENT LIST - MOBILE FILTER FIX ===================== */
@media (max-width: 767.98px) {
  .experiment-filters {
    flex-direction: column !important;
    gap: 0.5rem !important;
    width: 100%;
  }

  .experiment-filters select,
  .experiment-filters button {
    width: 100% !important;
  }

  /* Iframe in experiment detail */
  iframe {
    height: 380px !important;
  }

  /* Table fix for admin dashboard */
  .table-responsive {
    font-size: 0.82rem;
  }

  /* Section title smaller on mobile */
  .section-title {
    font-size: 1.2rem;
  }

  /* Stat cards remove hover jump on touch */
  .lab-card:hover {
    transform: none;
  }
}

/* ===================== UTILITY ===================== */
.container-fluid {
  max-width: 1400px;
}