/* AskGPT button + modal styles. */

/* Hide the inline button by default; reveal on heading hover. */
h1 a.askgpt-btn,
h2 a.askgpt-btn,
h3 a.askgpt-btn,
h4 a.askgpt-btn,
h5 a.askgpt-btn,
h6 a.askgpt-btn {
  opacity: 0;
  margin-left: 0.4em;
  font-size: 0.6em;
  vertical-align: middle;
  text-decoration: none;
  transition: opacity 0.15s ease-in-out;
}

h1:hover a.askgpt-btn,
h2:hover a.askgpt-btn,
h3:hover a.askgpt-btn,
h4:hover a.askgpt-btn,
h5:hover a.askgpt-btn,
h6:hover a.askgpt-btn,
a.askgpt-btn:focus {
  opacity: 1;
}

a.askgpt-btn:hover {
  text-decoration: none;
  filter: brightness(1.2);
}

/* Modal backdrop */
.askgpt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Modal card */
.askgpt-card {
  background: #ffffff;
  color: #111111;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  max-width: 36rem;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.askgpt-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.4rem;
  word-break: break-word;
}

.askgpt-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666666;
  margin-top: 0.4rem;
}

.askgpt-url {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid #cccccc;
  border-radius: 4px;
  background: #f6f6f6;
  color: #333333;
  box-sizing: border-box;
}

.askgpt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.askgpt-chip {
  background: #ffffff;
  color: #333333;
  border: 1px solid #cccccc;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.1s ease-in-out;
}

.askgpt-chip:hover {
  border-color: #10a37f;
  color: #10a37f;
}

.askgpt-chip-active {
  background: #10a37f;
  color: #ffffff;
  border-color: #10a37f;
}

.askgpt-text {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cccccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}

.askgpt-preview {
  background: #f6f6f6;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
  overflow-y: auto;
  color: #333333;
  margin: 0;
}

.askgpt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.askgpt-auto {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #555555;
  margin-top: 0.4rem;
  cursor: pointer;
  line-height: 1.4;
}

.askgpt-auto input[type="checkbox"] {
  margin-top: 0.2rem;
  cursor: pointer;
}

.askgpt-cancel {
  background: transparent;
  color: #666666;
  border: 1px solid #cccccc;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.askgpt-cancel:hover {
  background: #f4f4f4;
}

.askgpt-copy {
  background: transparent;
  color: #10a37f;
  border: 1px solid #10a37f;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.askgpt-copy:hover {
  background: rgba(16, 163, 127, 0.08);
}

.askgpt-submit {
  background: #10a37f;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.askgpt-submit:hover {
  background: #0e906f;
}

@media (prefers-color-scheme: dark) {
  .askgpt-card {
    background: #1f1f1f;
    color: #f0f0f0;
  }
  .askgpt-label {
    color: #aaaaaa;
  }
  .askgpt-url {
    background: #2a2a2a;
    color: #f0f0f0;
    border-color: #444444;
  }
  .askgpt-chip {
    background: #2a2a2a;
    color: #f0f0f0;
    border-color: #444444;
  }
  .askgpt-chip:hover {
    border-color: #10a37f;
    color: #10a37f;
  }
  .askgpt-chip-active {
    background: #10a37f;
    color: #ffffff;
    border-color: #10a37f;
  }
  .askgpt-text {
    background: #2a2a2a;
    color: #f0f0f0;
    border-color: #444444;
  }
  .askgpt-preview {
    background: #2a2a2a;
    border-color: #444444;
    color: #e0e0e0;
  }
  .askgpt-cancel {
    color: #cccccc;
    border-color: #444444;
  }
  .askgpt-cancel:hover {
    background: #333333;
  }
  .askgpt-copy {
    color: #10a37f;
    border-color: #10a37f;
  }
  .askgpt-copy:hover {
    background: rgba(16, 163, 127, 0.15);
  }
  .askgpt-auto {
    color: #aaaaaa;
  }
}
