/* ==========================================================================
   Tire Card & Listing Styles
   Covers: tire grid, tire cards, archive pages, filters, detail pages, brand pages
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (scoped to this module)
   -------------------------------------------------------------------------- */
:root {
  --accent: #E11D48;
  --accent-light: rgba(225, 29, 72, 0.08);
  --accent-shadow: rgba(225, 29, 72, 0.18);
  --border: #E2E8F0;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --bg-white: #FFFFFF;
  --bg-light: #F8FAFC;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ==========================================================================
   1. Tire Grid
   ========================================================================== */

.tire-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ==========================================================================
   2. Tire Card
   ========================================================================== */

.tire-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 200ms ease;
}

.tire-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow:
    0 12px 24px -6px var(--accent-shadow),
    0 4px 8px -2px rgba(0, 0, 0, 0.06);
}

.tire-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ==========================================================================
   3. Tire Card Image
   ========================================================================== */

.tire-card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 180px;
  padding: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
  overflow: hidden;
  position: relative;
}

.tire-card-image img {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 156px;
  object-fit: contain;
}

.tire-card-image-wrapper {
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-light) 0%, #EEF2F7 100%);
}

/* ==========================================================================
   4. Tire Card Content
   ========================================================================== */

.tire-card-content,
.tire-card-body {
  padding: 16px;
}

/* ==========================================================================
   5. Tire Card Brand
   ========================================================================== */

.tire-card-brand {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* ==========================================================================
   6. Tire Card Title / Model
   ========================================================================== */

.tire-card-title {
  margin: 4px 0 0;
  line-height: 1.3;
}

.tire-card-title a {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tire-card-model {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ==========================================================================
   6b. Tire Card Score
   ========================================================================== */

.tire-card-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 6px;
}

.tire-card-score .score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  min-width: 36px;
}

.tire-card-score .score-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   6c. Tire Card EU Labels
   ========================================================================== */

.tire-card-eu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* ==========================================================================
   7. Tire Card Rating
   ========================================================================== */

.tire-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.tire-card-rating .star {
  color: #FBBF24;
}

.tire-card-rating .rating-value {
  font-weight: 600;
  color: var(--text-primary);
}

.tire-card-rating .rating-count {
  color: var(--text-muted);
  font-size: 12px;
}

/* ==========================================================================
   8. EU Mini Labels (inline badges in card)
   ========================================================================== */

.eu-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.eu-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.eu-mini svg,
.eu-mini img {
  width: 14px;
  height: 14px;
}

/* EU Mini Badge Color Grades */
.eu-fuel-a, .eu-wet-a {
  background-color: #00A651;
  color: #FFFFFF;
  border-color: #00A651;
}

.eu-fuel-b, .eu-wet-b {
  background-color: #4AB449;
  color: #FFFFFF;
  border-color: #4AB449;
}

.eu-fuel-c, .eu-wet-c {
  background-color: #F0E800;
  color: #1a1a1a;
  border-color: #F0E800;
}

.eu-fuel-d, .eu-wet-d {
  background-color: #FDB913;
  color: #1a1a1a;
  border-color: #FDB913;
}

.eu-fuel-e, .eu-wet-e {
  background-color: #F05A28;
  color: #FFFFFF;
  border-color: #F05A28;
}

.eu-fuel-f, .eu-wet-f {
  background-color: #E30613;
  color: #FFFFFF;
  border-color: #E30613;
}

.eu-fuel-g, .eu-wet-g {
  background-color: #C1272D;
  color: #FFFFFF;
  border-color: #C1272D;
}

/* ==========================================================================
   9. Card Actions
   ========================================================================== */

.tire-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tire-card-actions .btn-card {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms ease;
  border: none;
}

.tire-card-actions .btn-card-primary {
  background: var(--accent);
  color: var(--bg-white);
}

.tire-card-actions .btn-card-primary:hover {
  background: #BE123C;
}

.tire-card-actions .btn-card-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tire-card-actions .btn-card-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   10. Season Badge on Card
   ========================================================================== */

.tire-card-season {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 2;
}

.tire-card-season--summer {
  background: #FEF3C7;
  color: #92400E;
}

.tire-card-season--winter {
  background: #DBEAFE;
  color: #1E40AF;
}

.tire-card-season--all-season {
  background: #D1FAE5;
  color: #065F46;
}

/* ==========================================================================
   11. Archive Header
   ========================================================================== */

.archive-header {
  margin-bottom: 32px;
}

.archive-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.archive-count {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ==========================================================================
   12. Filters Bar
   ========================================================================== */

.filters-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  margin-bottom: 32px;
}

.filter-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group select,
.filter-group input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 200ms ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.filter-group select {
  padding-right: 32px;
  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='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.filter-reset {
  margin-left: auto;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.filter-reset:hover {
  text-decoration: underline;
}

/* ==========================================================================
   13. No Results
   ========================================================================== */

.no-results {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.no-results h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.no-results p {
  font-size: 15px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ==========================================================================
   14. Tire Detail Page
   ========================================================================== */

.tire-detail {
  padding: 48px 0;
}

.tire-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.tire-detail-left {
  position: sticky;
  top: 32px;
}

.tire-detail-right {
  /* Right column flows naturally */
}

.tire-image-wrapper {
  aspect-ratio: 1 / 1;
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}

.tire-image-wrapper img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
}

.tire-brand-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

.tire-detail-right h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 16px;
}

.tire-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.tire-meta-tags .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tire-section {
  margin-top: 40px;
}

.tire-section h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.tire-content {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.tire-content p {
  margin-bottom: 16px;
}

.tire-content ul,
.tire-content ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.tire-content li {
  margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   Sizes Table
   -------------------------------------------------------------------------- */

.sizes-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

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

.sizes-table thead {
  background: var(--bg-light);
}

.sizes-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.sizes-table td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sizes-table tbody tr:nth-child(even) {
  background: var(--bg-light);
}

.sizes-table tbody tr:hover {
  background: var(--accent-light);
}

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

/* ==========================================================================
   15. Brand Card (grid item)
   ========================================================================== */

.brand-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 250ms ease;
}

.brand-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.1);
}

.brand-card-logo {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.brand-card-logo img {
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
}

.brand-logo-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-light, rgba(225, 29, 72, 0.08));
  border-radius: inherit;
}

.brand-detail-logo .brand-logo-initial {
  font-size: 56px;
}

.brand-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-card-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-card-tier {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}

.brand-card-tier.tier-premium {
  background: #FEF3C7;
  color: #92400E;
}

.brand-card-tier.tier-mid-range {
  background: #DBEAFE;
  color: #1E40AF;
}

.brand-card-tier.tier-budget {
  background: #F1F5F9;
  color: #475569;
}

.brand-card-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   16. Brand Detail Page
   ========================================================================== */

.brand-detail {
  padding: 48px 0;
}

.brand-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.brand-logo-large {
  width: 200px;
  height: 200px;
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}

.brand-logo-large img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.brand-info h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}

.brand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.brand-meta-item svg,
.brand-meta-item img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.brand-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.brand-description p {
  margin-bottom: 16px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* 1024px - Tablet landscape */
@media (max-width: 1024px) {
  .tire-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .tire-detail-grid {
    gap: 32px;
  }

  .tire-detail-right h1 {
    font-size: 28px;
  }

  .brand-header {
    grid-template-columns: 160px 1fr;
    gap: 32px;
  }

  .brand-logo-large {
    width: 160px;
    height: 160px;
  }

  .brand-info h1 {
    font-size: 28px;
  }
}

/* 768px - Tablet portrait */
@media (max-width: 768px) {
  .tire-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .brand-card {
    padding: 16px;
    gap: 12px;
  }

  .brand-card-logo {
    width: 56px;
    height: 56px;
  }

  .brand-card-logo img {
    max-width: 44px;
    max-height: 44px;
  }

  .tire-detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .tire-detail-left {
    position: static;
  }

  .tire-image-wrapper {
    max-width: 400px;
    margin: 0 auto;
  }

  .tire-detail-right h1 {
    font-size: 24px;
  }

  .brand-header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .brand-logo-large {
    margin: 0 auto;
  }

  .brand-meta {
    justify-content: center;
  }

  .filter-form {
    gap: 8px;
  }

  .filter-group {
    flex: 1 1 auto;
    min-width: 140px;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .archive-header h1 {
    font-size: 24px;
  }
}

/* 640px - Mobile */
@media (max-width: 640px) {
  .tire-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tire-card:hover {
    transform: translateY(-2px);
  }

  .tire-card-image {
    height: 140px;
  }

  .tire-card-body {
    padding: 12px;
  }

  .tire-detail {
    padding: 24px 0;
  }

  .tire-detail-right h1 {
    font-size: 22px;
  }

  .tire-section h2 {
    font-size: 18px;
  }

  .brand-detail {
    padding: 24px 0;
  }

  .brand-logo-large {
    width: 120px;
    height: 120px;
  }

  .brand-info h1 {
    font-size: 24px;
  }

  .filters-bar {
    padding: 12px 0;
  }

  .filter-form {
    flex-direction: column;
    gap: 8px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .filter-reset {
    margin-left: 0;
    text-align: center;
  }

  .sizes-table th,
  .sizes-table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .tire-card-actions {
    flex-direction: column;
  }

  .no-results {
    padding: 48px 16px;
  }
}
