/* =============================================================
   GarageIQ V2 - app.css
   Mobile-first, dark-themed premium automotive expense tracker
   ============================================================= */

/* ----- Custom Properties ----- */

:root {
  --coal: #0d0d0f;
  --asphalt: #1a1a1f;
  --steel: #2a2a32;
  --chrome: #8b8b99;
  --silver: #c4c4d0;
  --white: #f0f0f5;
  --signal-red: #e8364f;
  --signal-glow: rgba(232, 54, 79, 0.15);
  --amber: #f59e0b;
  --emerald: #10b981;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --orange: #f97316;
  --yellow: #eab308;

  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-red: 0 4px 20px rgba(232, 54, 79, 0.35);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  --nav-height: 60px;
  --header-height: 56px;
}


/* ----- Reset & Base ----- */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--coal);
  color: var(--silver);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--white);
  line-height: 1.2;
}

a {
  color: var(--signal-red);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* Dark scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--coal);
}

::-webkit-scrollbar-thumb {
  background: var(--steel);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--chrome);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--steel) var(--coal);
}


/* ----- App Container & Layout ----- */

.app-container {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.main-content {
  flex: 1;
  padding: 0 16px 80px;
  width: 100%;
}

@media (min-width: 768px) {
  .main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
  }
}


/* ----- View Switching ----- */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewFadeIn var(--transition-base) ease;
}

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


/* ----- Bottom Navigation ----- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--asphalt);
  border-top: 1px solid var(--steel);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--chrome);
  font-size: 10px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background: none;
  border: none;
  padding: 0;
}

.bottom-nav-item .material-icons {
  font-size: 24px;
  transition: color var(--transition-fast);
}

.bottom-nav-item span:last-child {
  font-weight: 500;
}

.bottom-nav-item.active {
  color: var(--signal-red);
}

.bottom-nav-item.active .material-icons {
  color: var(--signal-red);
  filter: drop-shadow(0 0 6px var(--signal-glow));
}

.bottom-nav-item:active {
  transform: scale(0.92);
  transition: transform 80ms ease;
}


/* ----- Page Header ----- */

.page-header {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--coal);
  border-bottom: 1px solid var(--steel);
}

.page-header-logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
}

.page-header-logo em {
  font-style: normal;
  color: var(--signal-red);
}

.page-header-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
}

.page-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--steel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.page-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ----- Auth Screen ----- */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  background: var(--coal);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--asphalt);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  border: 1px solid var(--steel);
}

.auth-card-logo {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 24px;
}

.auth-card-logo em {
  font-style: normal;
  color: var(--signal-red);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--steel);
  border-radius: var(--radius-md);
  padding: 3px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--chrome);
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--asphalt);
  color: var(--white);
}

.auth-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--chrome);
}


/* ----- Stat Cards ----- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  padding: 1px;
  background: linear-gradient(135deg, var(--signal-red), var(--purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 4px;
}

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

@media (max-width: 400px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stat-card:last-child {
    grid-column: span 2;
  }
}


/* ----- Vehicle Cards ----- */

.vehicle-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.vehicle-card:active {
  transform: scale(0.98);
}

.vehicle-card-header {
  position: relative;
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--steel), var(--asphalt));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vehicle-card-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-card-header .material-icons {
  font-size: 48px;
  color: var(--chrome);
}

.vehicle-card-body {
  padding: 16px;
}

.vehicle-card-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.vehicle-card-body .vehicle-year {
  font-size: 13px;
  color: var(--chrome);
  margin-bottom: 12px;
}

.vehicle-card-cost {
  display: inline-block;
  background: var(--signal-glow);
  color: var(--signal-red);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

@media (min-width: 768px) {
  .vehicle-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
  }
}


/* ----- Expense Cards / List ----- */

.expense-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.expense-item:active {
  background: var(--steel);
}

.expense-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expense-icon .material-icons {
  font-size: 20px;
  color: var(--white);
}

.expense-details {
  flex: 1;
  min-width: 0;
}

.expense-details h4 {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-meta {
  font-size: 12px;
  color: var(--chrome);
  margin-top: 2px;
}

.expense-amount {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  text-align: right;
}

@media (min-width: 768px) {
  .expense-item:hover {
    background: var(--steel);
  }
}


/* ----- Category Badges ----- */

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.category-entretien_courant       { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.category-freinage                { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.category-transmission            { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.category-pneumatiques            { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.category-echappement             { background: rgba(139, 139, 153, 0.15); color: var(--chrome); }
.category-electrique              { background: rgba(234, 179, 8, 0.15);  color: var(--yellow); }
.category-carrosserie             { background: rgba(236, 72, 153, 0.15); color: var(--pink); }
.category-suspension              { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.category-controle_technique      { background: rgba(236, 72, 153, 0.15); color: var(--pink); }
.category-autre                   { background: rgba(139, 139, 153, 0.15); color: var(--chrome); }

/* Expense icon background colors matching categories */
.expense-icon.cat-entretien_courant  { background: rgba(16, 185, 129, 0.2); }
.expense-icon.cat-freinage           { background: rgba(245, 158, 11, 0.2); }
.expense-icon.cat-transmission       { background: rgba(249, 115, 22, 0.2); }
.expense-icon.cat-pneumatiques       { background: rgba(59, 130, 246, 0.2); }
.expense-icon.cat-echappement        { background: rgba(139, 139, 153, 0.2); }
.expense-icon.cat-electrique         { background: rgba(234, 179, 8, 0.2); }
.expense-icon.cat-carrosserie        { background: rgba(236, 72, 153, 0.2); }
.expense-icon.cat-suspension         { background: rgba(139, 92, 246, 0.2); }
.expense-icon.cat-controle_technique { background: rgba(236, 72, 153, 0.2); }
.expense-icon.cat-autre              { background: rgba(139, 139, 153, 0.2); }


/* ----- Charts ----- */

.donut-chart-container {
  position: relative;
  width: 100%;
  max-width: 220px;
  margin: 0 auto 24px;
}

.donut-chart-container canvas {
  width: 100%;
  height: auto;
}

.donut-chart-total {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-chart-total .total-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  display: block;
}

.donut-chart-total .total-label {
  font-size: 11px;
  color: var(--chrome);
  text-transform: uppercase;
}

.bar-chart-container {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 0;
}

.bar-chart-container canvas {
  width: 100%;
  height: 200px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar-fill {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: var(--signal-red);
  transition: height var(--transition-slow);
}

.bar-label {
  font-size: 10px;
  color: var(--chrome);
  text-align: center;
  white-space: nowrap;
}


/* ----- Modals ----- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: modalOverlayIn var(--transition-base) ease;
}

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

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: 100%;
  max-height: 92dvh;
  background: var(--asphalt);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp var(--transition-base) ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--steel);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--steel);
  border: none;
  color: var(--silver);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: var(--chrome);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--steel);
  flex-shrink: 0;
}

.modal-actions .btn {
  flex: 1;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    max-width: 540px;
    max-height: 85vh;
    border-radius: var(--radius-xl);
    animation: modalFadeScale var(--transition-base) ease;
  }

  @keyframes modalFadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }
}

@media (min-width: 1024px) {
  .modal {
    max-width: 640px;
  }
}


/* ----- Form Inputs ----- */

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--steel);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--chrome);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background: var(--asphalt);
  border-color: var(--signal-red);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: var(--signal-red);
  background: rgba(232, 54, 79, 0.05);
}

.form-group .error-message {
  font-size: 12px;
  color: var(--signal-red);
  margin-top: 4px;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}


/* ----- Select Inputs ----- */

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8b99'%3E%3Cpath d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-group select option {
  background: var(--asphalt);
  color: var(--silver);
}


/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--signal-red);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-red);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--steel);
  color: var(--silver);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--chrome);
  color: var(--white);
}

.btn-danger {
  background: transparent;
  color: var(--signal-red);
  border: 1.5px solid var(--signal-red);
}

.btn-danger:hover:not(:disabled) {
  background: var(--signal-glow);
}

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--steel);
  color: var(--silver);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.btn-icon:hover {
  background: var(--chrome);
}


/* ----- FAB (Floating Action Button) ----- */

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 950;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--signal-red);
  color: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-red);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: fabPulse 3s ease-in-out infinite;
}

.fab .material-icons {
  font-size: 28px;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(232, 54, 79, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

@keyframes fabPulse {
  0%, 100% { box-shadow: var(--shadow-red); }
  50%      { box-shadow: 0 4px 30px rgba(232, 54, 79, 0.5); }
}


/* ----- Toast Notifications ----- */

.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--asphalt);
  border: 1px solid var(--steel);
  color: var(--silver);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastSlideIn var(--transition-base) ease;
}

.toast.dismiss {
  animation: toastSlideOut var(--transition-base) ease forwards;
}

.toast .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-success {
  border-left: 3px solid var(--emerald);
}

.toast-success .material-icons {
  color: var(--emerald);
}

.toast-error {
  border-left: 3px solid var(--signal-red);
}

.toast-error .material-icons {
  color: var(--signal-red);
}

.toast-info {
  border-left: 3px solid var(--blue);
}

.toast-info .material-icons {
  color: var(--blue);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-20px); }
}


/* ----- Empty States ----- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--steel);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-icon .material-icons {
  font-size: 36px;
  color: var(--chrome);
}

.empty-state-text h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state-text p {
  font-size: 14px;
  color: var(--chrome);
  max-width: 280px;
  margin: 0 auto;
}

.empty-state .btn {
  margin-top: 20px;
}


/* ----- Reminder Cards ----- */

.reminder-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reminder-card .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.reminder-card h4 {
  font-size: 14px;
  font-weight: 600;
}

.reminder-card p {
  font-size: 12px;
  color: var(--chrome);
  margin-top: 2px;
}

.reminder-overdue {
  border-left-color: var(--signal-red);
}

.reminder-overdue .material-icons {
  color: var(--signal-red);
}

.reminder-urgent {
  border-left-color: var(--amber);
}

.reminder-urgent .material-icons {
  color: var(--amber);
}


/* ----- Price Comparison Bars ----- */

.price-bar {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--steel);
  border-radius: var(--radius-full);
  margin: 16px 0 8px;
}

.price-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--emerald), var(--amber), var(--signal-red));
}

.price-marker {
  position: absolute;
  top: -6px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--white);
  border: 3px solid var(--signal-red);
  transform: translateX(-50%);
}

.price-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--chrome);
}


/* ----- Tabs ----- */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--steel);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--chrome);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color var(--transition-fast);
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  border-radius: 2px 2px 0 0;
  transition: background var(--transition-fast);
}

.tab.active {
  color: var(--white);
}

.tab.active::after {
  background: var(--signal-red);
}


/* ----- Timeline ----- */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--steel);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--signal-red);
  border: 2px solid var(--coal);
  z-index: 1;
}

.timeline-item h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-item .timeline-date {
  font-size: 12px;
  color: var(--chrome);
}

.timeline-item .timeline-amount {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-top: 4px;
}


/* ----- Checkbox Groups ----- */

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--silver);
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.checkbox-item .checkmark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--chrome);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
  background: var(--signal-red);
  border-color: var(--signal-red);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}


/* ----- Search / Autocomplete ----- */

.search-autocomplete {
  position: relative;
}

.search-autocomplete input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--steel);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.search-autocomplete input:focus {
  background: var(--asphalt);
  border-color: var(--signal-red);
}

.search-autocomplete .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--chrome);
  font-size: 20px;
  pointer-events: none;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--silver);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: var(--steel);
  color: var(--white);
}


/* ----- Tables ----- */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--steel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--asphalt);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--chrome);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--steel);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 42, 50, 0.5);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--asphalt);
}

tbody tr:last-child td {
  border-bottom: none;
}


/* ----- Loading Spinner ----- */

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--steel);
  border-top-color: var(--signal-red);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 15, 0.7);
}


/* ----- Skeleton Loaders ----- */

.skeleton {
  background: linear-gradient(90deg, var(--steel) 25%, var(--asphalt) 50%, var(--steel) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

.skeleton-circle {
  border-radius: var(--radius-full);
}


/* ----- Profile Page ----- */

.profile-header {
  text-align: center;
  padding: 32px 16px 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--steel);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--signal-red);
}

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

.profile-avatar .material-icons {
  font-size: 36px;
  color: var(--chrome);
}

.profile-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.profile-email {
  font-size: 14px;
  color: var(--chrome);
}

.settings-list {
  margin-top: 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--asphalt);
  border-bottom: 1px solid var(--steel);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.settings-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.settings-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-bottom: none;
}

.settings-item:hover {
  background: var(--steel);
}

.settings-item .material-icons {
  font-size: 22px;
  color: var(--chrome);
}

.settings-item span {
  flex: 1;
  font-size: 14px;
  color: var(--silver);
}

.settings-item .material-icons:last-child {
  font-size: 18px;
  color: var(--chrome);
}


/* ----- Insurance Card ----- */

.insurance-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-left: 4px solid var(--purple);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.insurance-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 8px;
}

.insurance-card .insurance-company {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}

.insurance-card .insurance-premium {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
}

.insurance-card .insurance-premium small {
  font-size: 13px;
  font-weight: 400;
  color: var(--chrome);
}

.insurance-card .insurance-meta {
  font-size: 12px;
  color: var(--chrome);
  margin-top: 8px;
}


/* ----- Fuel Stats Card ----- */

.fuel-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.fuel-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 12px;
}

.fuel-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fuel-stat {
  text-align: center;
}

.fuel-stat .fuel-stat-value {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.fuel-stat .fuel-stat-label {
  font-size: 11px;
  color: var(--chrome);
}

.fuel-graph-area {
  width: 100%;
  height: 100px;
  background: rgba(59, 130, 246, 0.05);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fuel-graph-area canvas {
  width: 100%;
  height: 100%;
}


/* ----- CT (Controle Technique) Card ----- */

.ct-card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.ct-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ct-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ct-result-favorable {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}

.ct-result-minor {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
}

.ct-result-major {
  background: rgba(232, 54, 79, 0.15);
  color: var(--signal-red);
}

.ct-result-critical {
  background: rgba(232, 54, 79, 0.25);
  color: var(--signal-red);
}

.ct-card .ct-date {
  font-size: 12px;
  color: var(--chrome);
  margin-top: 8px;
}

.ct-card .ct-next {
  font-size: 13px;
  color: var(--silver);
  margin-top: 4px;
}


/* ----- Chip Group ----- */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--steel);
  color: var(--silver);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chip.active {
  background: var(--signal-glow);
  color: var(--signal-red);
  border-color: var(--signal-red);
}

.chip:hover:not(.active) {
  background: var(--chrome);
  color: var(--white);
}


/* ----- Responsive Grids ----- */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ----- Section Headers ----- */

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

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.section-header a,
.section-header button {
  font-size: 13px;
  font-weight: 600;
  color: var(--signal-red);
  background: none;
  border: none;
  cursor: pointer;
}


/* ----- Cards (generic) ----- */

.card {
  background: var(--asphalt);
  border: 1px solid var(--steel);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
}


/* ----- Dividers ----- */

.divider {
  height: 1px;
  background: var(--steel);
  margin: 16px 0;
}


/* ----- Badges / Tags ----- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-red {
  background: var(--signal-glow);
  color: var(--signal-red);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}


/* ----- Toggle / Switch ----- */

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--steel);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--signal-red);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
}

.toggle.active::after {
  transform: translateX(20px);
}


/* ----- Amount Display ----- */

.amount-large {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
}

.amount-currency {
  font-size: 18px;
  font-weight: 400;
  color: var(--chrome);
  margin-left: 2px;
}


/* ----- Utility Classes ----- */

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-chrome { color: var(--chrome); }
.text-silver { color: var(--silver); }
.text-white  { color: var(--white); }
.text-red    { color: var(--signal-red); }
.text-green  { color: var(--emerald); }
.text-amber  { color: var(--amber); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.flex-center    { align-items: center; justify-content: center; }
.flex-between   { justify-content: space-between; }
.items-center   { align-items: center; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.gap-16         { gap: 16px; }

.w-full { width: 100%; }
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


/* ----- Responsive Adjustments ----- */

@media (min-width: 768px) {
  .page-header {
    padding: 0 24px;
  }

  .stat-value {
    font-size: 26px;
  }

  .vehicle-card-header {
    height: 180px;
  }

  .modal-body {
    padding: 24px;
  }
}

@media (min-width: 1024px) {
  .stat-grid {
    gap: 16px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .expense-item {
    padding: 16px 20px;
  }
}


/* ----- Print Styles ----- */

@media print {
  .bottom-nav,
  .fab,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  body {
    background: white;
    color: #333;
  }

  .main-content {
    padding-bottom: 0;
  }
}
