/* ============================================
   E-SCOOTER GUIDE - Component Styles
   Reusable UI Components
   ============================================ */

/* ============================================
   COMPARISON TABLE
   ============================================ */

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.comparison-table thead {
  background: var(--carbon-black);
  color: #fff;
}

.comparison-table th {
  padding: 20px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.comparison-table th:hover {
  background: #2d2d2d;
}

.comparison-table th.sortable {
  position: relative;
  padding-right: 32px;
}

.comparison-table th.sortable::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.5);
}

.comparison-table th.sortable.asc::after {
  border-top: none;
  border-bottom: 5px solid #fff;
}

.comparison-table th.sortable.desc::after {
  border-top: 5px solid #fff;
}

.comparison-table tbody tr {
  border-bottom: 1px solid var(--card-border);
  transition: background var(--transition-fast);
}

.comparison-table tbody tr:hover {
  background: var(--ultra-light-bg);
}

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

.comparison-table td {
  padding: 20px 16px;
  font-size: 15px;
  color: var(--text-secondary);
}

.comparison-table td:first-child {
  font-weight: 600;
  color: var(--carbon-black);
}

.comparison-table .product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comparison-table .product-thumb {
  width: 48px;
  height: 48px;
  background: var(--ultra-light-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-table .product-thumb svg {
  width: 24px;
  height: 24px;
  color: var(--icon-grey);
}

/* Apple-style striped table */
.table-striped tbody tr:nth-child(odd) {
  background: var(--ultra-light-bg);
}

.table-striped tbody tr:nth-child(odd):hover {
  background: var(--card-border);
}

/* ============================================
   FILTER BAR
   ============================================ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

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

.filter-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.filter-select {
  padding: 10px 36px 10px 14px;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--carbon-black);
  background: var(--ultra-light-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 150px;
  transition: all var(--transition-fast);
}

.filter-select:hover {
  border-color: var(--icon-grey);
}

.filter-select:focus {
  outline: none;
  border-color: var(--electric-blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

/* Search Input */
.search-container {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--carbon-black);
  background: var(--ultra-light-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--electric-blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
  background: #fff;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--icon-grey);
}

/* Filter Tags */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--electric-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: 100px;
}

.filter-tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
}

.filter-tag button:hover {
  opacity: 0.7;
}

/* ============================================
   INFO BOXES
   ============================================ */

.info-box {
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.info-box.info {
  background: rgba(10, 132, 255, 0.08);
  border-left: 4px solid var(--electric-blue);
}

.info-box.success {
  background: rgba(10, 207, 131, 0.08);
  border-left: 4px solid var(--neo-green);
}

.info-box.warning {
  background: rgba(255, 149, 0, 0.08);
  border-left: 4px solid var(--cta-orange);
}

.info-box.danger {
  background: rgba(239, 68, 68, 0.08);
  border-left: 4px solid #EF4444;
}

.info-box-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.info-box-header svg {
  width: 24px;
  height: 24px;
}

.info-box-header h4 {
  font-size: 16px;
  font-weight: 600;
}

.info-box p {
  font-size: 15px;
  margin: 0;
  color: var(--text-secondary);
}

/* ============================================
   TABS
   ============================================ */

.tabs-container {
  margin-bottom: 32px;
}

.tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--ultra-light-bg);
  padding: 4px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 12px 24px;
  font-family: var(--font-primary);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--carbon-black);
}

.tab-btn.active {
  background: #fff;
  color: var(--carbon-black);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   ACCORDION
   ============================================ */

.accordion {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--card-border);
}

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

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  color: var(--carbon-black);
  background: #fff;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.accordion-header:hover {
  background: var(--ultra-light-bg);
}

.accordion-icon {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-fast);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.accordion-content-inner {
  padding: 0 24px 24px;
  color: var(--text-secondary);
}

/* ============================================
   CARDS GRID - Side by Side Comparison
   ============================================ */

.comparison-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.comparison-card {
  background: #fff;
  border: 2px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  transition: all var(--transition-normal);
}

.comparison-card:hover {
  border-color: var(--neo-green);
  box-shadow: var(--shadow-lg);
}

.comparison-card.selected {
  border-color: var(--neo-green);
  box-shadow: 0 0 0 4px rgba(10, 207, 131, 0.1);
}

.comparison-card-header {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 24px;
}

.comparison-card-image {
  width: 120px;
  height: 120px;
  background: var(--ultra-light-bg);
  border-radius: var(--radius-lg);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-card-header h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.comparison-card-header .brand {
  font-size: 13px;
  color: var(--text-muted);
}

.comparison-card-specs {
  list-style: none;
}

.comparison-card-specs li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 14px;
}

.comparison-card-specs li:last-child {
  border-bottom: none;
}

.comparison-card-specs .spec-label {
  color: var(--text-muted);
}

.comparison-card-specs .spec-value {
  font-weight: 600;
  color: var(--carbon-black);
}

.comparison-card-footer {
  margin-top: 24px;
  text-align: center;
}

.comparison-card-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--carbon-black);
  margin-bottom: 16px;
}

/* ============================================
   RATING STARS
   ============================================ */

.rating {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rating-star {
  width: 16px;
  height: 16px;
  color: var(--card-border);
}

.rating-star.filled {
  color: var(--cta-orange);
}

.rating-star.half {
  background: linear-gradient(90deg, var(--cta-orange) 50%, var(--card-border) 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rating-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--card-border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neo-green), var(--electric-blue));
  border-radius: 100px;
  transition: width var(--transition-slow);
}

/* ============================================
   TOOLTIP
   ============================================ */

.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 12px;
  background: var(--carbon-black);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--carbon-black);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   BADGE
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 100px;
}

.badge-primary {
  background: var(--neo-green);
  color: #fff;
}

.badge-secondary {
  background: var(--electric-blue);
  color: #fff;
}

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

.badge-at {
  background: #DC2626;
  color: #fff;
}

.badge-de {
  background: #1A1A1A;
  color: #FFD700;
}

/* ============================================
   SPEC LIST
   ============================================ */

.spec-list {
  list-style: none;
}

.spec-list li {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--card-border);
}

.spec-list li:last-child {
  border-bottom: none;
}

.spec-list .spec-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ultra-light-bg);
  border-radius: var(--radius-md);
  margin-right: 16px;
}

.spec-list .spec-icon svg {
  width: 20px;
  height: 20px;
  color: var(--electric-blue);
}

.spec-list .spec-info {
  flex: 1;
}

.spec-list .spec-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spec-list .spec-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--carbon-black);
}

/* ============================================
   SLIDER / RANGE INPUT
   ============================================ */

.range-slider {
  width: 100%;
  appearance: none;
  height: 6px;
  background: var(--card-border);
  border-radius: 100px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--neo-green);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--neo-green);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ============================================
   STICKY HEADER (for tables)
   ============================================ */

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
}

/* Ensure table rows have scroll margin to account for sticky header */
.comparison-table tbody tr {
  scroll-margin-top: calc(var(--header-height) + 60px);
}

/* Ensure the sticky header has a solid background */
.sticky-header th {
  background: inherit;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--card-border);
  border-top-color: var(--neo-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ============================================
   BREADCRUMB
   ============================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 24px;
}

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

.breadcrumb a:hover {
  color: var(--neo-green);
}

.breadcrumb span {
  color: var(--icon-grey);
}

.breadcrumb .current {
  color: var(--text-secondary);
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
  padding: 140px 0 60px;
  background: linear-gradient(135deg, var(--ultra-light-bg) 0%, #fff 100%);
  text-align: center;
}

.page-header h1 {
  margin-bottom: 16px;
}

.page-header p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */

.content-section {
  max-width: 800px;
  margin: 0 auto;
}

.content-section h2 {
  margin-top: 48px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.content-section h3 {
  margin-top: 32px;
  margin-bottom: 16px;
}

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

.content-section ul,
.content-section ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.content-section li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ============================================
   FEATURE GRID
   ============================================ */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 32px 0;
}

.feature-item {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: var(--ultra-light-bg);
  border-radius: var(--radius-lg);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
  color: var(--neo-green);
}

.feature-content h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.feature-content p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   COUNTRY COMPARISON
   ============================================ */

.country-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin: 32px 0;
}

.country-card {
  padding: 32px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
}

.country-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}

.country-flag {
  font-size: 32px;
}

.country-name {
  font-size: 20px;
  font-weight: 600;
}

.country-rules {
  list-style: none;
}

.country-rules li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
}

.country-rules li:last-child {
  border-bottom: none;
}

.country-rules li svg {
  width: 20px;
  height: 20px;
  color: var(--neo-green);
  flex-shrink: 0;
  margin-top: 2px;
}

.country-rules li span {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  background: #fff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 20px;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ultra-light-bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: var(--card-border);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 150px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 24px;
  border-top: 1px solid var(--card-border);
}