/* ==============================================================================
   AP BANDEN & AUTOSERVICE - WERKPLAATS DASHBOARD & CALENDAR DESIGN SYSTEM
   Dark Automotive Aesthetic with AP Orange & Metallic Accents
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  --ap-orange: #f39200;
  --ap-orange-hover: #e08300;
  --ap-orange-glow: rgba(243, 146, 0, 0.25);
  --ap-dark-bg: #0b0f17;
  --ap-card-bg: #141b27;
  --ap-card-hover: #1b2434;
  --ap-sidebar-bg: #0f1520;
  --ap-border: rgba(255, 255, 255, 0.08);
  --ap-border-active: rgba(243, 146, 0, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --color-blue: #38bdf8;
  --color-green: #22c55e;
  --color-amber: #f59e0b;
  --color-purple: #a855f7;
  --color-red: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dashboard-body {
  background-color: var(--ap-dark-bg);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ==============================================================================
   TOP HEADER BAR
   ============================================================================== */
.dash-header {
  background: rgba(15, 21, 32, 0.95);
  border-bottom: 1px solid var(--ap-border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.75rem;
}

.dash-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: 1720px;
  margin: 0 auto;
}

.dash-brand-block {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.dash-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.dash-brand-divider {
  width: 1px;
  height: 28px;
  background: var(--ap-border);
}

.dash-title-group h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.dash-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-view-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ap-border);
  gap: 4px;
}

.dash-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.dash-toggle-btn.active {
  background: var(--ap-orange);
  color: #fff;
  box-shadow: 0 2px 10px rgba(243, 146, 0, 0.4);
}

.dash-btn-primary {
  background: linear-gradient(135deg, var(--ap-orange) 0%, #d97706 100%);
  color: #fff;
  border: none;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--ap-orange-glow);
  transition: var(--transition);
}

.dash-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 146, 0, 0.45);
}

.dash-btn-outline {
  background: transparent;
  border: 1px solid var(--ap-border);
  color: var(--text-main);
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==============================================================================
   STATS & KPI BAR
   ============================================================================== */
.dash-stats-bar {
  max-width: 1720px;
  margin: 1.25rem auto 0;
  padding: 0 1.75rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.2fr;
  gap: 1.25rem;
}

.dash-kpi-card {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
}

.dash-kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--kpi-accent, var(--ap-orange));
}

.kpi-left .kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.kpi-left .kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.kpi-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kpi-accent, var(--ap-orange));
  font-size: 1.3rem;
  border: 1px solid var(--ap-border);
}

.kpi-capacity-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  margin-top: 8px;
  overflow: hidden;
}

.kpi-capacity-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, var(--ap-orange) 75%, #ef4444 100%);
  border-radius: 9999px;
  width: 75%;
}

/* ==============================================================================
   MAIN 3-COLUMN WORKSPACE GRID
   ============================================================================== */
.dash-workspace {
  max-width: 1720px;
  margin: 1.25rem auto 3rem;
  padding: 0 1.75rem;
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

/* 1. LEFT SIDEBAR (FILTERS & TECHNICIANS) */
.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-box {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-main);
}

.sidebar-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cat-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.cat-btn.active {
  background: rgba(243, 146, 0, 0.12);
  border-color: rgba(243, 146, 0, 0.3);
  color: var(--ap-orange);
  font-weight: 700;
}

.cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.technician-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-sm);
}

.tech-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.tech-info {
  flex: 1;
}

.tech-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.tech-bridge {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.tech-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tech-dot-active { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.tech-dot-busy { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }

/* 2. CENTER: MAIN BOOKING CALENDAR */
.dash-calendar-container {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  overflow: hidden;
}

.cal-header-bar {
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.cal-title-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cal-month-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.cal-nav-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ap-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.cal-nav-btn.today-btn {
  background: rgba(243, 146, 0, 0.15);
  border-color: rgba(243, 146, 0, 0.35);
  color: var(--ap-orange);
}

/* Grid Layout for Days & Time Slots */
.cal-grid-wrapper {
  overflow-x: auto;
}

.cal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.cal-table th {
  padding: 12px 10px;
  background: rgba(15, 21, 32, 0.8);
  border-bottom: 1px solid var(--ap-border);
  border-right: 1px solid var(--ap-border);
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.cal-table th.time-col-header {
  width: 70px;
  text-align: right;
  padding-right: 12px;
}

.cal-table th.today-header {
  color: var(--ap-orange);
  background: rgba(243, 146, 0, 0.08);
  border-bottom: 2px solid var(--ap-orange);
}

.day-sublabel {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.cal-table td {
  border-bottom: 1px solid var(--ap-border);
  border-right: 1px solid var(--ap-border);
  padding: 6px;
  vertical-align: top;
  height: 68px;
  position: relative;
  transition: background 0.15s ease;
}

.cal-table td.time-cell {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: right;
  padding-right: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--ap-border);
  width: 70px;
}

.cal-table td.lunch-cell {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 10px,
    rgba(0, 0, 0, 0.2) 10px,
    rgba(0, 0, 0, 0.2) 20px
  );
  text-align: center;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cal-cell-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-empty-slot {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.cal-empty-slot:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

/* Appointment Block Inside Calendar Cell */
.cal-booking-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-left: 3px solid var(--card-color, var(--ap-orange));
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cal-booking-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

.booking-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 3px;
}

.booking-plate-mini {
  background: #f5be18;
  color: #111;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  border: 1px solid #111;
}

.booking-time-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}

.booking-vehicle-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.booking-service-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3. RIGHT SIDEBAR: UPCOMING BOOKINGS */
.dash-upcoming-panel {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.upcoming-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upcoming-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upcoming-count-badge {
  background: rgba(243, 146, 0, 0.18);
  color: var(--ap-orange);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(243, 146, 0, 0.3);
}

.upcoming-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 4px;
}

.upcoming-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upcoming-card:hover {
  background: var(--ap-card-hover);
  border-color: rgba(243, 146, 0, 0.35);
  transform: translateX(3px);
}

.upcoming-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.upcoming-time-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ap-orange);
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 9999px;
}

.status-nieuw { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.status-bevestigd { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-in_behandeling { background: rgba(243, 146, 0, 0.2); color: var(--ap-orange); border: 1px solid rgba(243, 146, 0, 0.4); }
.status-voltooid { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }

/* Dutch License Plate Graphic */
.license-plate-badge {
  display: inline-flex;
  align-items: center;
  background: #f5be18;
  color: #111;
  border-radius: 4px;
  border: 1.5px solid #111;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  height: 24px;
}

.nl-flag {
  background: #003399;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 0 4px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plate-text {
  padding: 0 8px;
}

.upcoming-car-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  margin-top: 6px;
  margin-bottom: 2px;
}

.upcoming-customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.upcoming-services-summary {
  font-size: 0.76rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobility-icon-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==============================================================================
   MODAL POPUP (APPOINTMENT DETAILS & EDIT)
   ============================================================================== */
.dash-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.dash-modal-card {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  margin: 0;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.modal-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.modal-field-val {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
}

.modal-service-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.modal-service-table th {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  color: var(--text-muted);
}

.modal-service-table td {
  padding: 8px 12px;
  border-top: 1px solid var(--ap-border);
}

.modal-actions-bar {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 1300px) {
  .dash-workspace {
    grid-template-columns: 1fr;
  }
  .dash-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}
