body {
  font-family: Arial;
  margin: 0;
  background: #f4f4f4;
}
* {
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.container {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 220px;
  background: #1e3446;
  color: white;
  padding: 20px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  width: 100%;
  margin-top: 20px;
}

.sidebar li {
  cursor: pointer;
  width: 100%;
  padding: 15px;
}

.sidebar li.active {
  background: #d42b82;
  border-radius: 8px;
}
.menu-toggle {
  display: none;
  font-size: 24px;
  cursor: pointer;
  color: #1e3446;
}

.logout {
  background: transparent;
  color: #ccc;
  border: 1px solid #444;
  padding: 8px;
  border-radius: 8px;
  margin-top: 150px;
}

.logout:hover {
  color: white;
  border-color: #d42b82;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 900;
}

.overlay.active {
  display: block;
}

/* MAIN */

.main {
  flex: 1;
  padding: 30px;
  background: white;
}
.left-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 20px;
  align-items: center;
  gap: 10px;
}

.topbar input {
  padding: 10px;
  width: 300px;
  border-radius: 12px;
  border: 1px solid #ccc;
}

.categories button {
  margin: 5px;
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid #ccc;
  background: white;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.card {
  border: 1px solid #eee;
  padding: 20px;
  border-radius: 10px;
}

.card button {
  background: #d42b82;
  border-radius: 4px;
  color: white;
  border: none;
  padding: 8px 15px;
  margin-top: 10px;
}

/* GROUPS */

.groups {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.group {
  border: 1px solid #eee;
  padding: 20px;
  border-radius: 10px;
}

/* RIGHT PANEL */

.right {
  width: 280px;
  padding: 20px;
  background: #fafafa;
}

.help {
  border: 1px solid pink;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 10px;
}
.help-btn {
  background: #d42b82;
  border-radius: 4px;
  color: white;
  border: none;
  padding: 8px 15px;
  margin-top: 10px;
}

.recommend {
  background: #ffedf6;
  padding: 20px;
  border-radius: 10px;
}
.recommend-btn {
  background: #fff;
  border-radius: 4px;
  color: #d42b82;
  border: 1px solid #d42b82;
  padding: 8px 15px;
  margin-top: 10px;
}
.active-category {
  background: #d42b82;
  color: white;
  border: none;
}

/* =========================
   RESPONSIVE DESIGN
========================= */

/* TABLETS */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar ul {
    display: flex;
    gap: 15px;
  }

  .logout {
    margin-top: 0;
  }

  .main {
    padding: 20px;
  }
  .left-topbar {
    width: 100%;
  }

  .topbar input {
    flex: 1; /* 🔥 makes input fill remaining space */
  }

  .right {
    width: 100%;
    display: flex;
    gap: 20px;
  }

  .help,
  .recommend {
    flex: 1;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* MOBILE */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .menu-toggle {
    display: block;
  }

  /* Sidebar becomes top nav */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100%;
    width: 240px;
    background: #1e3446;

    display: flex;
    flex-direction: column; /* 🔥 IMPORTANT */
    justify-content: flex-start;
    align-items: flex-start;

    padding: 20px;
    z-index: 1000;
    transition: 0.3s;
  }
  .sidebar.active {
    left: 0;
  }

  .sidebar ul {
    flex-direction: column;
    width: 100%;
  }

  .sidebar li {
    width: 100%;
  }

  .logout {
    width: 100%;
    margin-top: 20px;
  }

  /* Topbar */
  .topbar {
    flex-direction: column;
    gap: 10px;
  }

  .topbar input {
    width: 100%;
  }

  /* Categories scrollable */
  .categories {
    display: flex;
    overflow-x: auto;
  }

  .categories button {
    flex-shrink: 0;
  }

  /* Cards */
  .cards {
    grid-template-columns: 1fr;
  }

  /* Right panel stacks */
  .right {
    flex-direction: column;
    width: 100%;
  }

  /* Groups */
  .groups {
    flex-direction: column;
  }
}

/* SMALL PHONES */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .main {
    padding: 15px;
  }

  .card,
  .group {
    padding: 15px;
  }

  .help,
  .recommend {
    padding: 15px;
  }

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