/* Avida Specifications Plugin Styles */

/* Main container styles */
.avida-comparison-tabs,
.avida-specifications-tabs {
  font-family: "Inter", Sans-serif;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
}

/* Tab navigation styles */
.avida-tabs-heading {
  display: flex;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Tab button styles */
.avida-tab-button {
  padding: 12px 24px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  margin-right: 5px;
  margin-bottom: 5px;
  transition: all 0.3s;
  font-family: "Inter", Sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  background: transparent;
  color: #333;
}

.avida-tab-button:hover:not(.avida-tab-active) {
  background: #10245a;
  color: #ffffff;
}

.avida-tab-button.avida-tab-active {
  color: #cc0033;
  background: transparent;
  border: 1px solid #c36;
}

/* Tab text styles */
.avida-tab-text {
  font-family: "Inter", Sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  color: #10245a;
  transition: color 0.3s;
}

.avida-tab-button:hover .avida-tab-text {
  color: #ffffff;
}

.avida-tab-button.avida-tab-active .avida-tab-text {
  color: #cc0033;
}

/* Tab content styles */
.avida-tab-content {
  display: none;
}

.avida-tab-content.avida-tab-active {
  display: block;
}

/* Table styles */
.avida-specs-table {
  width: 80%;
  border-collapse: collapse;
  margin-top: 20px;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-left: auto;
  margin-right: auto;
  table-layout: fixed;
}

.avida-comparison-layout,
.avida-comparison-tabs-mobile {
  width: 80%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Comparison Layout Styles */
.avida-comparison-layout {
  max-width: 1200px;
  margin: 0 auto;
}

.avida-comparison-selection {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.avida-comparison-results {
  margin-top: 30px;
}

.avida-comparison-results h4 {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
  border-left: 4px solid #0073aa;
}

/* Responsive grid for comparison selection */
@media (max-width: 768px) {
  .avida-comparison-selection .avida-column-1,
  .avida-comparison-selection .avida-column-2 {
    grid-template-columns: 1fr;
  }
}

/* Table header styles */
.avida-table-header {
  padding: 12px;
  background-color: #10245a;
  font-weight: bold;
  color: white;
  text-align: center;
  border-bottom: 1px solid #ddd;
  font-size: 15px;
  line-height: 1.2;
  white-space: normal;
  word-wrap: break-word;
  font-family: "Inter", Sans-serif;
}

.avida-table-header:first-child {
  text-align: left;
}

/* Remove the problematic rule that sets headers to right-align */
/* .avida-table-header:not(:first-child) {
  text-align: right;
} */

/* Table row styles */
.avida-table-row {
  border-bottom: 1px solid #ddd;
}

/* Table label styles */
.avida-table-label {
  padding: 12px;
  font-weight: bold;
  background-color: #f8f9fa;
  color: #333;
  font-size: 15px;
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
  max-width: 200px;
  font-family: "Inter", Sans-serif;
}

/* Table cell styles */
.avida-table-cell {
  padding: 12px;
  font-size: 15px;
  text-align: center;
  word-wrap: break-word;
  white-space: normal;
  max-width: 200px;
  color: #10245a;
  font-family: "Inter", Sans-serif;
}

/* Tabs content container */
.avida-tabs-content {
  position: relative;
  text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
  .avida-tabs-heading {
    flex-direction: column;
    align-items: center;
  }

  .avida-tab-button {
    margin-right: 0;
    margin-bottom: 10px;
    width: 100%;
    text-align: left;
  }

  .avida-specs-table {
    font-size: 14px;
  }

  .avida-table-header,
  .avida-table-label,
  .avida-table-cell {
    padding: 8px;
    font-size: 14px;
  }
}

/* Print styles */
@media print {
  .avida-tab-button {
    display: none;
  }

  .avida-tab-content {
    display: block !important;
    page-break-inside: avoid;
  }

  .avida-specs-table {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Mobile-responsive comparison table styles */
.avida-comparison-tabs-mobile {
  margin-top: 20px;
}

.avida-table-container {
  position: relative;
  margin: 20px 0;
}

.avida-table-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.avida-table-scroll-wrapper::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.avida-specs-table-mobile {
  width: 100%;
  min-width: 520px; /* Slightly smaller for tighter mobile fit */
  border-collapse: collapse;
  margin: 0;
  transition: opacity 0.2s ease-in-out; /* Smooth opacity transition for loading states */
}

.avida-specs-table-mobile th,
.avida-specs-table-mobile td {
  padding: 12px 8px;
  text-align: center;
  border-bottom: 1px solid #ddd;
  white-space: normal;
  word-wrap: break-word; /* legacy */
  overflow-wrap: anywhere; /* better wrap for long model names */
  word-break: break-word;
  min-width: 120px;
  max-width: 200px;
  vertical-align: middle;
  color: #10245a;
  font-family: "Inter", Sans-serif;
}

.avida-specs-table-mobile th:first-child,
.avida-specs-table-mobile td:first-child {
  position: sticky;
  left: 0;
  background: #f8f9fa;
  z-index: 3;
  min-width: 120px;
  max-width: 100px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  text-align: left;
}
.avida-specs-table-mobile th:first-child,
.avida-specs-table-mobile td:first-child {
  padding: 10px 8px;
}

/* Constrain non-first columns a bit more on mobile to avoid overflow
   for long model names like Silverton */
.avida-specs-table-mobile th:not(:first-child),
.avida-specs-table-mobile td:not(:first-child) {
  min-width: 90px;
  max-width: 120px;
}

.avida-specs-table-mobile th {
  background: #10245a;
  color: white;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  word-wrap: break-word;
}

.avida-specs-table-mobile th:first-child {
  background: #10245a;
  color: white;
  text-align: left;
  top: auto; /* Override vertical sticky - only stick horizontally */
}

/* Touch/swipe indicators */
.avida-table-scroll-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.avida-table-scroll-wrapper.has-more::after {
  opacity: 1;
}

/* Smooth scrolling for better mobile experience */
.avida-table-scroll-wrapper {
  scroll-behavior: smooth;
}

/* Loading state */
.avida-table-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-family: "Inter", Sans-serif;
}

/* Error state */
.avida-table-error {
  text-align: center;
  padding: 40px;
  color: #dc3545;
  font-family: "Inter", Sans-serif;
}

/* Mobile dropdown styles */
.avida-mobile-dropdown {
  display: none;
  margin: 20px 0;
  text-align: center;
  padding: 0 20px;
}

.avida-category-dropdown {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  border: 2px solid #10245a;
  border-radius: 0;
  background-color: #fff;
  color: #10245a;
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%2310245a' d='M6 8L0 2h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 50px;
  box-shadow: 0 2px 8px rgba(16, 36, 90, 0.1);
  transition: all 0.3s ease;
  margin: 0 auto;
  max-width: 300px;
  height: auto;
}

.avida-category-dropdown:focus {
  outline: none;
  border-color: #cc0033;
  box-shadow: 0 0 0 3px rgba(204, 0, 51, 0.2);
  transform: translateY(-1px);
}

.avida-category-dropdown:hover {
  border-color: #cc0033;
  box-shadow: 0 4px 12px rgba(16, 36, 90, 0.15);
  transform: translateY(-1px);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  /* Hide desktop tabs on mobile */
  .avida-desktop-tabs,
  .avida-tabs-heading:not(.avida-mobile-dropdown) {
    display: none !important;
  }

  /* Show mobile dropdown on mobile */
  .avida-mobile-dropdown {
    display: block !important;
  }

  /* Hide all tab buttons on mobile */
  .avida-tab-button {
    display: none !important;
  }

  /* Adjust table container for mobile */
  .avida-table-container {
    margin: 0 -15px;
  }

  /* Improve mobile table scrolling */
  .avida-table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Desktop styles */
@media (min-width: 769px) {
  /* Show desktop tabs on desktop */
  .avida-desktop-tabs {
    display: flex !important;
  }

  /* Hide mobile dropdown on desktop */
  .avida-mobile-dropdown {
    display: none !important;
  }
}

/* Two-column comparison layout styles */
.avida-two-column-comparison {
  margin: 30px 0;
  font-family: "Inter", Sans-serif;
}

.avida-comparison-header {
  text-align: center;
  margin-bottom: 30px;
}

.avida-comparison-header h3 {
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  color: #10245a;
  margin: 0;
  font-size: 24px;
}

.avida-comparison-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.avida-comparison-left-column,
.avida-comparison-right-column {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avida-comparison-column-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #10245a;
}

.avida-comparison-column-header h4 {
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  color: #10245a;
  margin: 0 0 10px 0;
  font-size: 18px;
}

.avida-comparison-column-header label {
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  color: #10245a;
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.avida-vehicle-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #10245a;
  border-radius: 4px;
  background-color: #fff;
  color: #10245a;
  font-family: "Inter", Sans-serif;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%2310245a' d='M6 8L0 2h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 50px;
  transition: all 0.3s ease;
}

.avida-vehicle-select:hover {
  border-color: #cc0033;
  box-shadow: 0 2px 8px rgba(16, 36, 90, 0.1);
}

.avida-vehicle-select:focus {
  outline: none;
  border-color: #cc0033;
  box-shadow: 0 0 0 3px rgba(204, 0, 51, 0.2);
}

.avida-vehicle-specs-container {
  margin-top: 20px;
  min-height: 200px;
}

.avida-single-vehicle-specs {
  margin-top: 15px;
}

.avida-single-specs-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.avida-single-specs-table th,
.avida-single-specs-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.avida-single-specs-table th {
  background-color: #10245a;
  color: white;
  font-weight: bold;
}

.avida-comparison-table-container {
  margin-top: 30px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avida-comparison-table-wrapper {
  margin-top: 20px;
}

/* Responsive design for two-column layout */
@media (max-width: 768px) {
  .avida-comparison-columns {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .avida-comparison-left-column,
  .avida-comparison-right-column {
    padding: 15px;
  }

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

  .avida-comparison-column-header h4 {
    font-size: 16px;
  }
}

/* Unified comparison table styles */
.avida-unified-comparison-table {
  margin: 30px 0;
  font-family: "Inter", Sans-serif;
}

.avida-vehicle-header-dropdown {
  padding: 8px !important;
  vertical-align: middle;
}

.avida-vehicle-header-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  font-size: 13px;
  color: #10245a;
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%2310245a' d='M6 8L0 2h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  cursor: pointer;
  text-align: center;
}

.avida-vehicle-header-select:focus {
  outline: none;
  border-color: #10245a;
  box-shadow: 0 0 0 2px rgba(16, 36, 90, 0.25);
}

.avida-vehicle-header-select:hover {
  border-color: #10245a;
}

/* Add/Remove column buttons */
.avida-column-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 5px;
}

.avida-add-column-btn,
.avida-remove-column-btn {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #10245a;
  border-radius: 3px;
  background-color: #fff;
  color: #10245a;
  cursor: pointer;
  font-family: "Inter", Sans-serif;
  font-weight: 600;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.avida-add-column-btn:hover {
  background-color: #10245a;
  color: #fff;
}

.avida-remove-column-btn:hover {
  background-color: #cc0033;
  border-color: #cc0033;
  color: #fff;
}

.avida-add-column-btn:disabled,
.avida-remove-column-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive for unified table */
@media (max-width: 768px) {
  .avida-vehicle-header-select {
    font-size: 11px;
    padding: 6px 10px;
    background-size: 8px;
  }

  .avida-unified-comparison-table .avida-table-header {
    font-size: 12px;
    padding: 8px 4px;
  }
}

/* Category header rows in unified table */
.avida-category-header-row {
  background-color: #999999 !important;
}

.avida-category-header-row td,
.avida-category-header-row .avida-category-header {
  background-color: #999999 !important;
}

.avida-category-header {
  font-weight: 700;
  font-size: 16px;
  color: #ffffff !important;
  padding: 12px 15px !important;
  border-bottom: 2px solid #10245a;
  font-family: "Inter", Sans-serif;
  text-transform: uppercase;
  background-color: #999999 !important;
}

/* Make category headers sticky on mobile */
@media (max-width: 768px) {
  /* Ensure table container allows sticky positioning */
  .avida-table-container {
    position: relative;
  }

  .avida-category-header-row {
    background-color: #999999 !important;
  }

  .avida-category-header-row td,
  .avida-category-header-row .avida-category-header {
    background-color: #999999 !important;
    color: #ffffff !important;
  }

  /* CSS fallback for sticky - may not work with colspan, so JavaScript handles it */
  .avida-specs-table-mobile
    tbody
    .avida-category-header-row
    .avida-category-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 50px !important;
    z-index: 100 !important;
    background-color: #999999 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  }

  /* Prevent first column category header cells from sticking vertically */
  /* Category headers span all columns, so the first-child cell should only stick horizontally */
  .avida-specs-table-mobile
    tbody
    .avida-category-header-row
    td:first-child.avida-category-header,
  .avida-specs-table-mobile
    tbody
    .avida-category-header-row
    td:first-child {
    top: auto !important; /* Override vertical sticky - only stick horizontally */
  }

  /* Ensure parent elements don't interfere */
  .avida-specs-table-mobile tbody {
    position: relative;
  }

  .avida-category-header-row {
    position: relative;
    background-color: #999999 !important;
  }

  /* Ensure table header stays above category headers */
  .avida-specs-table-mobile thead th {
    position: sticky;
    top: 0;
    z-index: 101;
  }

  .avida-specs-table-mobile thead th:first-child {
    z-index: 102;
  }
}
