/* ==========================================================================
   Method Advisor — модален диалог + бутон „ⓘ" върху методиките
   ========================================================================== */

.method-info-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}

.method-info-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.1);
}

/* Variant: inline (вътре в label в calculators.html) */
.method-info-btn--inline {
  position: static;
  width: auto;
  height: 26px;
  gap: 5px;
  padding: 0 10px;
  margin-left: 8px;
  border-radius: 13px;
  border: 1px solid var(--color-accent-gold, #c9a961);
  background: #fff8e6;
  color: var(--color-accent-gold, #c9a961);
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
  backdrop-filter: none;
}

.method-info-btn--inline:hover {
  background: var(--color-accent-gold, #c9a961);
  color: #fff;
  border-color: var(--color-accent-gold, #c9a961);
}

/* Ensure parent method-card is positioned */
.method-card {
  position: relative;
}

/* ---- Modal ---- */
.method-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 30, 0.55);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: methodModalFadeIn 0.18s ease-out;
}

.method-modal--closing {
  animation: methodModalFadeOut 0.16s ease-in forwards;
}

@keyframes methodModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes methodModalFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.method-modal__dialog {
  background: #fff;
  border-radius: 16px;
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: methodDialogIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

@keyframes methodDialogIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.method-modal__head {
  position: relative;
  padding: 22px 56px 22px 24px;
  background: linear-gradient(135deg, #1d1729 0%, #3a2456 50%, #1d1729 100%);
  color: #fff;
}

.method-modal__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 6px;
}

.method-modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.method-modal__subtitle {
  margin-top: 6px;
  font-size: 0.88rem;
  color: #cbb8e0;
  font-weight: 500;
}

.method-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.method-modal__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.method-modal__body {
  overflow-y: auto;
  padding: 20px 24px;
  flex: 1;
}

.method-modal__accuracy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff8e6 0%, #fef3d0 100%);
  border: 1px solid #f0d98a;
  border-radius: 10px;
  margin-bottom: 18px;
}

.method-modal__accuracy-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b5514;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.method-modal__accuracy-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #8b6e1a;
  font-variant-numeric: tabular-nums;
}

.method-modal__section {
  margin-bottom: 18px;
}

.method-modal__section h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1f2937;
}

.method-modal__section p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #374151;
}

.method-modal__section ul {
  margin: 0;
  padding-left: 22px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #374151;
}

.method-modal__section li {
  margin-bottom: 4px;
}

.method-modal__section--good {
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}
.method-modal__section--good h3 { color: #166534; }

.method-modal__section--bad {
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
}
.method-modal__section--bad h3 { color: #991b1b; }

.method-modal__section--formula {
  padding: 12px 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
}
.method-modal__section--formula code {
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  background: #1e1b4b;
  color: #e0e7ff;
  border-radius: 6px;
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.method-modal__foot {
  padding: 14px 24px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.method-modal__btn {
  padding: 10px 22px;
  border: none;
  background: var(--color-accent-gold, #c9a961);
  color: #1d1729;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s ease, transform 0.1s ease;
}

.method-modal__btn:hover {
  background: #b8944a;
  transform: translateY(-1px);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .method-modal { padding: 0; align-items: flex-end; }
  .method-modal__dialog {
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  .method-modal__head { padding: 18px 50px 18px 18px; }
  .method-modal__title { font-size: 1.15rem; }
  .method-modal__body { padding: 16px 18px; }
}
