/* ── NGG Bearing Finder – Frontend Widget Styles ─────────────────────────────
   Scoped under .ngg-widget so nothing bleeds into the host theme.
   ─────────────────────────────────────────────────────────────────────────── */

.ngg-widget {
  /* ── Palette – mirrors spindle-wizard CSS custom properties ── */
  --ngg-text: #111827;
  --ngg-bg: #f6f7fb;
  --ngg-blue: #0f2b5b; /* --accent-blue         */
  --ngg-accent: #146ddb; /* --accent-bright-blue  */
  --ngg-red: #e40223; /* --accent-bright-red   */
  --ngg-bg: #ececf4; /* --light-grey-100      */
  --ngg-surface: #d6d6dc; /* --light-grey-200      */
  --ngg-muted: #74747d; /* --dark-grey           */
  --ngg-border: #d6d6dc; /* --light-grey-200      */
  --ngg-card: #ffffff;
  --ngg-green: rgb(236, 243, 253); /* best-match highlight  */
  --ngg-match-blue: rgba(1, 191, 244, 0.5); /* best-match highlight  */

  --popular-choice-blue: #01c0f4;
  --light-grey-100: hsl(240, 27%, 94%);
  --light-grey-200: #d6d6dc;
  --medium-grey: #9999a5;
  --dark-grey: #74747d;

  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ngg-text);
  box-sizing: border-box;
  max-width: 800px;

  margin: 0 auto;
}

.ngg-widget *,
.ngg-widget *::before,
.ngg-widget *::after {
  box-sizing: inherit;
}

.ngg-widget__brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--ngg-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-left: 4px solid var(--ngg-red);
  padding-left: 8px;
  width: fit-content;
}

.ngg-widget__title {
  font-size: 38px;
  font-weight: 600;
  margin: 0 0 25px;
  color: var(--ngg-blue);
  font-family: "Oswald", sans-serif;
}

/* Card */
.ngg-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--light-grey-200);
  background-image: linear-gradient(
    315deg,
    var(--medium-grey) 0%,
    var(--light-grey-200) 74%
  );
  border-radius: 14px;
  padding: 2rem 1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--dark-grey);
  margin-bottom: 16px;
}

/* Grid */
.ngg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 680px) {
  .ngg-grid {
    grid-template-columns: 1fr;
  }
}

/* Labels & inputs */
.ngg-label {
  display: block;
  font-size: 16px;
  color: #5b5b64;
  margin-bottom: 4px;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Info tooltip icon */
.ngg-info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: middle;
  cursor: default;
}

.ngg-info-tip .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  color: var(--ngg-dark-grey);
  opacity: 0.75;
  transition: opacity 0.15s;
}

.ngg-info-tip:hover .dashicons,
.ngg-info-tip:focus-within .dashicons {
  opacity: 1;
}

.ngg-info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  background: var(--ngg-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: normal;
  z-index: 10;
}

/* Arrow */
.ngg-info-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--ngg-blue);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.ngg-info-tip:hover::after,
.ngg-info-tip:hover::before,
.ngg-info-tip:focus-within::after,
.ngg-info-tip:focus-within::before {
  opacity: 1;
}

input[type="text"].ngg-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--dark-grey);
  border-radius: 5px;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  background: #fff;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

input[type="text"].ngg-input::placeholder {
  color: var(--ngg-muted);
  font-family: "Inter", sans-serif;
}

.ngg-input:focus {
  outline: none;
  border-color: var(--ngg-blue);
  box-shadow: 0 0 0 3px rgba(0, 64, 121, 0.15);
}

/* Tolerance row */
.ngg-tolerance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ngg-tolerance-label {
  white-space: nowrap;
  margin: 0;
}

.ngg-tolerance-val {
  font-weight: 700;
  color: var(--ngg-blue);
  min-width: 2.5ch;
  display: inline-block;
}

.ngg-tolerance-slider {
  flex: 1;
  max-width: 200px;
  accent-color: var(--ngg-blue);
  cursor: pointer;
}

/* Buttons */
.ngg-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ngg-btn {
  padding: 13px 20px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

.ngg-btn:hover {
  opacity: 0.85;
}
.ngg-btn:active {
  opacity: 0.7;
}
.ngg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ngg-btn-search {
  background: var(--ngg-blue);
  color: #fff;
}

.ngg-btn-search:active,
.ngg-btn-search:hover {
  background: var(--ngg-accent);
  color: #fff;
}

.ngg-btn--primary {
  background: var(--ngg-blue);
  color: #fff;
}
.ngg-btn--secondary {
  background: #fff;
  border: 1px solid var(--ngg-border);
  color: var(--ngg-text);
}

@media (max-width: 580px) {
  .ngg-actions .ngg-btn {
    width: 100%;
  }
}

/* Status */
.ngg-status {
  font-size: 14px;
  color: var(--ngg-dark-grey);
  margin-top: 6px;
  min-height: 1em;
}

/* Results */
.ngg-results-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--ngg-border);
  overflow: hidden;
  margin-bottom: 16px;
}

.ngg-table-wrap {
  overflow-x: auto;
}

.ngg-results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.ngg-results-table thead th {
  background: #f1f1f1;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--ngg-border);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.ngg-results-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

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

.ngg-results-table tbody tr.ngg-best-match:hover {
  background: var(--ngg-green);
}

.ngg-empty {
  padding: 24px;
  text-align: center;
  color: var(--ngg-muted);
}

.ngg-view-more-wrap {
  padding: 14px;
  text-align: center;
  background: #fff;
  border-top: 1px solid var(--ngg-border);
}

.ngg-view-more {
  background: #fff;
  color: var(--ngg-blue);
  border: 1px solid var(--ngg-border);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

.ngg-view-more:hover {
  background: #f9fafb;
  color: var(--ngg-blue);
}

/* Gauge image */
.ngg-gauge-wrap {
  margin-top: 2rem;
  text-align: center;
}

.ngg-gauge-btn {
  display: block;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  background: none;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0;
  cursor: zoom-in;
  position: relative;
  transition: border-color 0.2s;
}

.ngg-gauge-btn:focus,
.ngg-gauge-btn:active,
.ngg-gauge-btn:hover,
.ngg-gauge-btn:focus-visible {
  background-color: rgba(20, 110, 219, 0.3) !important;
  outline: none;
}

.ngg-gauge-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

.ngg-gauge-hint {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--ngg-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: "Inter", sans-serif;
}

.ngg-gauge-btn:hover .ngg-gauge-hint,
.ngg-gauge-btn:focus-visible .ngg-gauge-hint {
  color: var(--ngg-blue);
}

/* Modal lightbox */
.ngg-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ngg-modal--open {
  display: flex;
}

.ngg-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  cursor: zoom-out;
}

.ngg-modal__box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  width: min(90vw, 1100px);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ngg-modal__img {
  width: 100%;
  max-height: calc(90vh - 64px);
  height: auto;
  display: block;
  object-fit: contain;
}

.ngg-modal__close {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  top: 10px;
  right: 10px;
  background: var(--ngg-red);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0 0 2px 0;
  color: #fff;
  aspect-ratio: 1 / 1;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

/* Prevent body scroll while modal is open */
body.ngg-modal-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .ngg-widget__title {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .ngg-widget__title {
    font-size: 28px;
  }

  .ngg-card {
    padding: 1rem 10px;
    border-radius: 10px;
  }

  .ngg-gauge-wrap {
    margin-top: 1.5rem;
    text-align: center;
  }

  .ngg-gauge-btn {
    border-radius: 5px;
  }

  .ngg-gauge-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
  }

  .ngg-gauge-img {
    border-radius: 5px;
  }

  .ngg-results-table {
    min-width: 250px;
  }

  .ngg-results-table thead th {
    padding: 14px 10px;
  }

  .ngg-results-table tbody td {
    padding: 14px 10px;
  }

  .page-id-4328 #content,
  .page-id-4141 #content {
    padding-inline: 10px;
  }
}
