/* ==========================================================================
   Param Helper — помощник за избор на параметри в калкулатори
   ========================================================================== */

.param-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--color-accent-gold, #c9a961);
  background: #fff8e6;
  color: var(--color-accent-gold, #c9a961);
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.param-help-btn:hover {
  background: var(--color-accent-gold, #c9a961);
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 2px 6px rgba(201, 169, 97, 0.45);
}

.param-help-btn:focus-visible {
  outline: 2px solid var(--color-accent-gold, #c9a961);
  outline-offset: 2px;
}

/* ---- Popover ---- */
.param-help-popover {
  position: absolute;
  z-index: 9999;
  width: min(520px, calc(100vw - 32px));
  max-height: min(70vh, 600px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.25),
              0 8px 16px -4px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: paramHelpIn 0.18s ease-out;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

@keyframes paramHelpIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.param-help-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1d1729 0%, #2d2342 100%);
  color: #fff;
}

.param-help-popover__title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}

.param-help-popover__close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.param-help-popover__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.param-help-popover__desc {
  margin: 0;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: #4b5563;
  background: #f9fafb;
  border-bottom: 1px solid #eef0f3;
  line-height: 1.45;
}

.param-help-popover__body {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}

.param-help-group {
  padding: 8px 16px 14px;
}

.param-help-group__name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent-gold, #c9a961);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed #e5e7eb;
}

.param-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.param-help-table thead th {
  text-align: left;
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.param-help-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
  border-radius: 6px;
  outline: none;
}

.param-help-table tbody tr:hover,
.param-help-table tbody tr:focus {
  background: #fff8e6;
}

.param-help-table tbody td {
  padding: 7px 6px;
  border-top: 1px solid #f3f4f6;
  vertical-align: middle;
}

.param-help-table tbody td:first-child {
  color: #1f2937;
}

.param-help-range {
  color: #6b7280;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.param-help-typical {
  white-space: nowrap;
  color: var(--color-accent-gold, #c9a961);
  font-variant-numeric: tabular-nums;
}

.param-help-popover__footer {
  padding: 10px 16px;
  font-size: 0.75rem;
  color: #6b7280;
  background: #f9fafb;
  border-top: 1px solid #eef0f3;
  text-align: center;
}

/* ---- Input flash анимация след попълване ---- */
.param-help-flash {
  animation: paramHelpFlash 0.6s ease-out;
}

@keyframes paramHelpFlash {
  0%   { background-color: #fff8e6; box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.35); }
  100% { background-color: inherit;  box-shadow: none; }
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .param-help-popover {
    width: calc(100vw - 24px);
    max-height: 80vh;
  }
  .param-help-table thead { display: none; }
  .param-help-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    padding: 6px 8px;
    border-top: 1px solid #f3f4f6;
  }
  .param-help-table tbody td { border: none; padding: 2px 0; }
  .param-help-table tbody td:first-child { grid-column: 1 / -1; font-weight: 600; }
}
