/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f6fb;
  --sidebar-bg: #ffffff;
  --primary: #6366f1;
  --text: #1f2933;
  --muted: #000000;
  --backgroundcol: #d1a5ee;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Layout wrapper */
.main-wrapper {
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 250px;
  min-height: 100vh;
  background: var(--backgroundcol);
  border-right: 1px solid #e5e7eb;
  position: fixed;
  left: 0;
  top: 0;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

/* brand logo + text vertical (desktop, tablet) */
.brand-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.brand-img {
  display: block;
  height: 40px;
  width: auto;
}

/* desktop / tablet logo */
.brand-img-desktop {
  display: block;
}

/* mobile logo (hidden by default) */
.brand-img-mobile {
  display: none;
}

.brand h2 {
  font-size: 16px;
  line-height: 1.2;
}

.brand span {
  font-size: 11px;
  color: var(--muted);
}

.close-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: none;
}

/* Sidebar menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

/* menu-link and submenu common */
.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  border: none;
  outline: none;
  background: transparent;
}

.menu-link i {
  font-size: 16px;
}

.menu-link.active,
.menu-link:hover {
  background: #eef2ff;
  color: var(--primary);
}

/* group */
.menu-group {
  border: none;
  outline: none;
}

/* Dropdown list */
.submenu {
  display: none;
  flex-direction: column;
  padding-left: 32px;
  gap: 4px;
  border: none;
  outline: none;
  background: transparent;
}

.submenu a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
  border: none;
  outline: none;
  background: transparent;
}

.menu-group.open .submenu {
  display: flex;
}

/* Topbar */
.topbar {
  height: 60px;
  padding: 0 20px;
  background: #d1a5ee;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: 250px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.hamburger {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  display: none;
}

.topbar-title {
  font-size: 14px;
  color: var(--muted);
}

.topbar-title .current {
  color: var(--text);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.company-name {
  font-weight: 500;
}

/* Avatar + popup */
.avatar-wrapper {
  position: relative;
}

/* base avatar circle */
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: visible;
}

/* multi-color layered pulse */
.avatar-circle.multi-pulse::before,
.avatar-circle.multi-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid transparent;
  opacity: 0;
}

.avatar-circle.multi-pulse::before {
  border-color: rgba(23, 59, 104, 0.8); /* blue */
  animation: ringPulse1 1.8s ease-out infinite;
}

.avatar-circle.multi-pulse::after {
  border-color: rgba(94, 15, 56, 0.8); /* pink */
  animation: ringPulse2 2s ease-out infinite;
}

@keyframes ringPulse1 {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.5);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes ringPulse2 {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  60% {
    transform: scale(1.3);
    opacity: 0;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.avatar-circle.small {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.profile-popup {
  position: absolute;
  right: 0;
  top: 40px;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
  padding: 12px;
  display: none;
  animation: fadeIn 0.18s ease-out;
}

.profile-popup.open {
  display: block;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.profile-info {
  font-size: 12px;
}

.profile-name {
  font-weight: 600;
  color: #111827;
}

.profile-email {
  color: #6b7280;
}

.profile-menu {
  list-style: none;
  margin-top: 8px;
}

.profile-menu li a {
  display: block;
  padding: 6px 4px;
  font-size: 13px;
  color: #374151;
  text-decoration: none;
  border-radius: 6px;
  border: none;
  background: transparent;
}

.profile-menu li a:hover {
  background: #f3f4ff;
  color: #4f46e5;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Content area */
.content {
  margin-left: 250px;
  padding: 20px;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.card {
  background: #ffffff;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.card.purple .card-icon { background: #6366f1; }
.card.yellow .card-icon { background: #facc15; }
.card.blue   .card-icon { background: #0ea5e9; }
.card.green  .card-icon { background: #22c55e; }

.card-label {
  font-size: 13px;
  color: var(--muted);
}

.card-body h2 {
  font-size: 24px;
  margin-top: 4px;
}

/* Chart section */
.chart-section {
  background: #ffffff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
  margin-bottom: 80px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 16px;
}

.chart-header select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-size: 13px;
}

/* simple custom chart */
.chart {
  width: 100%;
  height: 260px;
  position: relative;
  border-left: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  overflow: hidden;
}

.chart-line {
  position: absolute;
  left: 0;
  top: 0;
  height: 2px;
  background: #22c55e;
  transform-origin: left center;
}

.chart-point {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  transform: translate(-50%, -50%);
}

/* Bottom banner (optional) */
.banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 20px;
  background: #b91c1c;
  color: #fff;
  text-align: center;
  font-size: 14px;
}

/* ============================= */
/*   Responsive Media Queries    */
/* ============================= */

/* Tablet */
@media (max-width: 992px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    transition: left 0.25s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .close-btn {
    display: inline-flex;
  }

  .topbar {
    margin-left: 0;
  }

  .content {
    margin-left: 0;
    padding: 16px;
  }

  .hamburger {
    display: inline-flex;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .banner {
    font-size: 12px;
    padding: 8px 10px;
  }

  .profile-popup {
    right: -20px;
  }

  /* logo switch: mobile shows favicon, hides big logo */
  .brand-img-desktop {
    display: none;
  }

  .brand-img-mobile {
    display: block;
    height: 32px;
  }

  .brand-stack {
    flex-direction: column;
    align-items: flex-start;
  }

  /* avatar + company both visible on normal mobile width */
  .topbar-right {
    display: flex;
  }
}

/* Very small mobile */
@media (max-width: 480px) {
  /* only hide company name, keep avatar for profile access */
  .company-name {
    display: none;
  }

  .chart-section {
    padding: 14px;
  }
}
