/* Poppins-Regular @font-face: index.php <head> içinde (CDN adresi URL_IBOSOFT_CDN env değişkeninden) */

::after,
::before {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

a {
  text-decoration: none;
}

li {
  list-style: none;
}

h1 {
  font-weight: 600;
  font-size: 1.5rem;
}

/* Ensure body uses flexbox to push footer to bottom */
html,
body {
  overflow-x: hidden; /* Prevent horizontal scrolling */
  max-width: 100vw;
}

body {
  font-family: "Poppins-Regular", sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh; /* body büyümesin; taşma .main içinde scroll'a dönsün */
  height: 100dvh; /* mobil: adres çubuğunu hesaba katan dinamik viewport */
}

.main {
  height: 100vh;
  height: 100dvh;
  flex: 1;
  min-width: 0;
  min-height: 0; /* flex item content'i taştırmasın, iç scroll'a izin ver */
  transition: margin-left 0.25s ease-in-out; /* mobilde sidebar payı; height animasyonu yok */
  background-color: #2a324b;
  overflow-x: hidden;
  overflow-y: auto; /* içerik uzunsa body değil .main scroll etsin */
}

@media (max-width: 989px) {
  .main {
    margin-left: 70px;
  }
}

/* Modern responsive iframe layout for aircraft tracking */
.iframe-main {
  flex: 1 !important;
  min-height: 0 !important; /* Important for flexbox to respect container height */
  height: 100vh !important; /* Navbar kaldırıldı: tam viewport */
  height: 100dvh !important; /* mobil: dinamik viewport */
  background-color: #2a324b;
  transition: all 0.25s ease-in-out;
  overflow: hidden !important;
  max-width: 100% !important;
  /* Eliminate any padding/margin that could cause gaps */
  padding: 0 !important;
  margin: 0 !important;
  /* Ensure it fills the wrapper completely */
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}

@media (max-width: 989px) {
  .iframe-main {
    margin-left: 70px !important;
  }
}

.responsive-iframe-container {
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
  overflow: hidden !important;
  /* Remove fixed height calculations and let flexbox handle it */
  flex: 1 !important;
  /* Prevent iframe content from causing page scrollbars */
  contain: layout style size;
  /* Eliminate any spacing gaps */
  padding: 0 !important;
  margin: 0 !important;
  line-height: 0;
  /* Explicit minimum height for live server compatibility */
  min-height: 400px;
}

.responsive-iframe-container.loading {
  background: url("./media/loading.gif") center center no-repeat;
  background-size: 100px 100px;
  background-color: #2a324b;
}

.responsive-iframe-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block !important;
  /* Remove fixed height restrictions to allow dynamic filling */
  min-height: 100% !important;
  /* Eliminate gaps around iframe */
  margin: 0 !important;
  padding: 0 !important;
  /* Ensure iframe fills container completely */
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

/* Additional iframe compatibility rules for live server */
.iframe-main iframe,
.responsive-iframe-container iframe {
  box-sizing: border-box !important;
  object-fit: contain;
  transform: translateZ(0); /* Force GPU acceleration */
}

/* Ensure iframe container takes full available space */
main.iframe-main {
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
}

/* Media query fallbacks for older browsers */
@media screen and (min-width: 1px) {
  .responsive-iframe-container {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 500px !important;
  }

  .iframe-main {
    min-height: 100vh !important;
    min-height: 100dvh !important;
  }
}

.error-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #fff;
  text-align: center;
  padding: 50px;
  background-color: #2a324b;
}

/* Navbar */

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
  padding-left: 0.5rem; /* 2. alt kategori */
}

/* Sidebar */
.wrapper {
  display: flex;
  align-items: stretch;
  flex: 1;
  /* Remove fixed height calculations to allow dynamic sizing */
  min-height: 0;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

#sidebar {
  width: 70px;
  min-width: 70px;
  z-index: 1000;
  transition: width 0.25s ease-in-out, min-width 0.25s ease-in-out; /* sadece expand/collapse genişliği; height animasyonu yok */
  background-color: #0e2238;
  display: flex !important;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
  height: 100vh;
  height: 100dvh;
}

#sidebar.expand {
  width: 260px;
  min-width: 260px;
}

/* Header sabit kalsın (scroll'da kaybolmasın) */
#TitleSide {
  flex: 0 0 auto;
}

/* Overlay element for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; /* Navbar kaldırıldı */
  left: 70px; /* JavaScript ile dinamik ayarlanacak */
  width: calc(100% - 70px); /* JavaScript ile dinamik ayarlanacak */
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: left 0.25s ease-in-out, width 0.25s ease-in-out, opacity 0.25s ease-in-out;
  opacity: 0;
}

.sidebar-overlay.active {
  display: block;
  pointer-events: auto;
  opacity: 1;
}

/* Mobil cihazlarda sidebar expand olunca overlay olarak açılsın */
@media (max-width: 989px) {
  #sidebar {
    position: absolute !important; /* Mobilde her zaman absolute, içeriği itmesin */
    left: 0 !important;
    top: 0 !important;
    height: 100% !important;
    z-index: 2000 !important; /* Mobilde sidebar her zaman overlay'in üstünde */
  }
  
}

.toggle-btn {
  background-color: transparent;
  cursor: pointer;
  border: 0;
  padding: 1rem 1.5rem;
}

.toggle-btn i {
  font-size: 1.5rem;
  color: #fff;
}

.sidebar-logo {
  margin: auto 0;
}

.sidebar-logo a {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 600;
}

#sidebar:not(.expand) .sidebar-logo,
#sidebar:not(.expand) a.sidebar-link span {
  display: none;
}

.sidebar-nav {
  padding: 0.5rem 0;
  flex: 1 1 auto;
  min-height: 0; /* flex item scroll edebilsin */
  overflow-y: auto; /* sadece nav scroll eder; header + footer sabit kalır */
  overflow-x: hidden; /* daralmış modda yatay scrollbar çıkmasın (açıkça set → auto'ya zorlanmaz) */
  /* İnce/kibar özel scrollbar (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: #2a3744 transparent;
  /* Kenar-farkında scroll gölgesi (dokunmatikte scrollbar gizlense de scroll ipucu verir) */
  background:
    linear-gradient(#0e2238 30%, rgba(14, 34, 56, 0)) center top,
    linear-gradient(rgba(14, 34, 56, 0), #0e2238 70%) center bottom,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)) center top,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0)) center bottom;
  background-repeat: no-repeat;
  background-size: 100% 28px, 100% 28px, 100% 14px, 100% 14px;
  background-attachment: local, local, scroll, scroll;
}

/* İnce/kibar özel scrollbar (WebKit/Chromium) */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: #2a3744;
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #3b7ddd;
}

a.sidebar-link {
  padding: 0.625rem 1.625rem;
  color: #fff;
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  border-left: 3px solid transparent;
}

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

a.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.075);
  border-left: 3px solid #3b7ddd;
}

.sidebar-item {
  position: relative;
}

/* Daralmış (70px) modda flyout SADECE footer (account/info) için — nav artık scroll
   ettiği için nav flyout'ları kırpılır, o yüzden nav'da flyout kaldırıldı. */
#sidebar:not(.expand) .sidebar-footer .sidebar-item .sidebar-dropdown {
  position: absolute;
  top: 0;
  left: 70px;
  background-color: #0e2238;
  padding: 0;
  min-width: 15rem;
  display: none;
}

#sidebar:not(.expand) .sidebar-footer .sidebar-item:hover .has-dropdown + .sidebar-dropdown {
  display: block;
  max-height: auto;
  width: auto;
  opacity: 1;
}

#sidebar.expand .sidebar-link[data-bs-toggle="collapse"]::after {
  border: solid;
  border-width: 0 0.075rem 0.075rem 0;
  content: "";
  display: inline-block;
  padding: 2px;
  position: absolute;
  right: 1.5rem;
  top: 1.4rem;
  transform: rotate(-135deg);
  transition: all 0.2s ease-out;
}

#sidebar.expand .sidebar-link[data-bs-toggle="collapse"].collapsed::after {
  transform: rotate(45deg);
  transition: all 0.2s ease-out;
}



/* Sidebar alt menü elemanlarının kalınlığını ve yazı ve simge boyutunu azalt */
.sidebar-dropdown .sidebar-item .sidebar-link {
  padding: 0.3rem 1.625rem; /* Yüksekliği azaltmak için padding değerini ayarla */
  font-size: 0.8rem; /* Yazı boyutunu azalt */
}
.sidebar-dropdown .sidebar-item .sidebar-link i {
  font-size: 0.8rem; /* Simge boyutunu azalt */
}

/* Metinlerin taşmasını önleyin */
#sidebar.expand .sidebar-link {
  white-space: nowrap; /* Tek satırda tutar */
  overflow: hidden; /* Taşan metni gizler */
  text-overflow: ellipsis; /* Taşan metni üç nokta ile gösterir */
}

/* Sidebar başlıklarını ortala */
.sidebar-header {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

/* Daralmış (70px) modda nav'da scrollbar çıkınca (6px) başlıklara kalan genişlik
   azalıyor ve "Charts"/"Ibosoft" ellipsis'e düşüyordu; yatay padding'i kısarak
   kaybolan genişliği geri veriyoruz. Geniş mod etkilenmez. */
#sidebar:not(.expand) .sidebar-header {
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

/* Bölüm başlıkları: geniş modda tam metin, daralmış (70px) modda kısa metin */
.sidebar-header .hdr-short {
  display: none;
}
#sidebar:not(.expand) .sidebar-header .hdr-full {
  display: none;
}
#sidebar:not(.expand) .sidebar-header .hdr-short {
  display: inline;
}

.sidebar-divider {
  margin: 0.35rem 1rem 0.6rem 1rem;
}

/* Sidebar alt menü başlıkları */
.sidebar-subheader {
  font-size: 0.75rem;
  padding: 0.12rem 1.625rem 0.09rem 1.625rem;
  margin: 0;
  text-align: center;
  text-decoration: underline;
}


/* === Sidebar footer (account + links + copyright) === */
.sidebar-footer {
  flex: 0 0 auto; /* scroll dışında, sidebar'ın altına sabit (nav flex:1 zaten aşağı iter) */
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-nav {
  padding: 0.25rem 0;
  margin: 0;
}

/* Footer'daki dropdown'lar bottom'da oldukları için yukarı doğru açılsın (dropup) */
#sidebar.expand .sidebar-footer .sidebar-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background-color: #0e2238;
  z-index: 1001;
}

/* Daralmış (70px) modda footer flyout'u alta hizalı sağa açılsın */
#sidebar:not(.expand) .sidebar-footer .sidebar-item .sidebar-dropdown {
  top: auto;
  bottom: 0;
}

.sidebar-copyright {
  text-align: center;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  padding: 0.5rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Daralmış (70px) modda "© Ibosoft" görünür kalsın; yıl sığmadığı için gizlenir */
#sidebar:not(.expand) .sidebar-copyright {
  padding: 0.5rem 0.2rem;
}
#sidebar:not(.expand) .copyright-year {
  display: none;
}
