:root {
  --bg: #0f172a;
  --bg-soft: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #eef1f8;
  --border: #dde2ee;
  --text: #1a2033;
  --text-dim: #667085;
  --primary: #2f6feb;
  --primary-dark: #1f4fb8;
  --primary-soft: #e8f0fe;
  --danger: #d64545;
  --danger-soft: #fdeaea;
  --warn: #b8860b;
  --warn-soft: #fdf3da;
  --ok: #1a8a5f;
  --ok-soft: #e4f7ee;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 25, 45, 0.08), 0 8px 24px -12px rgba(20, 25, 45, 0.15);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.topbar {
  background: var(--bg);
  color: #fff;
  padding: 14px 16px;
}
.topbar .wrap {
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar .wrap.topbar-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}
.topbar-stack nav { justify-content: flex-start; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}
.brand svg { width: 26px; height: 26px; flex-shrink: 0; }
.topbar nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #cbd5e1; font-size: .92rem; }
.topbar nav a:hover { color: #fff; }
.topbar .pill {
  background: rgba(255,255,255,.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .8rem;
  color: #cbd5e1;
}

/* Selectors are qualified with ".topbar nav a" (not just the bare class)
   so they always outrank the generic ".topbar nav a" link-color/size rule
   above — otherwise that rule's font-size silently wins and the button
   ends up sized like a plain nav link instead of a real button. */
.topbar nav a.back-to-site-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border-radius: 10px; /* same rounding as .btn (e.g. the Sorgula button) */
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: filter .15s, transform .05s;
}
.topbar nav a.back-to-site-btn:hover { filter: brightness(1.12); text-decoration: none; }
.topbar nav a.back-to-site-btn:active { transform: translateY(1px); }
.back-to-site-btn svg { flex-shrink: 0; }
.topbar nav a.back-to-site-sm { padding: 6px 14px; font-size: .82rem; }
.back-to-site-sm svg { width: 14px; height: 14px; }
.topbar nav a.back-to-site-md { padding: 9px 18px; font-size: .95rem; }
.back-to-site-md svg { width: 17px; height: 17px; }
.topbar nav a.back-to-site-lg { padding: 13px 26px; font-size: 1.1rem; }
.back-to-site-lg svg { width: 20px; height: 20px; }
.topbar nav a.back-to-site-xl { padding: 17px 34px; font-size: 1.3rem; }
.back-to-site-xl svg { width: 24px; height: 24px; }

.admin-login-btn {
  font-size: .78rem !important;
  padding: 5px 12px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
}
.admin-login-btn:hover { background: rgba(255,255,255,.18); }

h1 { font-size: 1.5rem; margin: 4px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p.lead { color: var(--text-dim); margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: .78rem; color: var(--text-dim); margin-top: 4px; }

input[type=text], input[type=number], input[type=date], input[type=password], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea { min-height: 90px; resize: vertical; }

.plate-input { text-transform: uppercase; font-weight: 700; letter-spacing: 1px; font-size: 1.2rem; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface-alt); color: var(--text); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Operation toggle buttons ---- */
.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 10px 0 4px;
}
.op-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 10px;
  min-height: 118px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.op-btn input { position: absolute; opacity: 0; width: 0; height: 0; }
.op-btn svg { width: 34px; height: 34px; color: var(--text-dim); transition: color .15s; }
.op-btn span.op-label { font-size: .84rem; font-weight: 600; color: var(--text); line-height: 1.25; }
.op-btn .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.op-btn .check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.op-btn:hover { border-color: var(--primary); }
.op-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.op-btn.active svg:first-child { color: var(--primary-dark); }
.op-btn.active .check { background: var(--primary); border-color: var(--primary); }
.op-btn.active .check svg { opacity: 1; }

/* ---- History list ---- */
.record-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.record-item .record-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.record-item .record-date { font-weight: 700; }
.record-item .record-odo { color: var(--text-dim); font-size: .88rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .78rem;
  color: var(--text);
}
.tag svg { width: 14px; height: 14px; }
.tag-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  flex-shrink: 0;
}
.tag-check svg { width: 9px; height: 9px; }

/* ---- Large tappable maintenance-interval picker (2 options) ---- */
.interval-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.interval-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 14px;
  min-height: 64px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.interval-btn input { position: absolute; opacity: 0; width: 0; height: 0; }
.interval-btn:hover { border-color: var(--primary); }
.interval-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
@media (max-width: 480px) {
  .interval-options { grid-template-columns: 1fr; }
}
.record-notes { margin-top: 8px; font-size: .88rem; color: var(--text-dim); white-space: pre-wrap; }

/* ---- Upcoming maintenance ---- */
.upcoming-list { display: flex; flex-direction: column; gap: 10px; }
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.upcoming-item .ic {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface-alt);
}
.upcoming-item .ic svg { width: 22px; height: 22px; color: var(--text-dim); }
.upcoming-item .info { flex: 1; min-width: 0; }
.upcoming-item .info .name { font-weight: 700; font-size: .92rem; }
.upcoming-item .info .detail { font-size: .8rem; color: var(--text-dim); }
.status-badge {
  font-size: .74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-overdue { background: var(--danger-soft); color: var(--danger); }
.status-soon { background: var(--warn-soft); color: var(--warn); }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-scheduled { background: var(--primary-soft); color: var(--primary-dark); }
.status-never { background: var(--surface-alt); color: var(--text-dim); }
.upcoming-item.status-overdue .ic { background: var(--danger-soft); }
.upcoming-item.status-overdue .ic svg { color: var(--danger); }
.upcoming-item.status-soon .ic { background: var(--warn-soft); }
.upcoming-item.status-soon .ic svg { color: var(--warn); }
.upcoming-item.status-ok .ic { background: var(--ok-soft); }
.upcoming-item.status-ok .ic svg { color: var(--ok); }
.upcoming-item.status-scheduled .ic { background: var(--primary-soft); }
.upcoming-item.status-scheduled .ic svg { color: var(--primary-dark); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; color: var(--border); }

.alert { padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.success { background: var(--ok-soft); color: var(--ok); }

.plate-search { display: flex; gap: 10px; flex-wrap: wrap; }
.plate-search input { flex: 1 1 220px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.pagination .btn.disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- Admin "Veritabanı" page ---- */
.db-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.db-stat {
  flex: 1 1 160px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.db-stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.db-stat-label {
  display: block;
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.db-purge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.db-purge-item {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.db-purge-item-label {
  font-weight: 700;
  font-size: 1.05rem;
}
.db-purge-item-hint {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: -6px;
}

/* Confirm-to-delete modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 440px;
}
.modal-box h3 { margin-top: 0; }
.modal-box .field { margin-top: 14px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.color-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.color-input-group .color-picker {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 4px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.color-input-group .color-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
}

table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: .88rem; }
table.simple th { color: var(--text-dim); font-weight: 600; }
table.simple tr:last-child td { border-bottom: none; }

.section-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

@media (max-width: 640px) {
  .op-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .op-btn { min-height: 100px; padding: 14px 8px; }
  .op-btn svg { width: 28px; height: 28px; }
  h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
}

/* ---- QR code / sticker (admin/qr.php) ---- */

.qr-print-card { display: flex; flex-direction: column; align-items: center; }

.qr-sticker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 22px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: #ffffff;
  text-align: center;
}
.qr-sticker-logo { max-width: 100%; object-fit: contain; }
.qr-sticker-business { font-size: 1rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.qr-sticker-vehicle { font-size: .85rem; color: var(--text-dim); font-weight: 600; }
.qr-sticker-plate { font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; }
.qr-sticker-code { line-height: 0; margin: 4px 0; }
.qr-sticker-code svg { width: 180px; height: 180px; display: block; }
.qr-sticker-caption { font-size: .82rem; color: var(--text-dim); }
.qr-sticker-app { font-size: .72rem; color: var(--text-dim); opacity: .8; }

.qr-actions { width: 100%; max-width: 320px; margin-top: 16px; }

.qr-link-row { display: flex; gap: 8px; }
.qr-link-row input[readonly] {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  background: var(--surface-alt);
}
.qr-link-row .btn { flex: 0 0 auto; }

@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #ffffff; }
  .wrap { max-width: none; margin: 0; padding: 0; }
  .qr-print-card {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .qr-sticker {
    border-style: solid;
    /* A common small sticker size; browser print dialogs let the user
       rescale/fit-to-page if their printer/label stock differs. */
    width: 70mm;
    margin: 0 auto;
  }
  .qr-sticker-code svg { width: 45mm; height: 45mm; }
  .qr-sticker-logo { max-height: 12mm; }
}

/* ---- "Leave us a review" section on the public vehicle page ---- */
.review-card { text-align: center; }
.review-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}
.review-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  transition: border-color .15s, background .15s, transform .05s;
}
.review-btn:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.review-btn:active { transform: scale(.98); }
.review-btn-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
@media (max-width: 480px) {
  .review-btn-row { flex-direction: column; }
  .review-btn { justify-content: center; }
}
