/* ==========================================================================
   Basis-Styles. Farben/Glas-Effekte kommen aus den theme-*.css Dateien
   über CSS-Variablen (--rp-*).
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--rp-bg);
  color: var(--rp-text);
  min-height: 100vh;
}

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

/* ---------- Layout Shell ---------- */
.rp-shell {
  display: flex;
  min-height: 100vh;
}

.rp-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--rp-sidebar-bg);
  backdrop-filter: var(--rp-blur, none);
  -webkit-backdrop-filter: var(--rp-blur, none);
  border-right: 1px solid var(--rp-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rp-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid var(--rp-border);
  margin-bottom: 16px;
}
.rp-brand-logo {
  font-size: 26px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--rp-card-bg);
  border-radius: 12px;
  border: 1px solid var(--rp-border);
}
.rp-brand-logo-lg { font-size: 42px; width: 72px; height: 72px; margin: 0 auto 10px auto; border-radius: 20px; }
.rp-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.rp-brand-text strong { font-size: 14px; color: var(--rp-text); }
.rp-brand-text span { font-size: 11px; color: var(--rp-muted); }

.rp-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.rp-nav a {
  color: var(--rp-text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.rp-nav a:hover { background: var(--rp-hover-bg); }
.rp-nav a.active { background: var(--rp-accent); color: var(--rp-accent-contrast); font-weight: 600; }

.rp-sidebar-footer { padding: 16px 20px 0 20px; border-top: 1px solid var(--rp-border); margin-top: 12px; }
.rp-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rp-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--rp-accent); color: var(--rp-accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.rp-user div strong { display: block; font-size: 13px; }
.rp-user div span { font-size: 11px; color: var(--rp-muted); }
.rp-logout { font-size: 12px; color: var(--rp-muted); }

.rp-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rp-topbar {
  padding: 20px 28px;
  border-bottom: 1px solid var(--rp-border);
  background: var(--rp-topbar-bg);
  backdrop-filter: var(--rp-blur, none);
  -webkit-backdrop-filter: var(--rp-blur, none);
  position: sticky; top: 0; z-index: 5;
}
.rp-topbar h1 { margin: 0; font-size: 20px; }
.rp-content { padding: 24px 28px; flex: 1; }

.rp-copyright {
  text-align: center; font-size: 11px; color: var(--rp-muted);
  padding: 16px; margin-top: auto;
}
.rp-copyright-standalone { padding: 24px; }

/* ---------- Cards / Grid ---------- */
.rp-card {
  background: var(--rp-card-bg);
  border: 1px solid var(--rp-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  backdrop-filter: var(--rp-blur, none);
  -webkit-backdrop-filter: var(--rp-blur, none);
  box-shadow: var(--rp-shadow, none);
}
.rp-card h2 { margin-top: 0; font-size: 16px; }
.rp-card h3 { font-size: 14px; color: var(--rp-text); }

.rp-grid { display: grid; gap: 20px; }
.rp-grid-2 { grid-template-columns: 1fr 1fr; }
.rp-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .rp-grid-2, .rp-grid-4 { grid-template-columns: 1fr; }
  .rp-sidebar { width: 200px; }
}

.rp-stat { text-align: center; }
.rp-stat-value { font-size: 32px; font-weight: 800; color: var(--rp-accent); }
.rp-stat-label { font-size: 13px; color: var(--rp-muted); margin-top: 4px; }

.rp-detail-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; }
.rp-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.rp-form label { display: block; font-size: 13px; margin: 12px 0 4px 0; color: var(--rp-text); font-weight: 600; }
.rp-form label:first-child { margin-top: 0; }
.rp-form input[type=text], .rp-form input[type=email], .rp-form input[type=password],
.rp-form input[type=tel], .rp-form select, .rp-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rp-border);
  background: var(--rp-input-bg);
  color: var(--rp-text);
  font-size: 14px;
  font-family: inherit;
}
/* Native Dropdown-Listen (option) werden vom Browser oft undurchsichtig
   gerendert - unser durchsichtiger Glas-Hintergrund funktioniert dort nicht
   und macht Text je nach OS-Farbschema unlesbar. Deshalb hier eine
   garantiert deckende Theme-Farbe statt der transparenten Glas-Variable. */
select { color-scheme: light dark; }
select option {
  background-color: var(--rp-solid-bg, #ffffff);
  color: var(--rp-solid-text, #222222);
}
.rp-form textarea { resize: vertical; }
.rp-form-row { display: flex; gap: 14px; }
.rp-form-row > div { flex: 1; }
.rp-checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; margin: 14px 0; }
.rp-checkbox input { width: auto; }

.rp-toggle-group { display: flex; gap: 8px; margin: 4px 0 14px 0; }
.rp-toggle-group input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; }
.rp-toggle-group label {
  padding: 10px 22px;
  border: 1px solid var(--rp-border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--rp-input-bg);
  color: var(--rp-text);
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rp-toggle-group input[type=radio]:checked + label {
  background: var(--rp-accent);
  color: var(--rp-accent-contrast);
  border-color: var(--rp-accent);
}
.rp-toggle-group input[type=radio]:focus-visible + label { outline: 2px solid var(--rp-accent); outline-offset: 2px; }

.rp-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rp-inline-form input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--rp-border); background: var(--rp-input-bg); color: var(--rp-text); }

.rp-search-form { display: flex; gap: 8px; flex: 1; }
.rp-search-form input, .rp-search-form select {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rp-border);
  background: var(--rp-input-bg); color: var(--rp-text); font-size: 14px;
}
.rp-search-form input { flex: 1; }
.rp-actions-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.rp-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.rp-btn:hover { opacity: 0.9; text-decoration: none; }
.rp-btn:active { transform: scale(0.98); }
.rp-btn-primary { background: var(--rp-accent); color: var(--rp-accent-contrast); }
.rp-btn-secondary { background: var(--rp-card-bg); color: var(--rp-text); border: 1px solid var(--rp-border); }
.rp-btn-success { background: #3c9d5c; color: #fff; }
.rp-btn-warning { background: #d9822b; color: #fff; }
.rp-btn-small { padding: 5px 10px; font-size: 12px; }
.rp-btn-lg { padding: 16px 24px; font-size: 17px; width: 100%; margin-bottom: 6px; }

/* ---------- Tables ---------- */
.rp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rp-table th { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--rp-border); color: var(--rp-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.rp-table td { padding: 10px 8px; border-bottom: 1px solid var(--rp-border); }
.rp-table tr:last-child td { border-bottom: none; }

.rp-muted { color: var(--rp-muted); }
.rp-muted-small { color: var(--rp-muted); font-size: 11px; font-weight: 400; }

/* ---------- Badges ---------- */
.rp-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.rp-badge-in { background: rgba(60,157,92,0.15); color: #3c9d5c; }
.rp-badge-out { background: rgba(200,80,80,0.15); color: #c85050; }

.rp-profil-gut { color: #3c9d5c; font-weight: 700; }
.rp-profil-warnung { color: #d9822b; font-weight: 700; }
.rp-profil-kritisch { color: #c8402b; font-weight: 700; }
.rp-profil-unknown { color: var(--rp-muted); }

/* ---------- Flash messages ---------- */
.rp-flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.rp-flash-success { background: rgba(60,157,92,0.15); color: #2c7a45; border: 1px solid rgba(60,157,92,0.3); }
.rp-flash-error { background: rgba(200,80,80,0.15); color: #a3372b; border: 1px solid rgba(200,80,80,0.3); }

/* ---------- Tire grid ---------- */
.rp-tire-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.rp-tire-grid-scan { grid-template-columns: 1fr 1fr; }
.rp-tire-box { background: var(--rp-input-bg); border: 1px solid var(--rp-border); border-radius: 12px; padding: 12px; transition: box-shadow 0.3s ease, border-color 0.3s ease; }
.rp-tire-box.rp-tire-highlight { border-color: var(--rp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rp-accent) 25%, transparent); }
.rp-tire-box h4 { margin: 0 0 8px 0; font-size: 15px; font-weight: 900; }
.rp-input-lg { font-size: 20px !important; padding: 14px !important; text-align: center; font-weight: 700; }
@media (max-width: 600px) { .rp-tire-grid { grid-template-columns: 1fr; } }

.rp-activity-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.rp-activity-list li { padding: 8px 0; border-bottom: 1px solid var(--rp-border); }
.rp-activity-list li:last-child { border-bottom: none; }

/* ---------- Login / Installer ---------- */
.rp-login-wrap, .rp-install-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.rp-login-card, .rp-install-card {
  background: var(--rp-card-bg);
  border: 1px solid var(--rp-border);
  border-radius: 20px;
  padding: 36px;
  max-width: 420px; width: 100%;
  text-align: center;
  backdrop-filter: var(--rp-blur, none);
  -webkit-backdrop-filter: var(--rp-blur, none);
  box-shadow: var(--rp-shadow, none);
}
.rp-install-card { max-width: 480px; text-align: left; }
.rp-login-card h1 { font-size: 20px; margin: 4px 0 0 0; }
.rp-login-sub { color: var(--rp-muted); font-size: 13px; margin-bottom: 20px; }
.rp-login-card form, .rp-install-card form { text-align: left; }

.rp-captcha-row { display: flex; gap: 10px; align-items: center; }
.rp-captcha-img { border-radius: 8px; border: 1px solid var(--rp-border); }

.rp-install-header { text-align: center; margin-bottom: 20px; }
.rp-install-header h1 { font-size: 18px; }
.rp-steps { display: flex; justify-content: space-between; margin-bottom: 20px; font-size: 12px; color: var(--rp-muted); }
.rp-steps .done { color: var(--rp-accent); font-weight: 700; }
.rp-install-done { text-align: center; padding: 20px 0; }

.rp-scan-card { max-width: 480px; margin: 0 auto; }

/* ---------- Print ---------- */
@media print {
  .rp-sidebar, .rp-topbar, .print-bar { display: none !important; }
}

/* ==========================================================================
   Auto-Draufsicht-Diagramm: zeigt die 4 Reifenpositionen (VL/VR/HL/HR)
   an den korrekten Ecken eines stilisierten Fahrzeugs, mit Reifen-Optik
   und Profiltiefe-Ampel als farbigem Ring.
   ========================================================================== */
.rp-car-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 28px 0;
}
.rp-car-diagram {
  position: relative;
  width: 240px;
  height: 360px;
  flex-shrink: 0;
}
.rp-car-body {
  position: absolute;
  top: 46px; bottom: 46px; left: 44px; right: 44px;
  background: linear-gradient(180deg, var(--rp-input-bg), var(--rp-card-bg));
  border: 2px solid var(--rp-border);
  border-radius: 46px 46px 34px 34px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.06);
}
.rp-car-body::before {
  /* Windschutzscheibe */
  content: "";
  position: absolute;
  top: 22px; left: 16px; right: 16px;
  height: 46px;
  background: rgba(120,150,190,0.18);
  border: 1px solid var(--rp-border);
  border-radius: 18px 18px 10px 10px;
}
.rp-car-body::after {
  /* Heckscheibe */
  content: "";
  position: absolute;
  bottom: 18px; left: 22px; right: 22px;
  height: 30px;
  background: rgba(120,150,190,0.12);
  border: 1px solid var(--rp-border);
  border-radius: 10px 10px 14px 14px;
}
.rp-car-front-label {
  position: absolute;
  top: 6px; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--rp-muted);
  text-transform: uppercase;
}

.rp-wheel-pos {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 84px;
  text-decoration: none;
  color: inherit;
}
.rp-wheel-pos.pos-vl { top: 4px; left: -8px; }
.rp-wheel-pos.pos-vr { top: 4px; right: -8px; }
.rp-wheel-pos.pos-hl { bottom: 4px; left: -8px; }
.rp-wheel-pos.pos-hr { bottom: 4px; right: -8px; }

.rp-wheel {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--rp-card-bg) 0 22%, transparent 23%),
    repeating-conic-gradient(#2a2c31 0deg 10deg, #17181b 10deg 20deg);
  border: 5px solid var(--rp-wheel-ring, #8a8f98);
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
a.rp-wheel-pos:hover .rp-wheel { transform: scale(1.06); }

.rp-wheel-pos.gut { --rp-wheel-ring: #3c9d5c; }
.rp-wheel-pos.warnung { --rp-wheel-ring: #d9822b; }
.rp-wheel-pos.kritisch { --rp-wheel-ring: #c8402b; }
.rp-wheel-pos.unbekannt { --rp-wheel-ring: #8a8f98; }

.rp-wheel-label {
  font-weight: 900;
  font-size: 13px;
  background: var(--rp-card-bg);
  border: 1px solid var(--rp-border);
  border-radius: 6px;
  padding: 1px 8px;
}
.rp-wheel-mm {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.rp-wheel-meta {
  font-size: 10px;
  color: var(--rp-muted);
  text-align: center;
  line-height: 1.3;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rp-car-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11px;
  color: var(--rp-muted);
  margin-top: -14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.rp-car-legend span { display: inline-flex; align-items: center; gap: 5px; }
.rp-car-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rp-car-legend .dot-gut { background: #3c9d5c; }
.rp-car-legend .dot-warnung { background: #d9822b; }
.rp-car-legend .dot-kritisch { background: #c8402b; }
.rp-car-legend .dot-unbekannt { background: #8a8f98; }

.rp-mini-wheels {
  display: inline-grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  gap: 3px;
  vertical-align: middle;
}
.rp-mini-wheels i {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15) inset;
}
.rp-mini-wheels .dot-gut { background: #3c9d5c; }
.rp-mini-wheels .dot-warnung { background: #d9822b; }
.rp-mini-wheels .dot-kritisch { background: #c8402b; }
.rp-mini-wheels .dot-unbekannt { background: #8a8f98; }

.rp-vehicle-cards { display: flex; flex-direction: column; gap: 12px; }
.rp-vehicle-card {
  border: 1px solid var(--rp-border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--rp-input-bg);
}
.rp-vehicle-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.rp-vehicle-card-head .kennzeichen { font-weight: 900; font-size: 15px; }
.rp-tireset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--rp-border);
  font-size: 13px;
  flex-wrap: wrap;
}
.rp-tireset-row:first-of-type { border-top: none; }

@media (max-width: 420px) {
  .rp-car-diagram { width: 210px; height: 320px; }
  .rp-wheel { width: 58px; height: 58px; }
}
