/* ============================================================
   PRIMETOUCH CLEANING — DASHBOARD
   Sidebar, topbar, panels, and all dashboard-specific UI
   ============================================================ */

/* ── Shell ──────────────────────────────────────────────────── */
.dash-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 300;
  transition: transform var(--trans-base);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo area */
.sidebar-header {
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
}

/* User section */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--gold);
  text-transform: capitalize;
  font-weight: 500;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-lg) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--trans-fast);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--gold-muted);
  color: var(--gold);
  font-weight: 600;
}

.sidebar-link-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link-text { flex: 1; }

/* Footer / Logout */
.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--error);
  cursor: pointer;
  transition: background var(--trans-fast);
}

.sidebar-logout:hover { background: var(--error-bg); }

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 290;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ── Main content ───────────────────────────────────────────── */
.dash-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  gap: var(--space-lg);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topbar-title {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: border-color var(--trans-fast);
}

.topbar-search:focus-within { border-color: var(--gold); }

.topbar-search-icon { font-size: 0.85rem; color: var(--text-muted); }

.topbar-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 180px;
}

.topbar-search input::placeholder { color: var(--text-muted); }

/* ── Page content ───────────────────────────────────────────── */
.dash-page {
  flex: 1;
  padding: var(--space-xl);
}

.dash-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.dash-page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dash-page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── Two-column grid (for chart + activity) ─────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

/* ── Mini calendar (sidebar widget) ────────────────────────── */
.mini-calendar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.cal-month-year {
  font-weight: 600;
  font-size: 0.88rem;
}

.cal-nav {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--trans-fast);
}

.cal-nav:hover { border-color: var(--gold); color: var(--gold); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--trans-fast), color var(--trans-fast);
  color: var(--text-secondary);
}

.cal-day:hover { background: var(--bg-secondary); }
.cal-day.today { background: var(--gold); color: var(--navy); font-weight: 700; }
.cal-day.booked { color: var(--gold); font-weight: 600; }
.cal-day.other-month { opacity: 0.25; }

/* ── Role-specific panels ───────────────────────────────────── */
[data-panel] { display: block; }
[data-panel].hidden { display: none; }

/* ── Admin customers / agents tables ────────────────────────── */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.table-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: border-color var(--trans-fast);
}

.table-search:focus-within { border-color: var(--gold-border); }

.table-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 200px;
}

.table-search input::placeholder { color: var(--text-muted); }

/* ── Schedule / Calendar view ───────────────────────────────── */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.schedule-item-time {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.8rem;
  min-width: 48px;
}

.schedule-item-info { flex: 1; }

/* ── Report containers ──────────────────────────────────────── */
.report-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

.report-stat:last-child { border-bottom: none; }

.report-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.report-stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.report-stat-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.report-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 2px;
  transition: width 0.8s ease;
}

/* ── Mobile responsiveness ──────────────────────────────────── */
@media (max-width: 900px) {
  .topbar-search { display: none; }
  .dash-page { padding: var(--space-lg); }
  .topbar { padding: 0 var(--space-lg); }

  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .dash-main {
    margin-left: 0;
  }
}
