/* --- Reset-ish base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top left, #222 0, #050509 45%, #000 100%);
  color: #f5f5f5;
}

body.loading {
  cursor: progress;
}

/* --- Layout --- */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.header {
  margin-bottom: 1.5rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-img {
  display: block;
  max-height: 35px;
  width: auto;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  font-size: 0.9rem;
  color: #ffb36b;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  border: 1px solid rgba(255, 179, 107, 0.4);
  background: rgba(255, 179, 107, 0.05);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.nav-link:hover {
  background: rgba(255, 179, 107, 0.12);
  border-color: rgba(255, 179, 107, 0.7);
}

.header-subtitle {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #a3a3a3;
}

.header-subtitle a.subtitle-link {
  color: #ffb36b;
  text-decoration: none;
  font-weight: 500;
}

.header-subtitle a.subtitle-link:hover {
  text-decoration: underline;
}

/* main is a single column */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --- Main card --- */
.card {
  background: #11121a;
  border-radius: 1rem;
  padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Desktop / default: logo top-right inside card */
/* Top row: header (left) + logo (right), both top-aligned */
.card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-start; /* top-align header and logo */
  column-gap: 1rem;
  margin-bottom: 1rem;    /* space below the top row before controls */
}

/* header container */
/* .card-top-left {} */

/* logo container */
/* .card-top-right {} */

/* Header styles */
.card-header {
  margin: 0;
}

.card-title {
  margin: 0;
  font-size: 1.4rem;
}

.card-subtitle {
  margin: 0.25rem 0 0;
  color: #aaaaaa;
  font-size: 0.9rem;
}

/* Logo styles */
.card-logo img {
  display: block;
  height: 96px;   /* adjust for desktop size */
  width: auto;
  opacity: 0.95;
}

/* --- Controls --- */
.controls {
  margin-top: 0.75rem;   /* add this for more space under header/logo */
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.control-label {
  color: #c5c5c5;
}

.select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #333647;
  background: #181a25;
  color: #f5f5f5;
  font-size: 0.9rem;
  outline: none;
}

.select:focus {
  border-color: #fd9607;
  box-shadow: 0 0 0 1px rgba(255, 138, 0, 0.3);
}

/* --- Buttons --- */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.08s ease,
    background-color 0.1s ease, color 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, #fd9607, #f42888);
  color: #fff;
  box-shadow: 0 6px 16px rgba(229, 46, 113, 0.35);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.secondary {
  background: #232635;
  color: #f5f5f5;
  border: 1px solid #3b3f57;
}

.btn.secondary:hover {
  background: #2e3245;
}

/* --- Joke display --- */
.joke-container {
  margin-top: 0.5rem;
}

.joke-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #9c9c9c;
  margin-bottom: 0.3rem;
}

.joke-tag {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(229, 46, 113, 0.1);
  color: #ff9ac1;
  border: 1px solid rgba(229, 46, 113, 0.35);
}

.joke-id {
  opacity: 0.8;
}

.joke-box {
  border-radius: 0.75rem;
  border: 1px solid #333647;
  padding: 0.85rem 0.95rem;
  background: radial-gradient(circle at top left, #191a26 0, #10111a 50%);
  min-height: 4.2rem;
  line-height: 1.45;
  font-size: 0.98rem;
  color: #fdfdfd;
}

.joke-actions {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.copy-status {
  font-size: 0.8rem;
  min-height: 1.2rem;
}

.copy-success {
  color: #8bdc8b;
}

.copy-error {
  color: #ff8f8f;
}

/* --- Status bar --- */
.status-bar {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: #aaaaaa;
  min-height: 1.1rem;
}

.status-message {
  padding: 0.25rem 0.4rem;
  border-radius: 0.4rem;
}

.status-info {
  color: #bbbbbb;
}

.status-success {
  color: #9af59a;
}

.status-warning {
  color: #ffd27f;
}

.status-error {
  color: #ff9a9a;
}

/* --- Info section under card --- */
.info {
  align-self: stretch;
  background: #0c0d13;
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  font-size: 0.9rem;
}

.info h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.info ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.info li {
  margin-bottom: 0.3rem;
}

.info a {
  color: #ffb36b;
  text-decoration: none;
}

.info a:hover {
  text-decoration: underline;
}

/* Inline code styling (e.g., in API Endpoints list) */
code {
  font-family: "JetBrains Mono", SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
  background-color: rgba(15, 23, 42, 0.9);
  color: #f4f4f4;
  padding: 0.15rem 0.3rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* reduce padding if code is inside headings */
h1 code,
h2 code,
h3 code,
h4 code {
  font-size: 0.9em;
  padding: 0.1rem 0.25rem;
}

/* --- Footer --- */
.footer {
  margin-top: 1.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: #888888;

  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto; /* left | wide center | right */
  align-items: center;
  column-gap: 0.75rem;
}

/* Left: stays on the left edge */
.footer-left {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Center: truly centered on the page */
.footer-center {
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}

/* Right: stays on the right edge */
.footer-right {
  justify-self: end;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.footer a {
  color: #ffb36b;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-separator {
  opacity: 0.5;
}

/* --- Responsive tweaks --- */
@media (max-width: 600px) {
  .page-wrap {
    padding: 1.1rem;
  }

  .card {
    padding: 1rem 1rem 1.1rem;
  }

  /* Mobile: logo on top, then header, then controls */
  .card-top {
    display: flex;
    flex-direction: column;
    align-items: center;   /* center the logo and header horizontally */
    text-align: center;    /* center header text */
    margin-bottom: 1rem;
  }

  .card-top-left {
    order: 2;              /* header second */
    width: 100%;
    margin-top: 0.5rem;
  }

  .card-top-right {
    order: 1;              /* logo first */
  }

  .card-logo img {
    height: 128px;              /* slightly bigger on mobile */
  }

  .card-header {
    margin-top: 0.25rem;
  }

  .controls {
    margin-top: 0.5rem;
  }

  .footer {
    grid-template-columns: 1fr;   /* single column */
    row-gap: 0.35rem;
  }

  .footer-left,
  .footer-center,
  .footer-right {
    justify-self: center;
    text-align: center;
  }
}

/* Swagger UI dark mode tweaks */
body.swagger-ui {
  background-color: #11121a;
}

body.swagger-ui .topbar {
  background-color: #11121a;
  border-bottom: 1px solid #2d2f3d;
}

body.swagger-ui .topbar a span {
  color: #f5f5f5;
}

body.swagger-ui .opblock-tag {
  background: #1a1c29;
  color: #f5f5f5;
  border-color: #353850;
}

body.swagger-ui .opblock {
  background: #171824;
  border-color: #373a50;
}

body.swagger-ui .scheme-container {
  background: #191a27;
}

body.swagger-ui .info {
  color: #f5f5f5;
}

body.swagger-ui .opblock-summary-method {
  color: #fff;
}

body.swagger-ui,
body.swagger-ui .markdown,
body.swagger-ui .markdown p,
body.swagger-ui .markdown td,
body.swagger-ui .markdown li {
  color: #f5f5f5;
}