/* === Core Layout === */
.ecu-recommender-wrapper {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 100%;
  padding: 20px;
  box-sizing: border-box;
}
@media (min-width: 768px) {
  .ecu-recommender-wrapper {
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    max-width: 1100px;
    margin: 0 auto;
  }
  #ecu-recommender-form {
    flex: 0 0 500px;
    margin-right: 40px;
  }
}

/* === Form Styles === */
#ecu-recommender-form {
  background: #2a2f38;
  border: 1px solid #444;
  padding: 20px;
  border-radius: 10px;
  color: #ffffff;
  box-sizing: border-box;
}
.form-group {
  margin-bottom: 15px;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.label-row label {
  font-weight: bold;
  flex-grow: 1;
  margin: 0;
  color: #ffffff;
}
.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  background-color: #ffffff;
  color: #000000;
}
.info-icon {
  background: #ef1820;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 14px;
  text-align: center;
  line-height: 20px;
  cursor: pointer;
  margin-left: 10px;
  flex-shrink: 0;
}
.info-box {
  display: none;
  background: #262a32;
  border: 1px solid #444;
  padding: 10px;
  margin-top: 4px;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1.4;
  color: #ffffff;
}
#ecu-recommender-form button[type="submit"] {
  background-color: #ef1820;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 5px;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}
#ecu-recommender-form button[type="submit"]:hover {
  background-color: #c9141a;
}

/* === Results Styles === */
#ecu-results {
  padding: 25px;
  background: #21252c;
  border: 2px solid #ef1820;
  border-radius: 10px;
  font-size: 15px;
  color: #ffffff;
  min-height: 150px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
#ecu-results h3,
#ecu-results h4,
#ecu-results p {
  color: #ffffff;
  margin-bottom: 10px;
}
#ecu-results a {
  color: #ef1820;
  text-decoration: underline;
}
.ecu-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.ecu-results-header h3 {
  margin: 0;
  font-size: 22px;
}
.asd-logo {
  max-height: 40px;
  width: auto;
}

/* === Table Styles === */
.ecu-comparison {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 14px;
  font-family: Arial, sans-serif;
}
.ecu-comparison th {
  background: #21252c;
  color: #ffffff;
  padding: 10px;
  text-align: left;
}
.ecu-comparison td {
  padding: 8px 10px;
  border: 1px solid #444;
  color: #ffffff;
  background: #2a2f38;
}
.ecu-comparison tr:nth-child(even) td {
  background: #262a32;
}
.cell-extra {
  background-color: #285f37 !important;
  color: #ffffff;
}
.cell-tight {
  background-color: #7f6a00 !important;
  color: #ffffff;
}
.cell-over {
  background-color: #ef1820 !important;
  color: #ffffff;
}

/* === Export Button === */
.print-btn {
  background: #21252c;
  color: white;
  padding: 10px 16px;
  margin: 20px 0;
  font-size: 14px;
  border: 2px solid #ef1820;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.3s ease;
}
.print-btn:hover {
  background: #ef1820;
}

/* === Download Chart Section === */
.comparison-download {
  margin-top: 25px;
  background-color: #262a32;
  border: 1px solid #444;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}
.comparison-download p {
  margin: 0 0 10px;
  font-size: 15px;
  color: #ffffff;
}
.download-chart {
  display: inline-block;
  background-color: #ef1820;
  color: #ffffff !important;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 5px;
  text-decoration: none !important;
  transition: background 0.3s ease;
  border: 1px solid transparent;
}
.download-chart:hover {
  background-color: #c9141a;
  border-color: #ef1820;
}

/* === PDF Export Specific === */
.pdf-exporting .ecu-results-page {
  page-break-inside: avoid;
  padding: 20px;
  margin-bottom: 30px;
}
.page-break {
  page-break-before: always;
}
.pdf-exporting .ecu-comparison td,
.pdf-exporting .ecu-comparison th {
  color: #000 !important;
  background: #fff !important;
}
.pdf-exporting .ecu-results-header h3 {
  color: #000;
}
.pdf-exporting .ecu-results-header {
  border-bottom: 2px solid #ef1820;
}
.pdf-exporting .cell-over {
  background-color: #ef1820 !important;
  color: #fff !important;
}
.pdf-exporting .cell-tight {
  background-color: #ffae00 !important;
  color: #fff !important;
}
.pdf-exporting .cell-extra {
  background-color: #4caf50 !important;
  color: #fff !important;
}
.pdf-exporting .asd-logo {
  max-height: 40px;
  width: auto;
  margin-left: auto;
  filter: none !important;
}

/* Hide UI elements from PDF */
.pdf-exporting .print-btn,
.pdf-exporting .download-chart,
.pdf-exporting .share-link-box,
.pdf-exporting .asd-branding {
  display: none !important;
}

/* Correct link positioning for PDF */
.pdf-exporting a {
  position: relative;
  z-index: 1;
}

/* === Results Section Branding Fix === */
.asd-branding {
  text-align: center;
  margin-top: 30px;
  font-size: 13px;
  color: #888;
  font-style: italic;
}

/* === Maintain Styling in PDF Export (Match Live View) === */
.pdf-exporting #ecu-results {
  background: #21252c !important;
  border: 2px solid #ef1820 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3) !important;
  padding: 25px !important;
}

.pdf-exporting .ecu-results-page {
  background: none !important;
  margin-bottom: 30px;
  padding: 0 !important;
  page-break-inside: avoid;
}
.page-break {
  page-break-before: always;
}

/* Table colors restored for PDF */
.pdf-exporting .ecu-comparison {
  background: #2a2f38 !important;
}
.pdf-exporting .ecu-comparison th {
  background: #21252c !important;
  color: #ffffff !important;
}
.pdf-exporting .ecu-comparison td {
  background: #2a2f38 !important;
  color: #ffffff !important;
  border: 1px solid #444 !important;
}
.pdf-exporting .ecu-comparison tr:nth-child(even) td {
  background: #262a32 !important;
}

/* Cell highlights maintained */
.pdf-exporting .cell-over {
  background-color: #ef1820 !important;
  color: #ffffff !important;
}
.pdf-exporting .cell-tight {
  background-color: #7f6a00 !important;
  color: #ffffff !important;
}
.pdf-exporting .cell-extra {
  background-color: #285f37 !important;
  color: #ffffff !important;
}

/* Logo Styling */
.pdf-exporting .asd-logo {
  max-height: 40px;
  width: auto;
  filter: brightness(0) invert(1) !important;
  margin-left: auto;
}

/* Hide buttons and non-export UI */
.pdf-exporting .print-btn,
.pdf-exporting .download-chart,
.pdf-exporting .share-link-box {
  display: none !important;
}

/* Ensure links render properly */
.pdf-exporting a {
  display: inline-block;
  position: relative;
  bottom: 0px; /* or try 4px if needed */
  z-index: 1;
  color: #ef1820 !important;
  text-decoration: underline !important;
}

.pdf-exporting a span {
  position: relative;
  top: 0;
}

.pdf-exporting .download-chart {
  color: #ef1820 !important;
  text-decoration: underline !important;
  background: none !important;
  border: none !important;
  padding: 0;
  font-weight: normal;
  font-size: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
}

.share-feedback {
  display: none;
  font-size: 14px;
  color: #4caf50;
  font-weight: bold;
}

/* === ASD Logo fix === */
.asd-logo {
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (max-width: 767px) {
  .ecu-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .asd-logo {
    max-height: 30px;
    max-width: 140px;
    align-self: flex-start;
  }
}

/* === Make ECU comparison tables responsive === */
.ecu-comparison-wrapper {
  overflow-x: auto;
  width: 100%;
}

.ecu-comparison {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Optional - fix cells wrapping weirdly */
.ecu-comparison td,
.ecu-comparison th {
  white-space: nowrap;
}

/* === Fix Download Chart button on mobile === */
.download-chart {
  display: inline-block;
  background-color: #ef1820;
  color: #ffffff !important;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 5px;
  text-decoration: none !important;
  transition: background 0.3s ease;
  border: 1px solid transparent;
  text-align: center;
}

.download-chart:hover {
  background-color: #c9141a;
  border-color: #ef1820;
}

/* Responsive alignment for the download block */
.comparison-download {
  text-align: center;
}

@media (max-width: 767px) {
  .download-chart {
    display: block;
    width: 100%;
  }
}

/* === 1. Logo and Title inline fix === */
.ecu-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ecu-results-header h3 {
  margin: 0;
  font-size: 22px;
  color: #ffffff;
  flex: 1;
}

.asd-logo {
  max-height: 36px;
  width: auto;
  object-fit: contain;
  margin-left: 20px;
}

/* Mobile: stack logo and title neatly */
@media (max-width: 767px) {
  .ecu-results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .asd-logo {
    margin-left: 0;
    align-self: flex-start;
  }
}

/* === 2. Table overflow fix === */
.ecu-comparison-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; /* Firefox */
  width: 100%;
  padding-bottom: 10px;
}

.ecu-comparison-wrapper::-webkit-scrollbar {
  height: 8px;
}

.ecu-comparison-wrapper::-webkit-scrollbar-thumb {
  background: #ef1820;
  border-radius: 4px;
}

.ecu-comparison-wrapper::-webkit-scrollbar-track {
  background: #2a2f38;
}

.ecu-comparison {
  min-width: 600px; /* force scroll if small screen */
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Prevent weird wrapping */
.ecu-comparison td,
.ecu-comparison th {
  white-space: nowrap;
}

/* === 3. Download Chart Button fix === */
.download-chart {
  display: inline-block;
  background-color: #ef1820;
  color: #ffffff !important;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 5px;
  text-decoration: none !important;
  transition: background 0.3s ease;
  border: 1px solid transparent;
  text-align: center;
  max-width: 260px;
  width: 100%;
  box-sizing: border-box;
}

.download-chart:hover {
  background-color: #c9141a;
  border-color: #ef1820;
}

.comparison-download {
  text-align: center;
  padding-top: 10px;
}

@media (max-width: 767px) {
  .download-chart {
    width: 100%;
    max-width: 100%;
  }
}

/* @media (max-width: 767px) {
  #ecu-recommender-form .sticky-submit {
    position: fixed;
    bottom: 15px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    background-color: #ef1820;
    color: #fff;
    border: none;
    padding: 14px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    max-width: calc(100% - 20px);
    box-sizing: border-box;
  }

  body {
    padding-bottom: 90px;
  }
} */

/* @media (max-width: 767px) {
  .sticky-submit {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
  }

  .sticky-submit.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
} */

.input-wrapper input:invalid,
.input-wrapper select:invalid {
  border-color: #ef1820;
  box-shadow: 0 0 0 1px #ef1820;
}

.input-wrapper input:focus:invalid,
.input-wrapper select:focus:invalid {
  outline: none;
}

.validation-error {
  color: #ef1820;
  font-size: 13px;
  margin-top: -10px;
  margin-bottom: 10px;
  display: none;
}
