/* Alt Text Generator - tool-specific styles.
   Shared primitives (form card, mode toggle, quota chip, progress region,
   errors region, results header, history, toasts, upgrade banner)
   live in code/assets/css/tools.css. Only image-stack + drop-zone +
   per-card chrome lives here.
*/

/* ---- mode toggle: the shared `.mode-toggle::before` slide rule is
   hardcoded to translate when data-mode="bulk". Our second mode is
   "upload"; this override mirrors the same translateX so the pill
   slides under the active tab.
*/
.mode-toggle[data-mode="upload"]::before {
    transform: translateX(100%);
}
/* "Upload images" sat flush against the pill's left edge. Bump the
   left padding so the text gets a touch of breathing room. */
.mode-toggle .mode-btn[data-mode="upload"] {
    padding-left: 30px;
}

/* ---- options row (focus keyword + language) -------------------------- */

.atg-options-row {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 16px;
    margin-top: 14px;
}
.atg-option       { display: flex; flex-direction: column; gap: 6px; }
.atg-option-lang  { min-width: 180px; }
/* Shared `.text-input` carries `flex: 1 1 320px`, which in a
   flex-direction:column parent translates to a 320px MAIN-axis (height)
   request. Override here so our focus-keyword + language inputs render
   as single-line. */
.atg-option .text-input { flex: 0 0 auto; }

@media (max-width: 600px) {
    .atg-options-row { grid-template-columns: 1fr; gap: 12px; }
}

/* ---- mode toggle bodies --------------------------------------------- */

.atg-mode-body { margin-top: 12px; }
.atg-mode-body[hidden] { display: none; }

/* ---- drag-drop zone ------------------------------------------------- */

.atg-drop-zone {
    border: 2px dashed var(--ink-200, #d2d6e2);
    border-radius: 12px;
    background: var(--ink-50, #f6f7fb);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s, background 0.16s;
    outline: none;
}
.atg-drop-zone:hover,
.atg-drop-zone:focus-visible {
    border-color: var(--brand-500, #3550ff);
    background: #eef0ff;
}
.atg-drop-zone.is-dragover {
    border-color: var(--brand-600, #2940ea);
    background: #e4e7ff;
}
.atg-drop-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--ink-600, #4a5070);
}
.atg-drop-icon {
    width: 36px;
    height: 36px;
    color: var(--brand-500, #3550ff);
}
.atg-drop-title {
    margin: 4px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink-800, #1c2238);
}
.atg-drop-sub {
    margin: 0;
    font-size: 13px;
    color: var(--ink-600, #4a5070);
}
.atg-drop-link {
    color: var(--brand-600, #2940ea);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---- upload preview list -------------------------------------------- */

.atg-upload-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.atg-upload-list[hidden] { display: none; }
.atg-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--ink-50, #f6f7fb);
    border-radius: 8px;
    font-size: 13px;
}
.atg-upload-item-icon {
    width: 20px;
    height: 20px;
    color: var(--brand-500, #3550ff);
    flex-shrink: 0;
}
.atg-upload-item-name {
    flex: 1;
    color: var(--ink-800, #1c2238);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.atg-upload-item-size {
    color: var(--ink-500, #6b7090);
    font-variant-numeric: tabular-nums;
}
.atg-upload-item-remove {
    background: transparent;
    border: 0;
    padding: 4px;
    color: var(--ink-500, #6b7090);
    cursor: pointer;
    border-radius: 4px;
    line-height: 0;
}
.atg-upload-item-remove:hover {
    color: var(--danger-600, #c62828);
    background: var(--danger-50, #fef0f0);
}

/* ---- image-card stack ----------------------------------------------- */

.atg-images-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px 20px;
}

.atg-image-card {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--ink-100, #e8eaf2);
    border-radius: 10px;
}
.atg-image-card.is-error {
    border-color: var(--danger-200, #f5b7b7);
    background: var(--danger-50, #fef0f0);
}

@media (max-width: 700px) {
    .atg-image-card { grid-template-columns: 1fr; }
}

.atg-image-thumb {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ink-100, #e8eaf2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.atg-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fafbff;
}
.atg-image-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-500, #6b7090);
    font-size: 13px;
    text-align: center;
    padding: 8px;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .atg-image-thumb { width: 100%; max-width: 280px; height: 200px; }
}

.atg-image-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;   /* allow long URLs to truncate inside grid */
}

.atg-image-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
}
.atg-image-src {
    color: var(--ink-600, #4a5070);
    text-decoration: none;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.atg-image-src:hover {
    color: var(--brand-600, #2940ea);
    text-decoration: underline;
}
.atg-image-pill {
    background: var(--ink-100, #e8eaf2);
    color: var(--ink-700, #2b3148);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
}
.atg-image-pill.is-external { background: #fff4d8; color: #7a5a00; }
.atg-image-pill.is-conf-high   { background: #def5e2; color: #14633a; }
.atg-image-pill.is-conf-medium { background: #fff4d8; color: #7a5a00; }
.atg-image-pill.is-conf-low    { background: #ffe2e0; color: #8a1d1d; }

.atg-image-existing {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--ink-50, #f6f7fb);
    border-radius: 8px;
    font-size: 13px;
}
.atg-image-existing-label {
    font-weight: 600;
    color: var(--ink-700, #2b3148);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.atg-image-existing-text {
    color: var(--ink-800, #1c2238);
    word-break: break-word;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    font-size: 13px;
}
.atg-image-existing-text.is-missing,
.atg-image-existing-text.is-empty {
    font-style: italic;
    color: var(--ink-500, #6b7090);
    font-family: var(--font-base, "Poppins", sans-serif);
}
.atg-image-existing-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.atg-flag {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    background: var(--ink-100, #e8eaf2);
    color: var(--ink-700, #2b3148);
}
.atg-flag.is-good    { background: #def5e2; color: #14633a; }
.atg-flag.is-bad     { background: #ffe2e0; color: #8a1d1d; }
.atg-flag.is-warn    { background: #fff4d8; color: #7a5a00; }

.atg-image-deco {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #e3edff;
    color: #154789;
    border-radius: 8px;
    font-size: 13px;
}
.atg-image-deco-text { flex: 1; }
.atg-image-deco-action {
    background: transparent;
    border: 1px solid #4a8fde;
    color: #154789;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.atg-image-deco-action:hover { background: #cce0ff; }

.atg-image-suggested {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.atg-image-suggested-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-700, #2b3148);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.atg-image-textarea-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.atg-image-textarea {
    flex: 1;
    min-height: 60px;
    padding: 8px 10px;
    border: 1px solid var(--ink-200, #d2d6e2);
    border-radius: 8px;
    font-family: var(--font-base, "Poppins", sans-serif);
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    background: #fff;
    color: var(--ink-800, #1c2238);
}
.atg-image-textarea:focus {
    outline: none;
    border-color: var(--brand-500, #3550ff);
    box-shadow: 0 0 0 3px rgba(53, 80, 255, 0.16);
}
.atg-image-copy {
    align-self: flex-start;
    background: var(--brand-600, #2940ea);
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.12s;
}
.atg-image-copy:hover    { background: var(--brand-700, #1f33c2); }
.atg-image-copy.is-copied { background: var(--success-600, #16a34a); }
.atg-image-copy svg {
    width: 14px;
    height: 14px;
}

.atg-image-suggested-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-600, #4a5070);
}
.atg-image-charcount {
    font-variant-numeric: tabular-nums;
}
.atg-image-charcount.is-warn { color: #7a5a00; font-weight: 600; }
.atg-image-charcount.is-bad  { color: #8a1d1d; font-weight: 600; }

.atg-image-wcag {
    padding: 1px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    background: #def5e2;
    color: #14633a;
}
.atg-image-wcag.is-fail { background: #fff4d8; color: #7a5a00; }

.atg-image-ocr {
    padding: 8px 12px;
    background: var(--ink-50, #f6f7fb);
    border-left: 3px solid var(--brand-500, #3550ff);
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink-700, #2b3148);
}
.atg-image-ocr-label {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink-700, #2b3148);
    margin-right: 6px;
}
.atg-image-ocr-text {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    color: var(--ink-800, #1c2238);
    word-break: break-word;
}

.atg-image-error {
    padding: 8px 12px;
    background: var(--danger-50, #fef0f0);
    color: var(--danger-700, #ad1f1f);
    border-radius: 8px;
    font-size: 13px;
}

/* ---- results subhead truncation banner ------------------------------ */

.results-subhead-atg {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 20px;
    background: #fff7df;
    color: #6b4d00;
    font-size: 13px;
    line-height: 1.4;
}
.results-subhead-atg.is-empty { display: none; }
.results-subhead-atg svg {
    width: 16px;
    height: 16px;
    color: #b89000;
    flex-shrink: 0;
}
.results-subhead-atg a {
    color: #6b4d00;
    text-decoration: underline;
}

/* ---- quota chip flush below the form-card --------------------------- */

#quota-chip { margin-top: 12px; }
