/* ===================================================================
   app-extra.css — enhancement layer for /app (loaded after app-tool.css).
   Covers the "extra" pieces of the AI tool: suggestion chips, scroll-to-
   bottom button, composer meta (Enter hint + counter), attach button and
   attachment chips, image kit chips, field hints, guest box and history.
   Layout of the shell itself lives in app-tool.css.
   Colors come only from tokens.css variables.
   =================================================================== */

/* ---------- Brand accents ---------- */
.apptool__title {
    background: linear-gradient(180deg, var(--foreground) 40%, color-mix(in srgb, var(--foreground) 60%, var(--primary)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.apptool__mode.is-active {
    box-shadow: inset 2px 0 0 var(--primary);
}
.apptool__mode:focus-visible,
.apptool__newchat:focus-visible,
.apptool__send:focus-visible,
.apptool__attach:focus-visible,
.apptool__chip:focus-visible,
.apptool__suggest-btn:focus-visible,
.apptool__scrolldown:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* ---------- Field hint under model select ---------- */
.apptool__field-hint {
    display: block;
    margin-top: 4px;
    color: var(--muted-foreground);
    font-size: 0.76rem;
    line-height: 1.4;
}

/* ---------- Empty state + suggestions ---------- */
.apptool__empty {
    text-align: center;
    padding: clamp(24px, 6vw, 56px) 16px;
}
.apptool__empty-ico {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 1.6rem;
    background:
        linear-gradient(var(--card), var(--card)) padding-box,
        var(--brand-gradient) border-box;
    border: 1.5px solid transparent;
    box-shadow: 0 12px 28px -14px color-mix(in srgb, var(--primary) 70%, transparent);
}
.apptool__empty-title {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 6px;
}
.apptool__empty-sub {
    color: var(--muted-foreground);
    max-width: 44ch;
    margin: 0 auto;
}
.apptool__suggest {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 620px;
    margin: 26px auto 0;
    text-align: left;
}
.apptool__suggest-head {
    grid-column: 1 / -1;
    margin: 0 0 2px;
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: var(--tracking-kicker);
    text-transform: uppercase;
    text-align: center;
}
.apptool__suggest-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--foreground);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}
.apptool__suggest-btn::before {
    content: "\2197";
    flex: none;
    color: var(--primary);
    font-weight: 700;
}
.apptool__suggest-btn:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: color-mix(in srgb, var(--primary) 6%, var(--card));
    transform: translateY(-1px);
}

/* ---------- Stream wrapper + scroll-to-bottom ---------- */
.apptool__streamwrap { position: relative; min-height: 0; }
.apptool__scrolldown {
    position: absolute;
    left: 50%;
    bottom: 14px;
    z-index: 3;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--foreground);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s, background 0.15s var(--ease);
}
.apptool__scrolldown.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}
.apptool__scrolldown:hover { background: var(--secondary); }

/* ---------- Composer ---------- */
.apptool__composer {
    position: relative;
    flex-wrap: wrap;
}
.apptool__composer:focus-within {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent);
}
.apptool__attach {
    flex: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.apptool__attach:hover { color: var(--foreground); background: var(--secondary); }
.apptool__send {
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--brand-cyan)));
    color: var(--primary-foreground);
}
.apptool__send:disabled { opacity: 0.5; cursor: not-allowed; }
.apptool__composer-meta {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 4px 0;
    color: var(--muted-foreground);
    font-size: 0.74rem;
}
.apptool__enter-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--secondary);
    color: var(--foreground);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.5;
}
.apptool__counter {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.apptool__counter.is-near { color: var(--warning); }
.apptool__counter.is-max { color: var(--destructive); font-weight: 700; }

/* ---------- Attachments ---------- */
.apptool__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 8px;
}
.apptool__attachments[hidden] { display: none; }
.apptool__attachments > * {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--secondary);
    font-size: 0.82rem;
}

/* ---------- Image kits ---------- */
.apptool__imgkits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 6px;
}
.apptool__chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--card);
    color: var(--foreground);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.apptool__chip:hover,
.apptool__chip.is-active {
    border-color: color-mix(in srgb, var(--brand-gold) 55%, var(--border));
    background: color-mix(in srgb, var(--brand-gold) 10%, var(--card));
}
.apptool__img-tip {
    color: var(--muted-foreground);
    font-size: 0.8rem;
    margin: 0 0 10px;
}
.apptool__hint:empty { display: none; }

/* ---------- Sidebar: balance, guest, history ---------- */
.apptool__balance-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.apptool__topup { font-weight: 600; }
.apptool__guest {
    color: var(--muted-foreground);
    font-size: 0.86rem;
    margin: 0 0 10px;
}
.apptool__guest-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.apptool__guest-actions .btn { flex: 1 1 auto; }
.apptool__history-head {
    margin: 0 0 6px;
    color: var(--muted-foreground);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: var(--tracking-kicker);
    text-transform: uppercase;
}
.apptool__history-empty {
    color: var(--muted-foreground);
    font-size: 0.84rem;
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .apptool__suggest { grid-template-columns: 1fr; }
    .apptool__enter-hint { display: none; }
    .apptool__composer-meta { justify-content: flex-end; }
}

@media (hover: none) {
    .apptool__enter-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .apptool__scrolldown,
    .apptool__suggest-btn,
    .apptool__chip { transition: none; }
    .apptool__suggest-btn:hover { transform: none; }
}
