/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* HSL Tailored Colors (Dark Theme - Default) */
  --bg-base: hsl(220, 25%, 7%);
  --bg-card: hsla(220, 24%, 12%, 0.65);
  --bg-card-hover: hsla(220, 24%, 16%, 0.8);
  --border-glow: hsla(220, 80%, 60%, 0.15);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-focus: hsl(220, 80%, 65%);

  --text-primary: hsl(210, 20%, 96%);
  --text-secondary: hsl(215, 12%, 70%);
  --text-muted: hsl(215, 10%, 50%);

  /* Accents */
  --accent-blue: hsl(210, 100%, 60%);
  --accent-purple: hsl(270, 95%, 65%);
  --accent-green: hsl(145, 80%, 50%);
  --accent-orange: hsl(25, 95%, 55%);
  --accent-red: hsl(355, 85%, 60%);

  --gradient-primary: linear-gradient(135deg, hsl(210, 100%, 60%), hsl(270, 95%, 65%));
  --gradient-green: linear-gradient(135deg, hsl(145, 80%, 45%), hsl(160, 90%, 60%));
  --gradient-card: linear-gradient(180deg, hsla(220, 24%, 14%, 0.8), hsla(220, 25%, 8%, 0.8));

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px hsla(220, 85%, 60%, 0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 30px;

  /* Theme Dependent Component Backings */
  --bg-input: hsl(220, 20%, 9%);
  --bg-header: hsla(220, 25%, 7%, 0.7);
  --bg-item: rgba(0, 0, 0, 0.15);
  --bg-img-placeholder: hsl(220, 20%, 10%);
  --color-placeholder: hsl(220, 10%, 20%);
  --glow-color-1: hsla(220, 90%, 55%, 0.12);
  --glow-color-2: hsla(270, 90%, 55%, 0.08);
}

/* Light Theme Variables */
:root.light-theme {
  --bg-base: hsl(220, 25%, 96%);
  --bg-card: hsla(220, 24%, 100%, 0.75);
  --bg-card-hover: hsla(220, 24%, 95%, 0.9);
  --border-glow: hsla(220, 80%, 60%, 0.1);
  --border-light: rgba(0, 0, 0, 0.08);
  --border-focus: hsl(220, 80%, 55%);

  --text-primary: hsl(220, 25%, 15%);
  --text-secondary: hsl(220, 15%, 40%);
  --text-muted: hsl(220, 10%, 60%);

  /* Accents - slightly tuned for better contrast in light mode */
  --accent-blue: hsl(210, 100%, 50%);
  --accent-purple: hsl(270, 95%, 55%);
  --accent-green: hsl(145, 80%, 35%);
  --accent-orange: hsl(25, 95%, 45%);
  --accent-red: hsl(355, 85%, 50%);

  --gradient-primary: linear-gradient(135deg, hsl(210, 100%, 55%), hsl(270, 95%, 60%));
  --gradient-green: linear-gradient(135deg, hsl(145, 80%, 35%), hsl(160, 90%, 50%));
  --gradient-card: linear-gradient(180deg, hsla(220, 24%, 100%, 0.9), hsla(220, 25%, 95%, 0.9));

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 25px hsla(220, 85%, 60%, 0.08);

  --bg-input: hsl(220, 20%, 94%);
  --bg-header: hsla(220, 25%, 98%, 0.7);
  --bg-item: rgba(0, 0, 0, 0.04);
  --bg-img-placeholder: hsl(220, 10%, 90%);
  --color-placeholder: hsl(220, 10%, 75%);
  --glow-color-1: hsla(220, 90%, 55%, 0.06);
  --glow-color-2: hsla(270, 90%, 55%, 0.04);
}

/* --- RESET & BASIC STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Glowing Ambient Background */
.glow-bg {
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(circle, var(--glow-color-1) 0%, var(--glow-color-2) 50%, transparent 100%);
  filter: blur(100px);
  pointer-events: none;
  z-index: -1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--color-placeholder);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px 24px;
}

/* --- GLASSMORPHISM COMPONENT --- */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- HEADER & NAVIGATION --- */
header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: 40px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.logo-img-web {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-btn:hover .icon {
  color: var(--text-secondary);
}

.nav-btn.active {
  background: hsla(220, 80%, 60%, 0.1);
  border-color: hsla(220, 80%, 60%, 0.18);
  color: var(--accent-blue);
  box-shadow: 0 0 15px hsla(220, 80%, 60%, 0.08);
}

.nav-btn.active .icon {
  color: var(--accent-blue);
}

/* --- TAB ROUTING CONTENT --- */
.tab-content {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Welcome Banner */
.welcome-banner {
  margin-bottom: 32px;
}

.welcome-banner h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-banner p {
  color: var(--text-secondary);
  font-size: 16px;
}

/* --- STATS DASHBOARD PANELS --- */

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.metric-card {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-primary);
  opacity: 0.7;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon.blue { background: hsla(210, 100%, 60%, 0.1); color: var(--accent-blue); }
.metric-icon.purple { background: hsla(270, 95%, 65%, 0.1); color: var(--accent-purple); }
.metric-icon.green { background: hsla(145, 80%, 50%, 0.1); color: var(--accent-green); }
.metric-icon.orange { background: hsla(25, 95%, 55%, 0.1); color: var(--accent-orange); }

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.metric-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-card {
  padding: 24px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
  border-left: 3px solid var(--accent-blue);
  padding-left: 10px;
}

.chart-container {
  position: relative;
  flex-grow: 1;
  width: 100%;
  height: 100%;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- SHARED FEED SECTION --- */
.search-bar-container {
  margin-bottom: 30px;
}

.search-input {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 15px hsla(220, 80%, 65%, 0.15);
}

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

/* Car Card */
.car-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.car-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.car-img-container {
  height: 160px;
  width: 100%;
  background: var(--bg-img-placeholder);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.car-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.car-placeholder {
  width: 80px;
  height: 80px;
  color: var(--color-placeholder);
}

.color-dot {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.car-details {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.car-details h4 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.2;
}

.car-generation {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.car-info-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.car-info-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.car-expenses-sum {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.car-expenses-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.car-expenses-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-purple);
}

.view-details-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: var(--accent-blue);
  color: #0d121c;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.view-details-btn:hover {
  opacity: 0.9;
}

.owner-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- AUTHENTICATION --- */
.auth-wrapper {
  max-width: 440px;
  margin: 40px auto;
  overflow: hidden;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-light);
}

.auth-tab-btn {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  padding: 16px;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.02);
  box-shadow: inset 0 -2px 0 var(--accent-blue);
}

.auth-form {
  padding: 30px;
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 6px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  border-color: var(--border-focus);
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient-primary);
  border: 0;
  border-radius: var(--radius-sm);
  color: #0d121c;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-top: 10px;
}

.submit-btn:hover {
  opacity: 0.9;
}

.form-status {
  margin-top: 15px;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}
.form-status.error { color: var(--accent-red); }
.form-status.success { color: var(--accent-green); }

/* --- USER GARAGE DASHBOARD --- */
.garage-panel-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.user-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #0d121c;
}

.user-info h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.user-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: hsla(355, 85%, 60%, 0.1);
  border-color: hsla(355, 85%, 60%, 0.2);
  color: var(--accent-red);
}

.garage-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.garage-section-title h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

.badge {
  background: var(--accent-blue);
  color: #0d121c;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

/* User Car List Item */
.my-cars-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.my-car-row {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.my-car-meta h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.my-car-meta p {
  font-size: 13px;
  color: var(--text-muted);
}

.sharing-controls {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Sleek Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsl(220, 12%, 18%);
  transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-radius: 34px;
  border: 1px solid rgba(255,255,255,0.05);
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

input:checked + .slider {
  background-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #0d121c;
}

.share-link-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  max-width: 460px;
}

.share-url-input {
  flex-grow: 1;
  padding: 8px 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
  font-family: var(--font-main);
  font-size: 12px;
  outline: none;
}

.copy-btn {
  padding: 8px 14px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--text-muted);
  color: #0d121c;
}

/* --- DETAIL MODAL --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: all;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  width: min(840px, calc(100% - 32px));
  max-height: 85vh;
  border-radius: var(--radius-lg);
  overflow-y: auto;
  position: relative;
  z-index: 10;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 36px;
}

@keyframes slideUp {
  from { transform: translateY(40px); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--accent-red);
}

/* Shared Car Detail Content */
.detail-header {
  display: flex;
  gap: 30px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 24px;
}

.detail-img {
  width: 220px;
  height: 140px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-img svg {
  width: 60px;
  height: 60px;
  color: var(--color-placeholder);
}

.detail-title-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-brand-model {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.detail-owner {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.detail-owner span {
  color: var(--accent-blue);
  font-weight: 600;
}

.detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Modal Content Grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 30px;
}

.detail-section-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.detail-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}

/* History/Logs List */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
}

.log-item {
  padding: 16px;
  background: var(--bg-item);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.log-main h5 {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.log-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.log-notes {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.log-side {
  text-align: right;
}

.log-amount {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-purple);
}

.log-category {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Selector cards and styles for Buyer Tab */
.buyer-selector-card {
  padding: 24px;
  margin-bottom: 30px;
}

.selector-row {
  display: flex;
  gap: 20px;
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.glass-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239eaaa6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 40px;
  transition: all 0.2s ease;
}

.glass-select:focus {
  border-color: var(--border-focus);
}

.glass-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.buyer-result-wrapper {
  animation: fadeIn 0.4s ease;
}

.buyer-details-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  margin-top: 24px;
}

.buyer-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  margin-top: -12px;
}

.buyer-repairs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 380px;
  padding-right: 4px;
}

.buyer-repair-item {
  padding: 14px 16px;
  background: var(--bg-item);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.buyer-repair-info h5 {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
}

.buyer-repair-mileage {
  font-size: 11px;
  color: var(--accent-blue);
  font-weight: 500;
  margin-top: 2px;
}

.buyer-repair-cost {
  text-align: right;
}

.buyer-repair-price {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-purple);
}

.buyer-repair-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.buyer-empty-state-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.buyer-empty-state-wrapper h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin-bottom: 8px;
}

.buyer-empty-state-wrapper p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
}

/* --- RESPONSIVENESS --- */
@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .buyer-details-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 16px;
    padding: 12px 16px;
    align-items: center;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    padding: 8px 12px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .welcome-banner h1 {
    font-size: 26px;
  }

  .detail-header {
    flex-direction: column;
    gap: 20px;
  }

  .detail-img {
    width: 100%;
    height: 180px;
  }

  .modal-content {
    padding: 24px;
  }

  .my-car-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .sharing-controls {
    width: 100%;
    justify-content: space-between;
  }

  .selector-row {
    flex-direction: column;
    gap: 12px;
  }
}

/* --- THEME TOGGLE BUTTON STYLES --- */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.light-theme .theme-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.theme-toggle-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.theme-toggle-btn:hover .icon {
  color: var(--text-primary);
}

/* Toggle Sun/Moon Visibility based on active theme class */
.light-theme #theme-toggle .sun-icon {
  display: none !important;
}

.light-theme #theme-toggle .moon-icon {
  display: block !important;
}

#theme-toggle .sun-icon {
  display: block !important;
}

#theme-toggle .moon-icon {
  display: none !important;
}

/* Light Theme Header Text Gradient Fix */
.light-theme .welcome-banner h1 {
  background: linear-gradient(135deg, hsl(220, 25%, 15%), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Transitions for Theme Switching */
body, header, .glass, .metric-card, .chart-card, .car-card, .form-group input, .glass-select, .log-item, .buyer-repair-item, .detail-img {
  transition: background 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

