/* ============================================================================
   66-task-attach.css - files and Spaces links in the task window's details pane
   (Components/Shared/TaskAttachmentsPanel, mounted by TaskAttachments in the detail window).

   Two compact fields in the column's own rhythm: "Files" (a drop zone, then one row per file with an
   icon or a thumbnail, the name, the size and two small buttons) and "Notes and boards" (chips that
   open the item, an add button, and an inline picker). Everything stays INSIDE the card: the picker
   is a panel in the flow with its own scroll, never a floating layer, and a long name is cut with an
   ellipsis instead of widening the column.

   The wrappers are display: contents so the fields are the aside's own flex items and take its gap,
   like every other field. The tight 4px caption gap is the side column's rhythm (59-task-window.css).

   Logical properties only, so Hebrew mirrors without a line in 95-rtl.css. Colours are the base
   tokens, so the dark theme needs no twin. Before 95-rtl and the dark theme in ChronosHead.
   ============================================================================ */

.tat-host,
.tat { display: contents; }

.tat .tw-field { flex: 0 0 auto; }

/* v0.32.x redesign: the files are a GRID of cards and the drop zone is a dashed tile at the end of
   it. With no file the grid is one column and the tile is one line, so an empty section never
   becomes a block. */

/* ---- the drop zone -------------------------------------------------------------------------- */
.tat-drop-cell { display: flex; min-inline-size: 0; }
.tat-drop {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 40px;
    padding: 8px;
    border: 1px dashed var(--chronos-outline);
    border-radius: var(--radius-card);
    background: transparent;
    color: var(--chronos-fg-muted);
    font-size: var(--text-sm);
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.tat-list:not(:has(.tat-row)) .tat-drop { flex-direction: row; gap: 8px; }
.tat-drop:hover,
.tat-drop:focus-within {
    border-color: color-mix(in srgb, var(--chronos-violet) 45%, transparent);
    color: var(--chronos-violet);
}
.tat-drop.is-drag {
    border-style: solid;
    border-color: var(--chronos-violet);
    background: color-mix(in srgb, var(--chronos-violet) 10%, var(--chronos-card-bg));
    color: var(--chronos-violet);
}
.tat-drop-ico { flex: none; font-size: 18px; }
.tat-drop-text { min-width: 0; overflow-wrap: anywhere; }

/* The real input stays in the page (a keyboard reaches it, a screen reader names the label) but is
   not drawn; the label around it is the control. */
.tat-input {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

/* ---- the file rows -------------------------------------------------------------------------- */
.tat-list,
.tat-chips,
.tat-picks {
    margin: 0;
    padding: 0;
    list-style: none;
}
.tat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
}
.tat-list:not(:has(.tat-row)) { grid-template-columns: minmax(0, 1fr); }

.tat-row {
    --tat-btn: 28px;
    position: relative;
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    overflow: hidden;
    border: 1px solid var(--chronos-outline);
    border-radius: var(--radius-card);
    background: var(--chronos-chip-bg);
}
.tat-ico {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 100%;
    block-size: 72px;
    font-size: 32px;
    color: var(--chronos-fg-muted);
    background: var(--chronos-card-bg);
}
.tat-row.is-failed .tat-ico { color: var(--chronos-red); }

.tat-thumb {
    flex: none;
    display: block;
    inline-size: 100%;
    block-size: 72px;
    overflow: hidden;
    background: var(--chronos-card-bg);
}
.tat-thumb img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
}

.tat-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-inline-size: 0;
    padding: 6px 8px 8px;
}
.tat-name {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}
a.tat-name:hover { text-decoration: underline; }
.tat-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--chronos-fg-muted);
    font-size: var(--text-xs);
}
.tat-meta-err,
.tat-error { color: var(--chronos-red); }
.tat-error {
    margin: 0;
    font-size: var(--text-sm);
    line-height: 1.3;
}

.tat-bar {
    display: block;
    block-size: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: color-mix(in srgb, var(--chronos-violet) 16%, transparent);
}
.tat-bar-fill {
    display: block;
    block-size: 100%;
    background: var(--chronos-violet);
    transition: inline-size 0.2s ease;
}

/* Download and delete live on the card's thumbnail corner and show on hover or focus; where there is
   no hover (a phone) they are always drawn. */
.tat-btn {
    position: absolute;
    inset-block-start: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--tat-btn);
    block-size: var(--tat-btn);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--chronos-card-bg) 90%, transparent);
    color: var(--chronos-fg-muted);
    cursor: pointer;
    opacity: 0;
    transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
a.tat-btn { inset-inline-end: 4px; }
.tat-del { inset-inline-end: calc(var(--tat-btn) + 8px); }
.tat-row:hover .tat-btn,
.tat-row:focus-within .tat-btn,
.tat-del.is-armed { opacity: 1; }
@media (hover: none) {
    .tat-btn { opacity: 1; }
}
.tat-btn .material-icons { font-size: 18px; }
.tat-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--chronos-violet) 14%, var(--chronos-card-bg));
    color: var(--chronos-violet);
}
.tat-del:hover:not(:disabled) {
    background: color-mix(in srgb, var(--chronos-red) 14%, var(--chronos-card-bg));
    color: var(--chronos-red);
}
.tat-del.is-armed {
    background: var(--chronos-red);
    color: #fff;
}
.tat-btn:disabled { opacity: 0.5; cursor: default; }

/* ---- the links ------------------------------------------------------------------------------ */
.tat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tat-chip {
    display: inline-flex;
    max-inline-size: 100%;
    align-items: center;
    min-inline-size: 0;
    border: 1px solid color-mix(in srgb, var(--chronos-violet) 28%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--chronos-violet) 8%, var(--chronos-card-bg));
}
.tat-chip-open {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
    min-block-size: 32px;
    padding-inline: 10px 4px;
    color: var(--chronos-violet);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}
.tat-chip-open .material-icons { flex: none; font-size: 16px; }
.tat-chip-text {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tat-chip-x {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 28px;
    block-size: 28px;
    margin-inline-end: 2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--chronos-fg-muted);
    cursor: pointer;
}
.tat-chip-x .material-icons { font-size: 14px; }
.tat-chip-x:hover:not(:disabled) { color: var(--chronos-red); }

.tat-add {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-block-size: 32px;
    padding-inline: 8px 12px;
    border: 1px dashed var(--chronos-outline);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--chronos-fg-muted);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tat-add .material-icons { font-size: 16px; }
.tat-add:hover:not(:disabled),
.tat-add.is-open {
    border-color: color-mix(in srgb, var(--chronos-violet) 45%, transparent);
    color: var(--chronos-violet);
}

.tat-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--chronos-outline);
    border-radius: var(--radius-card);
    background: var(--chronos-card-bg);
}
.tat-search { inline-size: 100%; min-inline-size: 0; }
.tat-picks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-block-size: 168px;
    overflow-y: auto;
}
.tat-pick {
    display: flex;
    align-items: center;
    gap: 6px;
    inline-size: 100%;
    min-block-size: 36px;
    padding: 4px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--text-sm);
    text-align: start;
    cursor: pointer;
}
.tat-pick:hover:not(:disabled) { background: color-mix(in srgb, var(--chronos-violet) 10%, transparent); }
.tat-pick .material-icons { flex: none; font-size: 16px; color: var(--chronos-violet); }
.tat-pick-text {
    flex: 1 1 auto;
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tat-pick-kind {
    flex: none;
    color: var(--chronos-fg-muted);
    font-size: var(--text-xs);
}
.tat-empty,
.tat-private {
    margin: 0;
    color: var(--chronos-fg-muted);
    font-size: var(--text-xs);
    line-height: 1.3;
}

/* A finger needs more than 32px: the rows and buttons grow where the pointer is coarse. */
@media (pointer: coarse) {
    .tat-row { --tat-btn: 40px; }
    .tat-chip-open { min-block-size: 40px; }
    .tat-chip-x { inline-size: 36px; block-size: 36px; }
    .tat-add { min-block-size: 40px; }
    .tat-pick { min-block-size: 44px; }
}
