/* TireTools Hub - Global Styles */
:root {
  --primary: #1a1a2e;
  --secondary: #16213e;
  --accent: #e94560;
  --accent-hover: #d13650;
  --light: #f8f9fa;
  --dark: #0f0f1a;
  --text: #333;
  --text-light: #666;
  --border: #e0e0e0;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: #f5f6f8;
  line-height: 1.6;
}

/* Header */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

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

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 12px;
  font-weight: 800;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto 30px;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.card-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* Tool Grid on Home */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.tool-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.tool-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: #fff;
}

.tool-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  flex: 1;
}

.tool-card .tool-tag {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 12px;
  background: #f0f0f5;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

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

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

.form-group small {
  display: block;
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 4px;
}

select, input[type="text"], input[type="number"], input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.2s;
  font-family: inherit;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background: #1a2a4a;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-lg {
  padding: 14px 36px;
  font-size: 1.1rem;
}

/* Results */
.result-box {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  border-left: 4px solid var(--accent);
}

.result-box h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.result-item:last-child { border-bottom: none; }

.result-label { font-weight: 600; color: var(--text-light); }

.result-value { font-weight: 700; color: var(--primary); }

.result-value.positive { color: var(--success); }
.result-value.negative { color: var(--danger); }
.result-value.warning { color: var(--warning); }

/* Comparison Table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.compare-table th, .compare-table td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.compare-table th {
  background: var(--light);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compare-table tr:hover {
  background: #fafafa;
}

.compare-table .diff-positive { color: var(--success); font-weight: 600; }
.compare-table .diff-negative { color: var(--danger); font-weight: 600; }

/* Tire Visual */
.tire-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.tire-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 12px solid #333;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #333;
  background: #f0f0f0;
}

.tire-circle::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2px dashed #ccc;
}

.tire-circle.primary { border-color: var(--accent); }
.tire-circle.secondary { border-color: var(--info); }

/* Rotation Diagram */
.rotation-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 400px;
  margin: 24px auto;
}

.wheel-pos {
  background: #fff;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-weight: 700;
  position: relative;
}

.wheel-pos.front { border-color: var(--accent); }
.wheel-pos.rear { border-color: var(--info); }

.wheel-pos .label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 2px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Article Section */
.article-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-top: 32px;
}

.article-section h2 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.4rem;
}

.article-section h3 {
  color: var(--secondary);
  margin: 24px 0 12px;
  font-size: 1.1rem;
}

.article-section p {
  margin-bottom: 14px;
  color: var(--text);
  line-height: 1.7;
}

.article-section ul, .article-section ol {
  margin-left: 20px;
  margin-bottom: 16px;
}

.article-section li {
  margin-bottom: 8px;
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

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

.faq-question {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 1rem;
}

.faq-answer {
  color: var(--text-light);
  line-height: 1.6;
}

/* Affiliate Box */
.affiliate-box {
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border: 1px solid #ffe082;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 28px;
  text-align: center;
}

.affiliate-box h4 {
  color: #856404;
  margin-bottom: 12px;
}

.affiliate-box p {
  color: #856404;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.affiliate-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.affiliate-links a {
  display: inline-block;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  color: #856404;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.affiliate-links a:hover {
  background: #ffc107;
  color: #333;
}

/* Disclaimer */
.disclaimer {
  background: #f8f9fa;
  border-left: 4px solid var(--warning);
  padding: 16px 20px;
  margin-top: 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.disclaimer strong {
  color: var(--warning);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 16px 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  padding: 40px 20px 20px;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}

.footer-col h4 {
  color: #fff;
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-col a {
  display: block;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 4px 0;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-col a:hover { color: #fff; }

.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tire-visual { gap: 20px; }
  .tire-circle { width: 90px; height: 90px; font-size: 0.7rem; }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .article-section { padding: 20px; }
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ===== MOBILE COMPATIBILITY FIXES ===== */

/* iOS Safari input / select reset */
select, input[type="text"], input[type="number"], input[type="date"], textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: var(--radius);
}

/* Custom select dropdown arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Remove iOS tap highlight */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Touch action optimization */
button, a, select, input, [onclick] {
  touch-action: manipulation;
}

/* Table scroll wrapper */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border-radius: var(--radius);
}

.table-scroll .compare-table {
  min-width: 600px;
  margin-top: 0;
}

/* Mobile grid adjustments */
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }

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

  .tire-visual {
    gap: 16px;
  }

  .tire-circle {
    width: 80px;
    height: 80px;
    font-size: 0.65rem;
    border-width: 8px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .card {
    padding: 16px;
  }

  .article-section {
    padding: 16px;
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
  }

  .result-item {
    flex-direction: column;
    gap: 4px;
  }

  .affiliate-links {
    flex-direction: column;
  }

  .affiliate-links a {
    width: 100%;
  }

  /* Rotation diagram mobile fix */
  .rotation-diagram-mobile {
    max-width: 100%;
    padding: 0 10px;
  }

  .rotation-diagram-mobile .wheel-pos {
    padding: 14px;
    font-size: 0.95rem;
  }

  /* Result grid mobile fix */
  .result-grid-mobile {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Smooth scroll for iOS */
html {
  -webkit-overflow-scrolling: touch;
}
