/* ==========================================================================
   Digital Seva Portal - Retailer & Admin Dashboard Layout
   Two-column Layout, Sidebar, Top Bar, KPI Metric Tiles, Workspace Grids
   ========================================================================== */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--canvas-bg);
}

/* Sidebar */
.dashboard-sidebar {
  width: 260px;
  background-color: var(--dark-navy);
  color: #94A3B8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-close-btn {
  display: none;
}

.sidebar-brand {
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.sidebar-brand-badge {
  background: var(--primary-blue);
  color: #fff;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 0.25rem;
}

.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.75rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
}

.sidebar-menu {
  list-style: none;
  margin-bottom: 1rem;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: #CBD5E1;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-link:hover {
  background-color: rgba(255,255,255,0.06);
  color: #FFFFFF;
}

.sidebar-link.active {
  background-color: var(--primary-blue);
  color: #FFFFFF;
  font-weight: 600;
}

.sidebar-link .icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* Sidebar Dropdown Submenu */
.sidebar-item-dropdown {
  position: relative;
}

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

.sidebar-dropdown-toggle .chevron {
  width: 15px;
  height: 15px;
  margin-left: auto;
  transition: transform 0.25s ease;
  opacity: 0.75;
}

.sidebar-item-dropdown.open .sidebar-dropdown-toggle .chevron {
  transform: rotate(180deg);
}

.sidebar-submenu {
  list-style: none;
  padding: 0.35rem 0 0.35rem 1rem;
  margin: 0;
  display: none;
}

.sidebar-item-dropdown.open .sidebar-submenu {
  display: block;
}

.sidebar-submenu-item {
  margin-bottom: 0.2rem;
}

.sidebar-submenu-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  color: #94A3B8;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.sidebar-submenu-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.sidebar-submenu-link.active {
  background-color: rgba(37, 99, 235, 0.25);
  color: #60A5FA;
  font-weight: 600;
}

.sidebar-submenu-link .sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748B;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.sidebar-submenu-link.active .sub-dot {
  background: #60A5FA;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
}

.sidebar-user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Dashboard Main View */
.dashboard-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Dashboard Topbar */
.dashboard-topbar {
  height: 70px;
  background-color: var(--card-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.sidebar-toggle-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--dark-navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}
.sidebar-toggle-btn:active {
  background: #F1F5F9;
  transform: scale(0.96);
}
.sidebar-toggle-btn svg,
.sidebar-toggle-btn i {
  width: 20px !important;
  height: 20px !important;
  stroke-width: 2.2 !important;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  min-width: 0;
}
.topbar-prefix {
  color: var(--text-main);
  white-space: nowrap;
}
.topbar-name {
  color: var(--primary-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-id-badge {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: normal;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s;
}
.topbar-icon-btn:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}
.topbar-icon-btn svg,
.topbar-icon-btn i {
  width: 18px !important;
  height: 18px !important;
}
.topbar-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #FFFFFF;
  line-height: 1;
}

.wallet-badge-pill {
  background: var(--primary-blue-light);
  border: 1px solid #BFDBFE;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--primary-blue);
  text-decoration: none;
  white-space: nowrap !important;
  flex-shrink: 0;
  transition: all 0.2s;
}
.wallet-badge-pill:hover {
  background: #DBEAFE;
}
.wallet-badge-pill svg,
.wallet-badge-pill i {
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0;
}
.wallet-pill-label {
  color: #3B82F6;
  font-weight: 600;
}
.wallet-pill-amount {
  font-weight: 800;
}

.topbar-topup-btn {
  white-space: nowrap !important;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  border-radius: 8px;
}
.topbar-topup-btn svg,
.topbar-topup-btn i {
  width: 15px !important;
  height: 15px !important;
  flex-shrink: 0;
}

.dashboard-body {
  padding: 1.75rem;
  flex: 1;
}

/* KPI Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--card-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon-blue { background: #EEF4FF; color: var(--primary-blue); }
.kpi-icon-green { background: #DCFCE7; color: var(--success); }
.kpi-icon-amber { background: #FEF3C7; color: var(--warning); }
.kpi-icon-purple { background: #F3E8FF; color: #7E22CE; }
