
/* ======================================
   LAYOUT ALIGNMENT FIX — MAIN CONTENT BESIDE SIDEBAR
   ====================================== */

.layout {
  display: flex;
  flex-direction: row;
  width: 100%;
  min-height: 100vh;
  background: #f4f5fa;
}

/* Sidebar stays fixed */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: linear-gradient(180deg, #1e1f3a 0%, #2a2962 100%);
  color: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.3s ease;
}

/* Main content sits beside fixed sidebar */
.main-content {
  margin-left: 240px; /* aligns beside sidebar */
  flex: 1;
  background: #f4f5fa;
  padding: 40px;
  min-height: 100vh;
  overflow-y: auto;
  transition: margin-left 0.3s ease;
  box-sizing: border-box;
}

/* When sidebar collapses */
.sidebar.collapsed ~ .main-content,
.main-content.collapsed {
  margin-left: 70px;
}

/* Optional: smooth fade in for content */
.main-content > * {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ======================================
   SIDEBAR (Final structure)
   ====================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: linear-gradient(180deg, #1e1f3a 0%, #2a2962 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 100;
  transition: width 0.3s ease;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25);
}

.sidebar-top {
  text-align: center;
  padding-top: 20px;
}

.sidebar-logo {
  width: 130px;
  height: auto;
  margin-bottom: 10px;
  transition: width 0.3s ease, opacity 0.3s ease;
}

.toggle-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  margin-bottom: 15px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: #fff;
  padding: 12px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255, 255, 255, 0.15);
}

.logout-btn {
  background: #dc2626;
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 10px 15px;
  margin: 20px auto;
  width: 80%;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.3s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background: #b91c1c;
  transform: scale(1.03);
}

/* Collapsed state */
.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .sidebar-logo {
  width: 40px;
  opacity: 0.8;
}

.sidebar.collapsed .label {
  display: none;
}

.main-content {
  margin-left: 240px;
  transition: margin-left 0.3s ease;
  background: #f4f5fa;
}

.main-content.collapsed {
  margin-left: 70px;
}

@media (max-width: 900px) {
  .main-content {
    margin-left: 70px;
    padding: 20px;
  }
}
