/* Connected apps in the Drive (js/app-folders.js): the app's icon on its
   folder in /Apps, the card that stands for an app folder's files, the
   manage dialog and the note in a file's details. Tokens from style.css. */

.file-icon.af-has-badge { position: relative; }
.af-icon { display: inline-block; flex: none; border-radius: 22%; object-fit: cover; }
.af-icon-letter {
    width: var(--af-size, 24px);
    height: var(--af-size, 24px);
    display: inline-grid;
    place-items: center;
    background: var(--line-strong);
    color: var(--ink-soft);
    font-weight: var(--w-bold, 700);
    font-size: calc(var(--af-size, 24px) * 0.46);
    line-height: 1;
}
.af-badge {
    position: absolute;
    right: -4px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    box-shadow: 0 0 0 1.5px var(--bg-primary);
}
.af-badge.af-icon-letter { --af-size: 16px; }
/* In the grid the icon box fills the card's preview; sit on the folder
   drawn in its middle instead of the card's corner. */
.file-grid .af-badge { width: 20px; height: 20px; border-radius: 5px; right: auto; bottom: auto; left: calc(50% + 4px); top: calc(50% + 1px); }
.file-grid .af-badge.af-icon-letter { --af-size: 20px; }

.file-item.af-ended .file-name { color: var(--muted); }
.file-item.af-virtual { cursor: pointer; }
.file-item.af-virtual .af-placeholder { visibility: hidden; }

/* An app folder: one card for what is in it, the listing folded under it. */
.af-card {
    display: grid;
    gap: 8px;
    margin: 4px 0 6px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.af-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.af-card-titles { display: grid; gap: 2px; min-width: 0; flex: 1; }
.af-card-titles h3 { margin: 0; font-size: 15px; font-weight: var(--w-semibold, 600); letter-spacing: var(--track-tight, 0); }
.af-card-titles p { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.af-card .af-manage { flex: none; white-space: nowrap; }
.af-card-status { margin: 0; font-size: 13px; color: var(--ink-soft); }
.af-card-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

.af-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    font-weight: var(--w-semibold, 600);
    cursor: pointer;
}
.af-toggle svg { width: 14px; height: 14px; transition: transform 0.2s var(--ease-out-soft, ease); }
.af-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.af-toggle:focus-visible { outline: 2px solid var(--focus-ring, currentColor); outline-offset: 2px; border-radius: var(--radius-sm, 6px); }

#drive-files.af-folded > .file-list,
#drive-files.af-folded > .file-grid,
#drive-files.af-folded > .empty-state { display: none; }

@media (max-width: 640px) {
    .af-card { margin: 4px 12px 6px; }
    .af-card-head { flex-wrap: wrap; }
    /* The titles take the row; the button goes under them. */
    .af-card-titles { flex-basis: calc(100% - 52px); }
    .af-card .af-manage { margin-left: 52px; }
    .af-toggle { margin-left: 12px; }
}

/* Manage dialog */
.af-dialog { display: grid; gap: 18px; }
.af-dialog-head { display: flex; align-items: center; gap: 14px; }
.af-dialog-lines { display: grid; gap: 4px; min-width: 0; }
.af-dialog-lines b { font-weight: var(--w-semibold, 600); font-size: 14px; }
.af-dialog-lines span { font-size: 13px; color: var(--muted); }
.af-dialog-folder { display: inline-flex; align-items: center; gap: 6px; }
.af-dialog-folder svg { width: 14px; height: 14px; flex: none; }
.af-dialog-actions { flex-wrap: wrap; }

/* A file's details inside an app folder */
.af-info-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
}
.af-info-note p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .af-toggle svg { transition: none; }
}
