/* =========================================================
   AutoCare – Oil Change Reminder System
   Design system based on professional dashboard reference
   ========================================================= */

:root {
  /* Green palette matching AutoCare logo (#049750) */
  --sidebar-bg: #0A3D28;
  --sidebar-active-bg: #0F5132;
  --sidebar-indicator: #4ADE80;
  --sidebar-text: #A7F3C0;
  --sidebar-text-active: #FFFFFF;
  --page-bg: #F0FDF4;
  --card-bg: #FFFFFF;
  --header-bg: #FFFFFF;
  --primary-text: #14532D;
  --secondary-text: #6B7280;
  --primary-btn: #049750;
  --primary-btn-hover: #037A40;
  --border: #D1FAE5;
  --success: #16A34A;
  --warning: #f0ad4e;
  --danger: #dc3545;
  --info: #0EA5E9;
  --logo-green: #049750;
  --sidebar-width: 280px;
  --header-height: 70px;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(4, 151, 80, 0.08);
  --shadow-sm: 0 1px 4px rgba(4, 151, 80, 0.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

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

html { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--primary-text);
  background: var(--page-bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Layout ---------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.sidebar-brand .brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand .brand-text span {
  font-size: 11px;
  color: var(--sidebar-text);
  display: block;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.sidebar-nav .nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(168, 197, 217, 0.5);
  padding: 12px 14px 6px;
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--sidebar-indicator);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: rgba(168,197,217,0.5);
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.top-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  color: var(--primary-text);
}

.header-left p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--secondary-text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-dropdown {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.15s;
  background: none;
  font-family: inherit;
  color: inherit;
}

.user-trigger:hover {
  background: var(--page-bg);
  border-color: var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #049750, #0F5132);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-meta {
  text-align: left;
}

.user-meta .name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--primary-text);
  display: block;
}

.user-meta .role {
  font-size: 11.5px;
  color: var(--secondary-text);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(11,45,70,0.12);
  min-width: 180px;
  padding: 6px;
  display: none;
  z-index: 200;
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--primary-text);
  font-size: 13.5px;
  font-weight: 500;
}

.dropdown-menu a:hover {
  background: var(--page-bg);
}

.dropdown-menu .divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---------- Page content ---------- */
.page-content {
  padding: 24px 28px 40px;
  flex: 1;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  color: var(--primary-text);
}

.card-body {
  padding: 22px;
}

/* ---------- Summary cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.blue { background: #DCFCE7; color: #049750; }
.stat-icon.amber { background: #FFF5E6; color: #D97706; }
.stat-icon.orange { background: #FFF0E8; color: #EA580C; }
.stat-icon.red { background: #FEECEC; color: #DC2626; }
.stat-icon.green { background: #ECFDF5; color: #059669; }
.stat-icon.purple { background: #F3E8FF; color: #7C3AED; }

.stat-content .label {
  font-size: 12.5px;
  color: var(--secondary-text);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-content .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-text);
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.stat-content .sub {
  font-size: 12px;
  color: var(--secondary-text);
  margin-top: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary-btn);
  color: #fff;
  border-color: var(--primary-btn);
}
.btn-primary:hover {
  background: var(--primary-btn-hover);
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--primary-text);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--page-bg);
  border-color: #c0cdd8;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 14.5px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--primary-text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: #049750;
  box-shadow: 0 0 0 3px rgba(4, 151, 80, 0.22);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.invalid-feedback {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-text {
  font-size: 12px;
  color: var(--secondary-text);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371839A' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* ---------- Tables ---------- */
.table-responsive {
  overflow-x: auto;
}

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

.table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--secondary-text);
  background: #F7FAFC;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--primary-text);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #F9FBFD;
}

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

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  line-height: 1.4;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-secondary { background: #E5E7EB; color: #374151; }
.badge-info { background: #DBEAFE; color: #1E40AF; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-danger  { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: #C0CDD8;
  margin-bottom: 16px;
}

.empty-state h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary-text);
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--secondary-text);
  font-size: 13.5px;
}

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  padding: 24px;
}

.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 440px;
  padding: 36px 36px 32px;
}

.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card .auth-logo .auth-logo-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  display: inline-block;
  box-shadow: 0 2px 12px rgba(4, 151, 80, 0.2);
}

.auth-card .auth-logo h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-text);
}

.auth-card .auth-logo p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--secondary-text);
}

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
  text-align: center;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--secondary-text);
  font-size: 13.5px;
  margin-bottom: 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--secondary-text);
}

.auth-footer a {
  font-weight: 600;
}

/* ---------- Vehicle cards (mobile-friendly list) ---------- */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.vehicle-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: box-shadow 0.2s;
}

.vehicle-card:hover { box-shadow: var(--shadow); }

.vehicle-card .vc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.vehicle-card .vc-title {
  font-weight: 650;
  font-size: 15px;
  color: var(--primary-text);
}

.vehicle-card .vc-reg {
  font-size: 12.5px;
  color: var(--secondary-text);
  margin-top: 2px;
}

.vehicle-card .vc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.vehicle-card .vc-meta span {
  color: var(--secondary-text);
}

.vehicle-card .vc-meta strong {
  display: block;
  color: var(--primary-text);
  font-weight: 600;
  margin-top: 1px;
}

.vehicle-card .vc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 16px 0 4px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-text);
  border: 1px solid var(--border);
  background: #fff;
}

.pagination a:hover { background: var(--page-bg); }
.pagination .active {
  background: var(--primary-btn);
  color: #fff;
  border-color: var(--primary-btn);
}

/* ---------- Mobile ---------- */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--primary-text);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 61, 40, 0.45);
  z-index: 999;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .page-content {
    padding: 18px 16px 32px;
  }
  .top-header {
    padding: 0 16px;
  }
}

@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-left p { display: none; }
  .user-meta { display: none; }
  .auth-card { padding: 28px 22px; }
}

/* Utility */
.text-muted { color: var(--secondary-text); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }
.fw-600 { font-weight: 600; }