/* Tire Age Reminder - Styles */
:root {
  --color-bg: #FFF8F0;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5EDE4;
  --color-primary: #8B4513;
  --color-primary-dark: #6B3410;
  --color-primary-light: #A0522D;
  --color-text: #2C1810;
  --color-text-muted: #6B5A52;
  --color-border: #D4C4B5;
  --color-success: #228B22;
  --color-warning: #DAA520;
  --color-danger: #B22222;
  --color-danger-light: #FFF0F0;
  --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.08);
  --shadow-md: 0 4px 12px rgba(44, 24, 16, 0.12);
  --shadow-lg: 0 8px 24px rgba(44, 24, 16, 0.16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

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

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

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

img, svg {
  max-width: 100%;
  height: auto;
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  text-decoration: none;
}

.logo:hover {
  color: var(--color-primary-dark);
  text-decoration: none;
}

.main-nav {
  display: flex;
  gap: 24px;
}

.main-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.main-nav a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  text-decoration: none;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 28px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: white;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-small:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.btn-danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: var(--color-danger-light);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

/* Worksheet Section */
.worksheet-section {
  padding: 48px 0;
}

.worksheet-header {
  text-align: center;
  margin-bottom: 36px;
}

.worksheet-header h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.worksheet-header p {
  color: var(--color-text-muted);
}

.worksheet-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  align-items: start;
}

/* Input Panel */
.input-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.tire-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.form-group input,
.form-group select {
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.15);
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Presets */
.presets {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.presets h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--color-text-muted);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Results Panel */
.results-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.results-header h3 {
  font-size: 1.2rem;
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tire List */
.tire-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state p {
  margin-bottom: 4px;
}

.tire-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  transition: all var(--transition);
}

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

.tire-card.status-ok {
  border-left: 4px solid var(--color-success);
}

.tire-card.status-warning {
  border-left: 4px solid var(--color-warning);
}

.tire-card.status-danger {
  border-left: 4px solid var(--color-danger);
  background: var(--color-danger-light);
}

.tire-card-left {
  flex-shrink: 0;
}

.tire-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
}

.tire-badge.ok {
  background: var(--color-success);
}

.tire-badge.warning {
  background: var(--color-warning);
}

.tire-badge.danger {
  background: var(--color-danger);
}

.tire-card-info {
  flex: 1;
  min-width: 0;
}

.tire-card-info h4 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.tire-card-info .tire-age {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.tire-card-info .tire-notes {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.tire-card-right {
  flex-shrink: 0;
  text-align: right;
}

.tire-status-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tire-status-label.ok {
  color: var(--color-success);
}

.tire-status-label.warning {
  color: var(--color-warning);
}

.tire-status-label.danger {
  color: var(--color-danger);
}

.tire-card-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
  transition: color var(--transition);
}

.tire-card-remove:hover {
  color: var(--color-danger);
}

/* Summary Panel */
.summary-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--color-border);
}

.summary-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat {
  text-align: center;
  padding: 16px 8px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.2;
}

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

/* Guide Section */
.guide-section {
  padding: 48px 0;
  background: var(--color-surface-alt);
}

.guide-section h2 {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 36px;
}

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

.guide-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.guide-icon {
  margin-bottom: 16px;
}

.guide-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.guide-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.guide-details h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  margin-top: 32px;
}

.guide-details h3:first-child {
  margin-top: 0;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.guide-table th,
.guide-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.guide-table th {
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.guide-table td {
  font-size: 0.9rem;
}

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

.common-mistakes {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.common-mistakes ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.common-mistakes li {
  padding-left: 24px;
  position: relative;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.common-mistakes li::before {
  content: "!";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  background: var(--color-warning);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* FAQ */
.faq-section {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.faq-section details {
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
}

.faq-section details:last-child {
  border-bottom: none;
}

.faq-section summary {
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-section summary::-webkit-details-marker {
  display: none;
}

.faq-section summary::before {
  content: "+";
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.faq-section details[open] summary::before {
  content: "−";
}

.faq-section details p {
  padding: 8px 0 0 24px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* About Section */
.about-section {
  padding: 48px 0;
}

.about-section h2 {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 24px;
}

.about-content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.about-content p {
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .hero,
  .input-panel,
  .results-actions,
  .tire-card-remove,
  .presets {
    display: none !important;
  }

  .worksheet-layout {
    display: block;
  }

  .results-panel {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .tire-card {
    break-inside: avoid;
  }
}

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

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

  .summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tire-card {
    flex-wrap: wrap;
  }

  .tire-card-right {
    width: 100%;
    text-align: left;
    padding-left: 64px;
  }

  .summary-stats {
    grid-template-columns: 1fr 1fr;
  }

  .main-nav {
    gap: 16px;
  }

  .main-nav a {
    font-size: 0.8rem;
  }
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}


/* 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;
}
