@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Caveat:wght@700&display=swap');

:root {
  --primary: #356978;
  --accent: #3D7A8C;
  --accent-light: #E6F3F6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #1E293B;
  --muted: #64748B;
  --border: #E2E8F0;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(63,122,140,0.88) 0%, rgba(77,138,156,0.88) 100%), url('/bg-texture.png') center/cover;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .brand {
  font-family: 'Caveat', cursive;
  font-size: 40px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  line-height: 1;
}

.login-logo .brand span {
  color: var(--primary);
}

.login-logo p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
  justify-content: center;
  padding: 12px;
}

.btn-primary:hover { background: #2D6070; }

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 16px rgba(0,0,0,0.18);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand {
  font-family: 'Caveat', cursive;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  color: white;
}

.sidebar-brand .brand span { color: white; }

.sidebar-brand .role {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

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

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.65);
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-item.active { background: rgba(0,0,0,0.2); color: white; }

.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.page {
  padding: 24px;
  display: none;
}

.page.active { display: block; }

/* ── CARDS ── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

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

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── CALENDAR ── */
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calendar-controls h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.year-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.month-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.month-header {
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.month-grid {
  padding: 12px;
}

.day-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.day-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0;
  text-transform: uppercase;
}

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

.day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.day-cell:hover:not(.empty):not(.past) {
  border-color: var(--accent);
  z-index: 1;
}

.day-cell.empty { cursor: default; }
.day-cell.past { color: #CBD5E1; cursor: default; }
.day-cell.today { font-weight: 800; color: var(--accent); }

.day-cell.weekend { color: var(--muted); }

/* Availability states */
.day-cell.available {
  background: #DCFCE7;
  color: #166534;
}

.day-cell.available-psytrec { background: #3B82F6; color: #fff; font-weight: 700; text-shadow: 0 0 6px rgba(0,0,0,.25); }
.day-cell.available-tcn     { background: #A855F7; color: #fff; font-weight: 700; text-shadow: 0 0 6px rgba(0,0,0,.25); }
.day-cell.available-arq     { background: #22C55E; color: #fff; font-weight: 700; text-shadow: 0 0 6px rgba(0,0,0,.25); }
.day-cell.available-multi   { background: #F59E0B; color: #1C1917; font-weight: 700; }

/* Geboekte dagen in admin: zelfde org-kleur met schuine witte streep */
.day-cell.booked-psytrec {
  background: repeating-linear-gradient(-45deg, #3B82F6 0px, #3B82F6 7px, rgba(255,255,255,0.5) 7px, rgba(255,255,255,0.5) 9px);
  color: #fff; font-weight: 700; cursor: pointer; text-shadow: 0 0 6px rgba(0,0,0,.3);
}
.day-cell.booked-tcn {
  background: repeating-linear-gradient(-45deg, #A855F7 0px, #A855F7 7px, rgba(255,255,255,0.5) 7px, rgba(255,255,255,0.5) 9px);
  color: #fff; font-weight: 700; cursor: pointer; text-shadow: 0 0 6px rgba(0,0,0,.3);
}
.day-cell.booked-arq {
  background: repeating-linear-gradient(-45deg, #22C55E 0px, #22C55E 7px, rgba(255,255,255,0.5) 7px, rgba(255,255,255,0.5) 9px);
  color: #fff; font-weight: 700; cursor: pointer; text-shadow: 0 0 6px rgba(0,0,0,.3);
}

.day-cell.blocked {
  background: #EC4899;
  color: #fff;
  font-weight: 700;
  cursor: default;
  text-shadow: 0 0 6px rgba(0,0,0,.2);
}

/* legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 20px;
}
.legend-groep-label {
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.legend-scheider {
  width: 1px;
  height: 16px;
  background: #E2E8F0;
  display: inline-block;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

/* ── DAY MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.checkbox-item:hover { border-color: var(--accent); background: var(--accent-light); }
.checkbox-item.checked { border-color: var(--accent); background: var(--accent-light); }

.checkbox-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

.checkbox-item .org-name { font-weight: 600; font-size: 13px; }
.checkbox-item .org-color {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-left: auto;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── BOOKINGS TABLE ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-psytrec { background: #DBEAFE; color: #1E40AF; font-weight: 700; }
.badge-tcn     { background: #EDE9FE; color: #5B21B6; font-weight: 700; }
.badge-arq     { background: #FEF3C7; color: #78350F; font-weight: 700; }
.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }

/* ── INVOICE ── */
.invoice-preview {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  max-width: 700px;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--primary);
}

.invoice-from .company { font-size: 20px; font-weight: 800; color: var(--primary); }
.invoice-meta { text-align: right; }
.invoice-meta .inv-nr { font-size: 22px; font-weight: 800; color: var(--accent); }

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.party-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.invoice-table { width: 100%; margin-bottom: 24px; }
.invoice-table th { background: var(--bg); }
.invoice-table .total-row td { font-weight: 700; font-size: 15px; color: var(--primary); }

.ical-box {
  background: var(--accent-light);
  border: 1px solid #BFDBFE;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ical-icon { font-size: 28px; }
.ical-info strong { display: block; font-size: 14px; color: var(--primary); }
.ical-info span { font-size: 12px; color: var(--muted); }

/* ── NOTIFICATION ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Client portal specific */
.avail-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--muted);
}

.avail-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
