/* ai-standalone.css — form controls for the custom /ai/* frontends.

   The page shell (header, hero, card lift, about, more-tools, footer and the
   --tt-* tokens) is shared with /tools/* via tools-standalone.css, which loads
   first. This file only adds the widgets the AI pages need, styled to match the
   tool pages exactly: flat, sharp-cornered, #ee5057 primary on white/#fafafa.

   The widget half (.ai-input/.ai-select/.ai-textarea/.ai-btn/.ai-bar/.ai-drop/
   .ai-file/.ai-hint) is generic, so /tools/custom/ and /tools/publish/ load this
   sheet too rather than growing a second copy of the same controls. */

/* ── card ── */
.aitool {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e9e9e9;
  box-shadow: 0 14px 40px rgba(31,54,70,.13);
  display: flex;
  align-items: stretch;
}
.aitool-main {
  flex: 1;
  min-width: 0;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 360px;
}
.aitool-side {
  width: 316px;
  flex-shrink: 0;
  border-left: 1px solid var(--tt-line);
  background: #fafafa;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
@media (max-width: 860px) {
  .aitool { flex-direction: column; }
  .aitool-side { width: 100%; border-left: none; border-top: 1px solid var(--tt-line); }
  .aitool-main { min-height: 0; }
}

/* ── labels & inputs ── */
.ai-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tt-ink);
  margin-top: 4px;
}
.ai-label:first-child { margin-top: 0; }
.ai-hint { font-size: 11.5px; color: #a2a2a2; line-height: 1.55; margin: -3px 0 2px; }

.ai-input, .ai-select, .ai-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0;
  color: var(--tt-ink);
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  padding: .6rem .75rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ai-textarea { resize: vertical; min-height: 104px; line-height: 1.6; }
.ai-input:focus, .ai-select:focus, .ai-textarea:focus {
  border-color: var(--tt-primary);
  box-shadow: 0 0 0 .2rem rgba(238,80,87,.25);
}
.ai-select { -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 10px;
  padding-right: 30px; }

/* segmented radio row */
.ai-seg { display: flex; }
.ai-seg label {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-left-width: 0;
  background: #fff;
  color: #7d7d7d;
  cursor: pointer;
  margin: 0;
  transition: background .15s, color .15s;
}
.ai-seg label:first-child { border-left-width: 1px; }
.ai-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ai-seg label:hover { background: #f3f3f3; color: var(--tt-ink); }
.ai-seg input:checked + span { color: #fff; }
.ai-seg label.is-on { background: var(--tt-primary); border-color: var(--tt-primary); color: #fff; }

/* checkbox */
.ai-check { display: flex; align-items: center; gap: 9px; cursor: pointer; margin: 2px 0; }
.ai-check input { accent-color: var(--tt-primary); width: 15px; height: 15px; cursor: pointer; }
.ai-check span { font-size: 13px; color: #6f6f6f; }

/* slider row */
.ai-slider-row { display: flex; align-items: center; gap: 11px; }
.ai-slider-row input[type=range] { flex: 1; accent-color: var(--tt-primary); cursor: pointer; min-width: 0; }
.ai-slider-val {
  font-size: 12px; color: var(--tt-ink); min-width: 44px; text-align: right;
  font-variant-numeric: tabular-nums;
}
/* min-width:0 or grid/flex children refuse to shrink below their content and
   push the slider read-out outside the card. */
.ai-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-grid2 > * { min-width: 0; }
.aitool-side > *, .aitool-main > * { max-width: 100%; }

/* ── primary action ── */
.ai-btn {
  width: 100%;
  background: var(--tt-primary);
  border: 1px solid var(--tt-primary);
  border-radius: 0;
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 13px 20px;
  cursor: pointer;
  margin-top: 6px;
  transition: background .15s;
}
.ai-btn:hover:not(:disabled) { background: var(--tt-primary-dark); border-color: var(--tt-primary-dark); }
.ai-btn:disabled { opacity: .45; cursor: not-allowed; }

.ai-status { font-size: 12.5px; color: #8d8d8d; line-height: 1.6; min-height: 1px; }
.ai-error { font-size: 12.5px; color: var(--tt-primary-dark); line-height: 1.6; }
.ai-divider { height: 1px; background: var(--tt-line); margin: 4px 0; }

.ai-bar { height: 4px; background: #e4e4e4; overflow: hidden; display: none; }
.ai-bar.on { display: block; }
.ai-bar-fill {
  height: 100%; width: 40%; background: var(--tt-primary);
  animation: aibar 1.1s ease-in-out infinite;
}
@keyframes aibar { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.ai-dl {
  display: none;
  padding: 11px 12px;
  background: var(--tt-navy);
  border: 1px solid var(--tt-navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  transition: background .15s;
}
.ai-dl.on { display: block; }
.ai-dl:hover { background: #16262f; color: #fff; }

/* ── drop zone ── */
.ai-drop {
  border: 2px dashed #f0b4b7;
  background: #fcfcfc;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  text-align: center;
  padding: 30px 24px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.ai-drop:hover, .ai-drop.over { background: #fdf3f3; border-color: var(--tt-primary); }
.ai-drop input[type=file] { display: none; }
.ai-drop-icon { font-size: 40px; color: #d9d9d9; line-height: 1; }
.ai-drop:hover .ai-drop-icon, .ai-drop.over .ai-drop-icon { color: var(--tt-primary); }
.ai-drop-text { font-size: 14.5px; color: #8d8d8d; line-height: 1.7; }
.ai-drop-text b { color: var(--tt-primary); font-weight: 600; }
.ai-drop-sub { font-size: 11.5px; color: #b3b3b3; }

/* chosen-file chip */
.ai-file {
  display: none;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--tt-line);
  background: #fff;
  padding: 11px 13px;
}
.ai-file.on { display: flex; }
.ai-file-ico { color: var(--tt-primary); font-size: 17px; }
.ai-file-meta { flex: 1; min-width: 0; }
.ai-file-name { font-size: 13px; color: var(--tt-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-file-size { font-size: 11px; color: #a8a8a8; margin-top: 2px; }
.ai-file-x { background: none; border: none; color: #b0b0b0; cursor: pointer; font-size: 15px; padding: 2px 5px; }
.ai-file-x:hover { color: var(--tt-primary); }

/* ── result surfaces ── */
.ai-out { display: none; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.ai-out.on { display: flex; }

.ai-result-img {
  display: flex; align-items: center; justify-content: center;
  background: #f6f6f6; border: 1px solid var(--tt-line);
  min-height: 300px; padding: 12px;
}
.ai-result-img img { max-width: 100%; max-height: 560px; display: block; }

.ai-transcript {
  width: 100%;
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--tt-line);
  background: #fff;
  padding: 15px 16px;
  font-family: 'Open Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.85;
  color: #555;
  white-space: pre-wrap;
  overflow-y: auto;
  resize: vertical;
}
.ai-out-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.ai-out-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tt-ink); }
.ai-chip {
  font-size: 11px; padding: 3px 10px; background: rgba(238,80,87,.1);
  color: var(--tt-primary); font-weight: 600;
}
.ai-copy {
  background: #fff; border: 1px solid #ccc; color: #6f6f6f;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  padding: 7px 13px; cursor: pointer; transition: all .15s;
}
.ai-copy:hover { border-color: var(--tt-primary); color: var(--tt-primary); }

/* quota pill */
.ai-quota-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.85); margin-top: 18px;
}
.ai-quota-pill b { color: #fff; font-weight: 600; }

/* backend-unavailable notice */
.ai-down {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; padding: 60px 30px; flex: 1;
}
.ai-down-ico { font-size: 40px; color: #e0b400; }
.ai-down h3 { font-size: 17px; font-weight: 600; color: var(--tt-ink); margin: 0; }
.ai-down p { font-size: 13.5px; color: #8d8d8d; line-height: 1.75; max-width: 430px; margin: 0; }

/* Hub card styles live in tools-standalone.css as .hub-* — shared with
   /tools/ so the two hubs can't drift apart. */

/* audio result surface (TTS) */
.ai-result-audio {
  display: flex; align-items: center; justify-content: center;
  background: #f6f6f6; border: 1px solid var(--tt-line);
  padding: 24px 20px;
}
.ai-result-audio audio { width: 100%; max-width: 520px; }
.aitool-side #customFields, .aitool-side #designFields { display: flex; flex-direction: column; gap: 9px; }

/* Signed-out visitor on an AI tool page: the page is readable by anyone, but
   the GPU backend needs an account, so the run button reads as unavailable
   rather than failing on click (see js/ai-auth-gate.js). Not `disabled` —
   the tool's own code toggles that as inputs are filled. */
.ai-btn.is-locked { opacity: .5; cursor: not-allowed; }
.ai-error a { color: var(--tt-primary); text-decoration: underline; }
