/**
 * dashboard.css – Styles for the service technician dashboard
 * Shares the same CSS variables / theme system as style.css
 */

/* ─── Dashboard body override ─────────────────────────────────────────────── */

.dashboard-body {
  display: block;
  background: #111111;
  min-height: 100vh;
  padding: 0;
  color: #e0e0e0;
  align-items: unset;
  justify-content: unset;
}

[data-theme="light"] .dashboard-body {
  background: #f0f0f0;
  color: #1a1a1a;
}

/* ─── Top Nav ──────────────────────────────────────────────────────────────── */

.dash-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(17, 17, 17, 0.92);
  border-bottom: 1px solid rgba(192, 192, 192, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="light"] .dash-nav {
  background: rgba(240, 240, 240, 0.92);
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.dash-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #C0C0C0;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.dash-nav__back:hover {
  background: rgba(192, 192, 192, 0.12);
  color: #ffffff;
}

[data-theme="light"] .dash-nav__back { color: #555; }
[data-theme="light"] .dash-nav__back:hover { background: rgba(0, 0, 0, 0.08); color: #1a1a1a; }

.dash-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #C0C0C0;
  letter-spacing: 0.3px;
}

[data-theme="light"] .dash-nav__brand { color: #444; }

/* ─── Main layout ──────────────────────────────────────────────────────────── */

.dash-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ─── Greeting ─────────────────────────────────────────────────────────────── */

.dash-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.dash-greeting__title {
  font-size: 1.7rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

[data-theme="light"] .dash-greeting__title { color: #1a1a1a; }

.dash-greeting__sub {
  font-size: 0.88rem;
  color: #888;
}

.dash-greeting__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(76, 216, 122, 0.12);
  color: #4cd87a;
  border: 1px solid rgba(76, 216, 122, 0.25);
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ─── Stat Cards ───────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: #1e1e1e;
  border: 1px solid rgba(192, 192, 192, 0.08);
  border-radius: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  border-color: rgba(192, 192, 192, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .stat-card:hover {
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon--blue   { background: rgba(108, 158, 255, 0.15); color: #6c9eff; }
.stat-card__icon--green  { background: rgba(76, 216, 122, 0.15);  color: #4cd87a; }
.stat-card__icon--gold   { background: rgba(255, 196, 60, 0.15);  color: #ffc43c; }
.stat-card__icon--silver { background: rgba(192, 192, 192, 0.12); color: #C0C0C0; }

.stat-card__body {
  min-width: 0;
}

.stat-card__label {
  font-size: 0.78rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

[data-theme="light"] .stat-card__label { color: #777; }

.stat-card__value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.5px;
}

[data-theme="light"] .stat-card__value { color: #1a1a1a; }

/* ─── Section shell ────────────────────────────────────────────────────────── */

.dash-section {
  margin-bottom: 24px;
}

.dash-section--card {
  background: #1e1e1e;
  border: 1px solid rgba(192, 192, 192, 0.08);
  border-radius: 16px;
  padding: 22px 24px;
}

[data-theme="light"] .dash-section--card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dash-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

[data-theme="light"] .dash-section__title { color: #1a1a1a; }

.dash-section__sub {
  font-size: 0.78rem;
  color: #777;
  margin-bottom: 18px;
}

/* ─── Quick Actions ────────────────────────────────────────────────────────── */

.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.qaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: rgba(192, 192, 192, 0.10);
  color: #C0C0C0;
  border: 1px solid rgba(192, 192, 192, 0.18);
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.qaction-btn:hover {
  background: rgba(192, 192, 192, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.qaction-btn:active { transform: scale(0.97); }

.qaction-btn:focus-visible {
  outline: 2px solid #C0C0C0;
  outline-offset: 2px;
}

[data-theme="light"] .qaction-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #444;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .qaction-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #1a1a1a;
}

/* ─── Two-column layout ────────────────────────────────────────────────────── */

.dash-columns {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.dash-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 860px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

/* ─── Appointment List ─────────────────────────────────────────────────────── */

.appt-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.appt-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(192, 192, 192, 0.04);
  border: 1px solid rgba(192, 192, 192, 0.07);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.appt-item:hover {
  background: rgba(192, 192, 192, 0.09);
}

[data-theme="light"] .appt-item {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .appt-item:hover {
  background: rgba(0, 0, 0, 0.07);
}

.appt-item--done {
  opacity: 0.6;
}

.appt-item--progress {
  border-color: rgba(108, 158, 255, 0.3);
  background: rgba(108, 158, 255, 0.05);
}

[data-theme="light"] .appt-item--progress {
  border-color: rgba(108, 158, 255, 0.4);
  background: rgba(108, 158, 255, 0.06);
}

.appt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  flex-shrink: 0;
}

.appt-time__hour {
  font-size: 1rem;
  font-weight: 700;
  color: #C0C0C0;
  line-height: 1;
}

[data-theme="light"] .appt-time__hour { color: #555; }

.appt-time__meridiem {
  font-size: 0.65rem;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.appt-details {
  flex: 1;
  min-width: 0;
}

.appt-details__car {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

[data-theme="light"] .appt-details__car { color: #222; }

.appt-details__plate {
  font-size: 0.72rem;
  font-weight: 500;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.appt-details__service {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.appt-badge--done {
  background: rgba(192, 192, 192, 0.1);
  color: #999;
  border: 1px solid rgba(192, 192, 192, 0.15);
}

.appt-badge--progress {
  background: rgba(108, 158, 255, 0.15);
  color: #6c9eff;
  border: 1px solid rgba(108, 158, 255, 0.25);
}

.appt-badge--upcoming {
  background: rgba(255, 196, 60, 0.12);
  color: #ffc43c;
  border: 1px solid rgba(255, 196, 60, 0.2);
}

/* ─── Service Breakdown Bars ───────────────────────────────────────────────── */

.breakdown-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.breakdown-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.breakdown-item__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.83rem;
  color: #ccc;
}

[data-theme="light"] .breakdown-item__label { color: #444; }

.breakdown-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-color, #C0C0C0);
  flex-shrink: 0;
}

.breakdown-item__pct {
  font-size: 0.83rem;
  font-weight: 700;
  color: #ffffff;
}

[data-theme="light"] .breakdown-item__pct { color: #1a1a1a; }

.breakdown-bar {
  height: 8px;
  background: rgba(192, 192, 192, 0.1);
  border-radius: 50px;
  overflow: hidden;
}

[data-theme="light"] .breakdown-bar { background: rgba(0, 0, 0, 0.08); }

.breakdown-bar__fill {
  height: 100%;
  width: var(--fill-pct, 0%);
  background: var(--fill-color, #C0C0C0);
  border-radius: 50px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Weekly Sparkline ─────────────────────────────────────────────────────── */

.spark-wrap {
  margin-bottom: 8px;
}

.spark-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 70px;
}

.spark-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #6c9eff 0%, #4a7de0 100%);
  transition: height 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
  min-height: 4px;
  cursor: default;
  position: relative;
}

.spark-bar:last-child {
  background: linear-gradient(180deg, #C0C0C0 0%, #A0A0A0 100%);
}

.spark-bar:hover {
  opacity: 0.8;
}

.spark-bar[aria-label]:hover::after {
  content: attr(aria-label);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
}

[data-theme="light"] .spark-bar[aria-label]:hover::after {
  background: rgba(50, 50, 50, 0.9);
}

.spark-labels {
  display: flex;
  gap: 6px;
}

.spark-labels span {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */

.dash-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(192, 192, 192, 0.08);
  text-align: center;
  font-size: 0.78rem;
  color: #666;
}

[data-theme="light"] .dash-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}

/* ─── Responsive tweaks ────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .dash-main { padding: 20px 16px 40px; }
  .dash-nav { padding: 12px 16px; }
  .dash-nav__brand span { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-greeting__title { font-size: 1.35rem; }
  .qaction-btn { font-size: 0.82rem; padding: 9px 14px; }
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ─── PWA safe areas ───────────────────────────────────────────────────────── */

@media (display-mode: standalone) {
  .dash-nav {
    padding-top: calc(14px + env(safe-area-inset-top));
  }
  .dash-main {
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }
}
