/* AI Prompt Ideas -- page-specific styles only. The white card surface
   (.card), page background, and shared tokens (--ink/--muted/--line/
   --accent/--radius-card/--space-card/--gap-md/...) all come from the
   dashboard's shared base.css/sidebar.css (loaded in base.html) --
   nothing here redeclares those, only layout specific to this page. */

/* --- Utility / state classes (search flow: strategy <-> results) --- */
.is-hidden{ display:none !important; }

.api-cost-line{
  margin:8px 2px 0; font-size:0.78rem; color:var(--muted);
}
.api-cost-line strong{ color:var(--ink); }

.api-error-msg{
  margin:10px 2px 0; padding:10px 14px;
  background:rgba(217,48,37,.08); color:#b3261e;
  border:1px solid rgba(217,48,37,.25); border-radius:var(--radius-sm);
  font-size:0.85rem;
}

.api-search-btn:disabled, .api-text-btn:disabled{
  opacity:.5; cursor:not-allowed;
}
.api-text-btn:disabled:hover{ text-decoration:none; }

/* Real GPT/Gemini icons -- swap in static/images/chatgpt-icon.svg and
   static/images/gemini-icon.svg (brand marks, not emoji). Used both in
   the section header and inline per-row/per-option in the platform
   dropdown. */
.api-platform-icon-img{
  width:16px; height:16px; vertical-align:-3px; margin-right:4px;
}

/* --- Search bar (top card) --- */
.api-search-bar{
  display:flex;
  align-items:flex-end;
  gap:var(--gap-md);
  flex-wrap:wrap;
}

.api-search-field{ display:flex; flex-direction:column; gap:6px; }
.api-search-field label{
  font-size:0.8rem; font-weight:700; color:var(--ink);
}
.api-search-field-keyword{ flex:2; min-width:220px; }
.api-search-field:not(.api-search-field-keyword){ flex:1; min-width:160px; }

.api-search-input-wrap{
  display:flex; align-items:center; gap:8px;
  border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:0 12px; height:41px;
}
.api-search-input-wrap input{
  flex:1; border:none; outline:none; font-size:var(--font-input);
  color:var(--ink); background:transparent;
}
.api-search-icon{ color:var(--muted); font-size:0.85rem; }

.api-search-field select{
  height:41px; border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:0 12px; font-size:var(--font-input); color:var(--ink);
  background:#fff;
}

.api-search-btn{
  height:41px; padding:0 20px; margin-left:auto;
  background:var(--accent); color:#fff; border:none; border-radius:var(--radius-sm);
  font-weight:700; font-size:var(--font-btn); cursor:pointer; white-space:nowrap;
}
.api-search-btn:hover{ background:#0d3f99; }

/* --- "AI-First SEO Strategy" heading + card grid --- */
.api-strategy-heading{
  margin:8px 2px 14px;
  font-size:1.3rem; font-weight:var(--weight-heading); color:var(--ink);
}

.api-strategy-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:var(--gap-md);
}
@media (max-width:820px){
  .api-strategy-grid{ grid-template-columns:1fr; }
}

.api-strategy-card{ display:flex; flex-direction:column; gap:16px; }
.api-strategy-card-body h3{
  margin:0 0 8px; font-size:1.05rem; font-weight:var(--weight-heading); color:var(--ink);
}
.api-strategy-card-body p{
  margin:0; font-size:0.9rem; color:var(--muted); line-height:1.5;
}

/* --- Section headings (Summary / AI Prompt Ideas) --- */
.api-summary-heading-row, .api-prompts-heading-row{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  margin:24px 2px 14px;
}
.api-section-heading{
  margin:0; font-size:1.3rem; font-weight:var(--weight-heading); color:var(--ink);
}
.api-keyword-tag{ font-weight:400; color:var(--muted); text-decoration:underline; font-size:0.9rem; }

/* --- Summary row (3 cards -- Volume / Intent / merged Mentions) --- */
/* --- Summary row 1: Volume + Intent (2 cards, even width) --- */
.api-summary-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:var(--gap-md);
  margin-bottom:var(--gap-md);
}
@media (max-width:700px){ .api-summary-grid{ grid-template-columns:1fr; } }

/* --- Summary row 2: Brands Mentioned / Top Sources, own row so its
     taller lists don't stretch row 1's shorter cards -- see index.html
     comment above .api-mentions-row. Full-width .card, same sizing as
     every other card (base.css), not squeezed into a grid column. --- */
.api-mentions-row{ margin-bottom:8px; }

.api-summary-card{ display:flex; flex-direction:column; gap:14px; }
.api-summary-card-title{
  display:flex; align-items:center; gap:8px;
  font-size:0.92rem; font-weight:700; color:var(--ink);
}
.api-summary-icon{ font-size:1rem; }

.api-kw-volume-row{ display:flex; align-items:center; gap:10px; }
.api-kw-volume-num{ font-size:var(--font-stat); font-weight:var(--weight-heading); color:var(--ink); }
.api-kw-volume-badge{
  background:rgba(17,85,204,.1); color:var(--accent);
  font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  padding:3px 9px; border-radius:100px;
}
/* Real trend sparkline (built by renderVolumeChart() in
   ai-prompt-ideas.js from volume.trend) -- shown directly, no
   "unlock historical data" gate. Falls back to a dashed placeholder
   box only when there's genuinely no trend data to draw (e.g.
   DataForSEO isn't configured yet). */
.api-kw-volume-chart{
  /* Fixed height (not just min-height) so the card is the same size
     whether or not this trend happens to have month labels -- with only
     min-height, the row with labels vs. the row without labels rendered
     at two different heights and the card visibly resized depending on
     the trend data. 64px chart + 6px gap + ~14px label line + a little
     breathing room. */
  height:84px;
  display:flex; flex-direction:column; justify-content:flex-end; gap:6px;
}
.api-kw-volume-chart.is-empty{
  border:1px dashed var(--line); border-radius:var(--radius-tile);
  background:var(--bg); color:var(--muted); font-size:0.78rem;
  align-items:center; justify-content:center;
}
.api-kw-volume-svg{ width:100%; height:64px; display:block; overflow:visible; }
.api-kw-volume-point{
  fill:var(--brand-red); stroke:#fff; stroke-width:1; cursor:default;
}
.api-kw-volume-point:hover{ r:4; }
.api-kw-volume-labels{
  display:flex; justify-content:space-between;
  font-size:0.68rem; color:var(--muted);
}
.api-kw-volume-labels span{ flex:1; text-align:center; }
.api-kw-volume-labels span:first-child{ text-align:left; }
.api-kw-volume-labels span:last-child{ text-align:right; }

/* Prompts Intent -- real radar chart (grid rings + filled data polygon
   + per-axis % labels), drawn as SVG by renderIntentRadar() in
   ai-prompt-ideas.js. Site's blue instead of the reference's
   orange/purple. */
.api-intent-radar-placeholder{
  position:relative; min-height:260px; width:100%;
  display:flex; align-items:center; justify-content:center;
}
.api-intent-radar-svg{ width:100%; max-width:320px; height:auto; overflow:visible; }
.api-intent-grid-ring{
  fill:none; stroke:var(--line); stroke-width:1;
}
.api-intent-axis-line{
  stroke:var(--line); stroke-width:1;
}
.api-intent-data-shape{
  fill:rgba(17,85,204,.18); stroke:var(--accent); stroke-width:1.5;
  stroke-linejoin:round;
}
.api-intent-data-point{
  fill:var(--accent); stroke:#fff; stroke-width:1;
}
.api-intent-axis-label{
  font-size:7px; fill:var(--muted); font-weight:600;
}

/* Brands Mentioned / Top Sources cards -- ranked list, shown directly
   (no locked rows / trial gate). Capped to the first 10 via
   .is-collapsed on the rest; ai-prompt-ideas.js reveals them by toggling
   .is-expanded on the list when the toggle button below is clicked. */
/* Brands Mentioned + Top Sources -- ONE card, two columns split by a
   divider. container-type lets .api-mentions-columns react to the
   CARD's own width (not the viewport's), so this stacks correctly
   whether it's narrow because the screen is small or just because the
   grid gave it a narrow column. */
.api-mentions-card{ justify-content:flex-start; container-type:inline-size; }
.api-mentions-columns{ display:flex; gap:24px; }
.api-mentions-col{ flex:1; min-width:0; display:flex; flex-direction:column; }
.api-mentions-divider{ width:1px; flex:none; background:var(--line); }
@container (max-width:360px){
  .api-mentions-columns{ flex-direction:column; gap:18px; }
  .api-mentions-divider{ width:100%; height:1px; }
}
.api-mentions-list{
  list-style:none; margin:0; padding:0;
  display:flex; flex-direction:column; gap:2px;
}
.api-mentions-item{
  display:flex; align-items:baseline; gap:8px;
  padding:5px 0; font-size:0.86rem; color:var(--ink);
  border-bottom:1px solid var(--line);
}
.api-mentions-item:last-child{ border-bottom:none; }
.api-mentions-item.is-collapsed{ display:none; }
.api-mentions-list.is-expanded .api-mentions-item.is-collapsed{ display:flex; }
.api-mentions-rank{ flex:none; color:var(--muted); font-weight:700; font-size:0.78rem; min-width:16px; }
.api-mentions-name{ flex:1; overflow-wrap:anywhere; }
.api-mentions-empty{ font-size:0.85rem; color:var(--muted); padding:4px 0; }
.api-mentions-toggle{
  align-self:flex-start; margin-top:10px;
  display:inline-flex; align-items:center; gap:6px;
  background:#fff; border:1px solid var(--line); border-radius:100px;
  padding:6px 14px; cursor:pointer;
  color:var(--ink); font-weight:600; font-size:0.78rem;
}
.api-mentions-toggle:hover{ border-color:var(--accent); color:var(--accent); }
.api-mentions-toggle-chevron{
  font-size:0.7rem; color:var(--muted); transition:transform .15s ease;
}
.api-mentions-toggle:hover .api-mentions-toggle-chevron{ color:var(--accent); }
.api-mentions-toggle.is-expanded .api-mentions-toggle-chevron{ transform:rotate(180deg); }

/* --- AI Prompt Ideas results card --- */
.api-prompts-card{ display:flex; flex-direction:column; gap:16px; }

.api-prompts-filters{ display:flex; gap:12px; flex-wrap:wrap; }
.api-filter-select{
  height:41px; border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:0 12px; font-size:var(--font-input); color:var(--ink); background:#fff;
  min-width:150px;
}
.api-prompt-content-search{ flex:1; min-width:200px; }
.api-prompt-content-search input{
  flex:1; border:none; outline:none; font-size:var(--font-input); color:var(--ink);
}

/* Custom platform dropdown */
.api-platform-select{ position:relative; min-width:170px; }
.api-platform-select-trigger{
  width:100%; height:41px; display:flex; align-items:center; justify-content:space-between;
  border:1px solid var(--line); border-radius:var(--radius-sm); background:#fff;
  padding:0 12px; font-size:var(--font-input); color:var(--ink); cursor:pointer;
}
.api-platform-select.is-open .api-platform-select-trigger{ border-color:var(--accent); }
.api-select-chevron{ color:var(--muted); font-size:0.8rem; }
.api-platform-select-menu{
  display:none;
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:10;
  background:#fff; border:1px solid var(--line); border-radius:var(--radius-sm);
  box-shadow:0 8px 20px rgba(18,21,28,.12); overflow:hidden;
}
.api-platform-select.is-open .api-platform-select-menu{ display:block; }
.api-platform-select-option{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px 12px; font-size:0.88rem; color:var(--ink); cursor:pointer;
}
.api-platform-select-option:hover{ background:var(--bg); }
.api-platform-select-option.is-active{ background:var(--accent); color:#fff; }
.api-select-check{ font-weight:700; }

.api-prompts-actions-row{
  display:flex; align-items:center; gap:16px;
  padding-bottom:14px; border-bottom:1px solid var(--line);
}
.api-selected-count{ font-size:0.85rem; color:var(--muted); }
.api-text-btn{
  background:none; border:none; color:var(--accent); font-weight:700;
  font-size:0.82rem; cursor:pointer; padding:0; white-space:nowrap;
}
.api-text-btn:hover{ text-decoration:underline; }

/* Export dropdown -- replaces the old separate Export/Copy buttons.
   Same open/close pattern as .api-platform-select above, just anchored
   to a small text-button trigger instead of a full select field. */
.api-export-select{ position:relative; }
.api-export-select .api-select-chevron{ color:var(--muted); font-size:0.75rem; }
.api-export-menu{
  display:none;
  position:absolute; top:calc(100% + 6px); left:0; z-index:10;
  background:#fff; border:1px solid var(--line); border-radius:var(--radius-sm);
  box-shadow:0 8px 20px rgba(18,21,28,.12); overflow:hidden;
  min-width:200px;
}
.api-export-select.is-open .api-export-menu{ display:block; }
.api-export-menu-option{
  display:block; width:100%; text-align:left;
  background:none; border:none; padding:10px 14px;
  font-size:0.85rem; font-weight:600; color:var(--ink); cursor:pointer;
}
.api-export-menu-option:hover{ background:var(--bg); }
.api-export-menu-option:disabled{ color:var(--muted); cursor:not-allowed; background:none; }

/* Table */
/* overflow-x:auto establishes a clipping box on THAT axis regardless of
   whether the table actually needs to scroll -- which was cutting off
   the "?" column-help tooltips on both sides (they're wider than a
   table cell, so they overflow left/right of it). The table's only 5
   columns and fits most viewports without scrolling anyway, so drop the
   overflow rule by default (tooltips render uncropped) and only turn
   horizontal scrolling back on below the width where the table would
   otherwise get squeezed -- narrow enough that there's little room for
   a wide tooltip either way. */
.api-prompts-table-wrap{ }
@media (max-width:700px){
  .api-prompts-table-wrap{
    overflow-x:auto;
    padding-top:34px; margin-top:-34px;
  }
}
.api-prompts-table{ width:100%; border-collapse:collapse; font-size:0.86rem; }
.api-prompts-table th{
  text-align:left; font-weight:700; color:var(--muted);
  font-size:0.72rem; text-transform:uppercase; letter-spacing:.03em;
  padding:0 10px 10px; border-bottom:1px solid var(--line); white-space:nowrap;
}
.api-prompts-table td{
  padding:12px 10px; border-bottom:1px solid var(--line); color:var(--ink);
}
.api-col-check{ width:32px; }

.api-prompts-footer-row{
  display:flex; align-items:center; gap:14px; flex-wrap:wrap;
}
.api-results-count{ font-size:0.85rem; color:var(--muted); }

/* Pager + "Load N more" row, below the results-count line */
.api-prompts-pagination-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; flex-wrap:wrap;
  margin-top:6px; padding-top:14px; border-top:1px solid var(--line);
}
.api-pager{ display:flex; align-items:center; gap:8px; }
.api-pager-btn{
  min-width:32px; height:32px; padding:0 8px;
  border:1px solid var(--line); border-radius:var(--radius-sm);
  background:#fff; color:var(--ink); font-size:0.85rem; font-weight:600;
  cursor:pointer;
}
.api-pager-btn:hover:not(:disabled){ border-color:var(--accent); color:var(--accent); }
.api-pager-btn:disabled{ color:var(--muted); border-color:var(--line); opacity:.5; cursor:not-allowed; }
.api-pager-label{ font-size:0.85rem; color:var(--muted); font-weight:600; white-space:nowrap; padding:0 4px; }

.api-load-more-btn{
  height:38px; padding:0 20px;
  background:var(--accent); color:#fff; border:none; border-radius:var(--radius-sm);
  font-weight:700; font-size:var(--font-btn); cursor:pointer; white-space:nowrap;
}
.api-load-more-btn:hover:not(:disabled){ background:#0d3f99; }
.api-load-more-btn:disabled{ opacity:.6; cursor:not-allowed; }

/* Preview image slot for each strategy card. Was a dashed "reserved
   space" placeholder box before the real images existed (see
   index.html's <img> tags) -- now real screenshots are dropped in
   under static/images/.

   The 4 source images have all been pre-padded (white bars, centered,
   no cropping) to the SAME aspect ratio (2.473:1, matching the widest
   of the 4) -- see the one-time Pillow script used to normalize them.
   That's what actually fixes the "some images have visible gray bars
   around them, some don't" issue: before, each image had a different
   aspect ratio, so object-fit:contain left a different amount of
   letterboxing per card, and that letterboxing showed this container's
   OWN grayish background (var(--bg), the page's off-white) which read
   as a visible gray box around only SOME of the images.
   Now that every image is already the same ratio, contain needs little
   to no extra letterboxing -- and background is white (matching the
   card, not the grayish page background) so if there's ever a sliver
   left over from a non-exact container width, it blends in instead of
   showing as a gray seam. */
.api-strategy-card-image{
  border:1px solid var(--line); border-radius:var(--radius-tile);
  background:#fff;
  height:260px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.api-strategy-card-image img{
  width:100%; height:100%; object-fit:contain; display:block;
}