/* style-layout.css - Layout wrapper, navbar, sidebar, main-container */
/* Layout wrapper */
.layout-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Header navbar */
.navbar {
  height: 56px;
  background-color: #1a2530; /* Gunakan warna gelap yang sama */
  color: white;
  display: flex;
  align-items: center;
  padding: 0 15px;
  z-index: 1000;
  width: 100%;
  position: absolute;
  top: 0; left: 0; right: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); /* Shadow untuk navbar */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  margin-right: 15px;
}

.logo { font-size: 18px; font-weight: bold; }

/* Main container for content and sidebar - Dynamic height adjustment */
.main-container {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  display: flex;
}

/* Dynamic adjustment via JavaScript */
body.has-footer .main-container {
  bottom: 50px; /* Default footer height */
}

@media (max-width: 768px) {
  body.has-footer .main-container {
    bottom: 47px;
  }
}

@media (max-width: 480px) {
  body.has-footer .main-container {
    bottom: 44px;
  }
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 0;
  left: -250px;
  bottom: 0;
  width: 250px;
  background-color: #1a2530; /* Konsisten dengan dashboard */
  color: white;
  transition: left 0.3s ease;
  z-index: 900;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.05); /* Border halus */
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4); /* Shadow untuk sidebar */
  
  /* Hide scrollbar while allowing scrolling */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* Webkit scrollbar hiding */
.sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

.sidebar.open { left: 0; }

.sidebar-header {
  padding: 15px;
  font-size: 16px;
  background-color: #1a2530;
  text-align: center;
  border-bottom: 1px solid #465b70;
}

.sidebar-search { padding: 10px 15px; border-bottom: 1px solid #465b70; }
.search-input { position: relative; }
.search-input i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #7f8c8d;
}
.search-input input {
  width: 100%;
  padding: 8px 8px 8px 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
}
.search-input input::placeholder { color: rgba(255, 255, 255, 0.5); }
.search-input input:focus {
  outline: none;
  background-color: rgba(0, 0, 0, 0.5);
  border-color: #3498db;
}

.sidebar-menu { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
}
.sidebar-menu li { border-bottom: 1px solid #465b70; }
.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: white;
  text-decoration: none;
  transition: background-color 0.2s;
}
.sidebar-menu a:hover, .sidebar-menu a.active { background-color: #34495e; }
.sidebar-menu i { margin-right: 10px; width: 20px; text-align: center; }

.submenu-toggle { margin-left: auto; transition: transform 0.3s; }
.has-submenu.open .submenu-toggle { transform: rotate(180deg); }
/* Submenu and Category Toggles */
.submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: #1a2530;
  max-height: 0;
  overflow-y: auto;
  transition: max-height 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.submenu.open { max-height: 80vh; } /* Increased for device lists */
.submenu a { padding-left: 45px; }

/* Device Category in Submenu */
.device-category { 
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.device-category .category-header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px 10px 45px !important;
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
  font-weight: 500;
}
.device-category .category-header:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}
.device-category .category-toggle {
  font-size: 9px;
  transition: transform 0.3s ease;
}
.device-category.open .category-toggle { transform: rotate(0deg); }
.device-category:not(.open) .category-toggle { transform: rotate(-90deg); }

/* Device List in Submenu */
.device-list {
  max-height: 40vh;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  padding: 0 10px 0 50px;
}
.device-category:not(.open) .device-list {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  opacity: 0;
}

.device-list a {
  display: block;
  padding: 6px 10px !important;
  color: #bdc3c7 !important;
  text-decoration: none;
  background: transparent !important;
  margin-bottom: 2px;
  border-radius: 4px;
  font-size: 12px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
}
.device-list a:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: white !important;
}

/* Device link status colors inside submenu */
.device-link.online { border-left-color: #27ae60 !important; }
.device-link.offline { border-left-color: #e74c3c !important; }
.device-link.unknown { border-left-color: #f39c12 !important; }

.device-link i {
  margin-right: 6px;
  font-size: 10px;
}

/* Quick Map Filters (only show on dashboard) */
.quick-map-filters {
  margin: 12px 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 8px;
  border-left: 3px solid #3498db !important;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-map-filters h4 {
  color: #ecf0f1 !important;
  font-weight: 600 !important;
}

.quick-filter-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ecf0f1 !important;
  padding: 5px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: #3498db !important;
  transform: translateY(-1px);
}

.sidebar-quick-help .quick-help-btn {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ecf0f1;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.sidebar-quick-help .quick-help-btn:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: #3498db;
}

/* Main content area - Full height with proper scrolling */
.main-content {
  position: absolute;
  top: 0; 
  left: 0; 
  right: 0; 
  bottom: 0;
  transition: padding-left 0.3s ease;
  overflow: auto;
  background-color: #1a2530;
  color: #ecf0f1;
  /* Sembunyikan scrollbar visual tapi tetap bisa scroll */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.main-content::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* Push content saat sidebar terbuka (desktop) */
body.sidebar-open .main-content { padding-left: 250px; }

@media (min-width: 769px) {
  body.sidebar-open .main-content {
    left: 250px !important;
    padding-left: 0 !important;
  }
}

/* Mobile behavior */
@media (max-width: 768px) {
  body.sidebar-open .main-content { padding-left: 0; }
  .sidebar { width: 80%; max-width: 250px; }

  /* Izinkan konten utama scroll pada mobile agar tidak muncul ruang kosong */
  .main-content {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Map */
#map { width: 100%; height: 100%; position: relative; z-index: 1; }
