/* FuelLog – Personal Vehicle Fuel & Service Log */
:root {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-surface-2: #222633;
  --color-border: #2e3344;
  --color-text: #e4e6ed;
  --color-text-muted: #8b8fa3;
  --color-primary: #4f8cff;
  --color-primary-hover: #6ba0ff;
  --color-primary-dim: rgba(79, 140, 255, 0.12);
  --color-success: #34d399;
  --color-danger: #f87171;
  --color-warning: #fbbf24;
  --color-accent: #c084fc;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 100;
  background: var(--color-primary); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: 56px;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; gap: 16px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text); font-weight: 700; font-size: 1.15rem;
  text-decoration: none; flex-shrink: 0;
}
.logo:hover { color: var(--color-primary); text-decoration: none; }
.logo-icon { flex-shrink: 0; }

.main-nav {
  display: flex; gap: 4px; align-items: center;
}
.nav-link {
  color: var(--color-text-muted); font-size: 0.875rem;
  padding: 6px 12px; border-radius: var(--radius-sm);
  text-decoration: none; transition: all var(--transition);
}
.nav-link:hover { color: var(--color-text); background: var(--color-surface-2); text-decoration: none; }

/* Hero */
.hero-section {
  padding: 64px 0 48px;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}
.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800; line-height: 1.15;
  max-width: 600px; margin-bottom: 16px;
}
.hero-subtitle {
  font-size: 1.1rem; color: var(--color-text-muted);
  max-width: 520px; margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  padding: 10px 20px; border-radius: var(--radius-md);
  border: 1px solid transparent; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-ghost { background: transparent; color: var(--color-text-muted); border-color: var(--color-border); }
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-2); }
.btn-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* Sections */
section { padding: 48px 0; }
.section-title {
  font-size: 1.4rem; font-weight: 700; margin-bottom: 24px;
}

/* Layout Split */
.layout-split {
  display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start;
}
.layout-primary { min-width: 0; }
.layout-sidebar {
  position: sticky; top: 72px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* Vehicle Setup */
.vehicle-setup {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px;
  align-items: end; margin-bottom: 24px;
  padding: 20px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
}

/* Tabs */
.entry-type-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--color-surface); color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-bottom: none;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.tab.active { background: var(--color-surface-2); color: var(--color-text); }
.tab:hover:not(.active) { color: var(--color-text); }

/* Panels */
.panel {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 24px;
}
.panel.active { display: block; }

/* Forms */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.input, .select {
  font-family: inherit; font-size: 0.9rem;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--color-bg); color: var(--color-text);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition);
}
.input:focus, .select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-dim);
}
.select-sm { padding: 6px 10px; font-size: 0.8rem; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Presets */
.quick-presets { margin-top: 24px; }
.presets-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 10px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: inherit; font-size: 0.8rem;
  padding: 6px 14px; border-radius: 20px;
  background: var(--color-surface); color: var(--color-text-muted);
  border: 1px solid var(--color-border); cursor: pointer;
  transition: all var(--transition);
}
.chip:hover { background: var(--color-primary-dim); color: var(--color-primary); border-color: var(--color-primary); }

/* Dashboard */
.dash-empty { color: var(--color-text-muted); font-size: 0.9rem; }
.dash-stats { display: flex; flex-direction: column; gap: 8px; }
.stat-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--color-bg);
  border-radius: var(--radius-sm); border: 1px solid var(--color-border);
}
.stat-card-total { border-color: var(--color-primary); background: var(--color-primary-dim); }
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); }
.stat-value { font-size: 1rem; font-weight: 700; }

/* Chart */
.economy-chart { margin-top: 20px; }
.chart-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 8px; }
.chart-svg { width: 100%; height: auto; }

/* Sidebar Actions */
.sidebar-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--color-border);
}

/* History */
.history-section { background: var(--color-surface); }
.history-filters {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.table-wrapper { overflow-x: auto; }
.history-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.history-table th {
  text-align: left; padding: 10px 12px;
  background: var(--color-surface-2); color: var(--color-text-muted);
  font-weight: 600; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.04em; white-space: nowrap;
  border-bottom: 2px solid var(--color-border);
}
.history-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.history-table tr:hover td { background: var(--color-surface-2); }
.history-table .type-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.type-badge.fuel { background: rgba(79, 140, 255, 0.15); color: var(--color-primary); }
.type-badge.service { background: rgba(192, 132, 252, 0.15); color: var(--color-accent); }
.history-table .row-actions { display: flex; gap: 4px; }
.history-table .btn-icon {
  font-family: inherit; font-size: 0.75rem;
  padding: 4px 8px; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-muted);
  border: 1px solid var(--color-border); cursor: pointer;
  transition: all var(--transition);
}
.history-table .btn-icon:hover { color: var(--color-text); background: var(--color-surface); }
.history-table .btn-icon.delete:hover { color: var(--color-danger); border-color: var(--color-danger); }
.history-empty { text-align: center; color: var(--color-text-muted); padding: 40px 0; }

/* Guide */
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin-bottom: 40px;
}
.guide-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 20px;
}
.guide-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.guide-card p { font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.65; }

/* FAQ */
.faq-block { max-width: 720px; }
.faq-heading { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.faq-item { border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.faq-item summary {
  padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  color: var(--color-text); list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--color-text-muted); }
.faq-item[open] summary::after { content: '−'; }
.faq-item summary:hover { background: var(--color-surface-2); }
.faq-item p { padding: 0 18px 14px; font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.65; }

/* Footer */
.site-footer {
  margin-top: auto; border-top: 1px solid var(--color-border);
  padding: 24px 0; background: var(--color-surface);
}
.footer-inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { font-size: 0.8rem; color: var(--color-text-muted); }
.footer-nav a:hover { color: var(--color-text); }
.footer-copy { font-size: 0.75rem; color: var(--color-text-muted); margin-left: auto; }

/* Edit Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Responsive */
@media (max-width: 900px) {
  .layout-split { grid-template-columns: 1fr; }
  .layout-sidebar { position: static; }
  .vehicle-setup { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main-nav { display: none; }
  .hero-section { padding: 40px 0 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .history-table { font-size: 0.78rem; }
  .history-table th, .history-table td { padding: 8px 8px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .footer-copy { margin-left: 0; }
}

/* Print */
@media print {
  .site-header, .hero-section, .entry-section, .sidebar-actions,
  .quick-presets, .history-filters, .row-actions, .site-footer,
  .guide-section, .site-header { display: none !important; }
  body { background: #fff; color: #000; }
  .history-section { background: #fff; }
  .history-table th { background: #eee; color: #333; }
  .history-table th, .history-table td { border-color: #ccc; color: #000; }
  .section-title { color: #000; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
