html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ===== Main Content Offset + Sidebar Rail (icon-only) ===== */
#sidebar {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease-out;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .main-content-wrapper {
    padding-left: 248px;
    transition: padding-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Daraltılmış = RAIL: yalnızca ikonlar. Genişlik, sola hizalı ikonu görsel olarak
     ortalayacak şekilde seçildi (ikon ekspand'deki x'te kalır, rail'de de ortada durur). */
  html.sidebar-collapsed #sidebar {
    width: 76px;
  }
  html.sidebar-collapsed .main-content-wrapper {
    padding-left: 76px;
  }

  /* Rail modunda metinleri/alt menüleri/chevron'ları gizle, ikonları ortala */
  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-brand-text,
  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-link span,
  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-link svg:not(.sidebar-icon),
  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-submenu,
  html.sidebar-collapsed:not(.sidebar-peek) .rail-hide {
    display: none !important;
    opacity: 0;
  }

  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-heading {
    visibility: hidden;
  }

  /* Genişlerken içeriklerin anında çıkıp patlamasını önlemek için fade-in ve delay ekliyoruz */
  html.sidebar-collapsed.sidebar-peek .sidebar-brand-text,
  html.sidebar-collapsed.sidebar-peek .sidebar-link span,
  html.sidebar-collapsed.sidebar-peek .sidebar-link svg:not(.sidebar-icon),
  html.sidebar-collapsed.sidebar-peek .sidebar-submenu,
  html.sidebar-collapsed.sidebar-peek .rail-hide {
    animation: fadeInRailContent 0.15s ease-out both;
    animation-delay: 0.08s; /* menü biraz genişledikten sonra içerik belirsin */
  }

  html.sidebar-collapsed.sidebar-peek .sidebar-heading {
    visibility: visible;
    animation: fadeInRailContent 0.15s ease-out both;
    animation-delay: 0.08s;
  }

  @keyframes fadeInRailContent {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  /* Menü ikonları doğal sol konumlarında (≈22px) kalır: açık menüdeki ikon x'i ile birebir
     aynı. Daraltınca sadece sağdaki yazı alanı kaybolur, ikon yatayda HİÇ oynamaz. */
  html.sidebar-collapsed:not(.sidebar-peek) .sidebar-link {
    overflow: hidden;
  }
  /* PEEK: hover edildiğinde sidebar genişler ve içeriği iter (sayfa daralır). */
  html.sidebar-collapsed.sidebar-peek #sidebar {
    width: 248px;
  }
  html.sidebar-collapsed.sidebar-peek .main-content-wrapper {
    padding-left: 248px;
  }
}

/* ===== Sidebar Styles ===== */

.sidebar-scroll::-webkit-scrollbar {
  width: 3px;
}
.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(52, 211, 153, 0.15);
  border-radius: 9999px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 211, 153, 0.3);
}

.sidebar-heading {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: #bbf7d0; /* green-200 */
  transition: color 0.15s ease;
}

.sidebar-link {
  display: flex;
  align-items: center;
  height: 40px; /* fixed height to prevent vertical shifting */
  gap: 0.625rem;
  padding: 0 0.625rem; /* remove vertical padding since height is fixed */
  border-radius: 0.5rem;
  font-size: 16px;
  font-weight: 500;
  color: #f0fdf4; /* neredeyse beyaz, hafif yeşil tonu */
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(6, 78, 59, 0.45);
  color: #ffffff;
}

.sidebar-link:hover .sidebar-icon {
  color: #bbf7d0;
}

.sidebar-link.active {
  background: rgba(16, 185, 129, 0.1); /* emerald-500/10 */
  color: #34d399; /* emerald-400 */
  font-weight: 600;
  border-color: rgba(16, 185, 129, 0.15);
}

.sidebar-link.active .sidebar-icon {
  color: #34d399; /* emerald-400 */
}

.sidebar-submenu {
  margin-left: 1.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(6, 78, 59, 0.5);
  margin-top: 0.125rem;
  margin-bottom: 0.25rem;
}

.sidebar-sublink {
  display: block;
  padding: 0.375rem 0.625rem;
  font-size: 15px;
  font-weight: 500;
  color: #dcfce7; /* emerald-50 tonu, açık beyazımsı */
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-sublink:hover {
  color: #ffffff;
  background: rgba(6, 78, 59, 0.35);
}

.sidebar-sublink.active {
  color: #34d399; /* emerald-400 */
  background: rgba(16, 185, 129, 0.08); /* emerald-500/8 */
  font-weight: 600;
}

.page-hidden {
  display: none !important;
}