/* RSM Mobile Portal — Mobile-first CSS
   Kleuren gebaseerd op ui/styles.py van RepairShop Manager */

:root {
  --accent:  #a3bf2b;
  --blue:    #2c5f8a;
  --blue-dk: #1e4570;
  --bg:      #eef2f7;
  --card:    #ffffff;
  --ink:     #1e293b;
  --gray:    #64748b;
  --lgray:   #e2e8f0;
  --red:     #dc2626;
  --green:   #16a34a;
  --radius:  12px;
  --shadow:  0 2px 12px rgba(0,0,0,.08);
  --nav-h:   60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ── Navigatie (bottom op mobiel) ────────────────────────────────────────── */
.navbar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--lgray);
  display: flex;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.nav-brand {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-right: 1px solid var(--lgray);
}
.nav-logo { height: 28px; width: auto; }
.nav-links {
  display: flex;
  flex: 1;
  justify-content: space-around;
}
.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--gray);
  transition: color .15s;
}
.nav-link span { display: block; }
.nav-link.active { color: var(--accent); }
.nav-link svg { flex-shrink: 0; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.main-content {
  padding: 16px 16px 8px;
  max-width: 640px;
  margin: 0 auto;
}
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.page-header {
  margin-bottom: 16px;
}
.back-link {
  font-size: 13px;
  color: var(--blue);
  display: inline-block;
  margin-bottom: 6px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.page-sub { font-size: 13px; color: var(--gray); margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--lgray);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-card { padding: 16px; margin-bottom: 12px; }
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card { padding: 28px 28px 32px; }
.login-logo { margin-bottom: 12px; }
.login-sub {
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 20px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tab-row {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--gray);
  cursor: pointer;
  transition: all .15s;
}
.tab-btn.active {
  background: var(--card);
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ── Formulier ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 5px;
}
input[type=text], input[type=password], input[type=email],
input[type=number], input[type=date], .input-field, .select-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--lgray);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: #f8fafc;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, .input-field:focus, .select-input:focus {
  border-color: var(--blue);
  background: var(--card);
}
.select-input { flex: 1; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 14px;
  cursor: pointer;
}

/* ── Knoppen ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--blue); color: white; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--lgray);
  color: var(--ink);
}
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.inline-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray);
  padding: 2px 4px;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}
.badge-lg { font-size: 14px; padding: 5px 14px; }
.priority-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.priority-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid;
}

/* ── Statistieken ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--lgray);
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  display: block;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--ink); }
.stat-label { font-size: 12px; color: var(--gray); margin-top: 2px; }
.stat-dot {
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Ticketlijst ─────────────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ticket-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--lgray);
  padding: 14px 16px;
  display: block;
  transition: box-shadow .15s;
}
.ticket-card:active { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.ticket-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ticket-number { font-size: 13px; font-weight: 700; color: var(--blue); }
.ticket-device { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.ticket-customer { font-size: 13px; color: var(--gray); margin-bottom: 6px; }
.ticket-meta { font-size: 12px; color: var(--gray); display: flex; align-items: center; gap: 4px; }

/* ── Sectie koptekst ─────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.section-title { font-size: 16px; font-weight: 700; }
.link-more { font-size: 13px; color: var(--blue); }

/* ── Info-grid ───────────────────────────────────────────────────────────── */
.info-grid { display: flex; flex-direction: column; gap: 0; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--lgray);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row > span:first-child { color: var(--gray); font-size: 13px; }
.info-row > span:last-child { font-weight: 500; text-align: right; max-width: 65%; }
.info-divider { height: 1px; background: var(--lgray); margin: 8px 0; }

/* ── Status balk ─────────────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

/* ── Notities ────────────────────────────────────────────────────────────── */
.notes-block { margin-bottom: 12px; }
.note-item {
  font-size: 13px;
  color: var(--ink);
  padding: 8px 0;
  border-bottom: 1px solid var(--lgray);
  line-height: 1.5;
}
.note-item:last-child { border-bottom: none; }
.note-input-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }

/* ── Werkzaamheden ───────────────────────────────────────────────────────── */
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--lgray);
  font-size: 14px;
}
.item-row:last-child { border-bottom: none; }
.item-desc { flex: 1; padding-right: 10px; }
.item-price { font-size: 13px; color: var(--gray); white-space: nowrap; }
.item-total { font-weight: 700; text-align: right; padding: 10px 0 4px; font-size: 15px; }
.add-item-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--lgray); }

/* ── Foto's ──────────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.photo-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: var(--lgray);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.5);
  color: white;
  font-size: 10px;
  padding: 3px 5px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.photo-upload { display: flex; flex-direction: column; gap: 8px; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ── Filter balk ─────────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.filter-group { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.filter-group.scroll-x { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filter-group::-webkit-scrollbar { display: none; }
.filter-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--lgray);
  color: var(--gray);
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s;
}
.filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* ── Paginering ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}
.page-btn { color: var(--blue); font-size: 14px; font-weight: 600; }
.page-info { font-size: 13px; color: var(--gray); }

/* ── Overig ──────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 32px 16px; color: var(--gray); }
.text-muted { color: var(--gray); font-size: 13px; }
.text-block { font-size: 14px; line-height: 1.65; color: var(--ink); }
.sub-title { font-size: 13px; font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.action-row { display: flex; gap: 8px; align-items: center; }
.inline-edit { margin-top: 8px; display: flex; gap: 8px; align-items: center; }

/* ── Desktop aanpassing ──────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .navbar {
    top: 0; bottom: auto;
    height: 56px;
    border-top: none;
    border-bottom: 1px solid var(--lgray);
    padding-bottom: 0;
  }
  body { padding-bottom: 0; padding-top: 56px; }
  .nav-link { flex-direction: row; gap: 6px; font-size: 14px; padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}
