/* ════════════════════════════════════════════════════════════════════
   styles/workspace-files.css — Workspace → Files (liquid glass)

   Scope: everything under [data-ws-section-view="files"], all classes
   prefixed .wf- to avoid collisions with other sections. No fixed brand
   colour — frosted glass over the animated orbs behind the workspace.
   ════════════════════════════════════════════════════════════════════ */

/* 2026-06-04 — Files fills its section frame exactly and NEVER pushes the
   pane to scroll. The old `height:calc(100vh-168px)` was a fragile absolute
   guess that didn't match the real ws-main content box (inset + padding), so
   on most viewports `.wf` overflowed and the whole right pane scrolled. Now
   the section + grid track the actual frame (height:100%) and the file list
   scrolls INTERNALLY via .wf-body/.wf-scroll. */
[data-ws-section-view="files"] { padding: 0; height: 100%; min-height: 0; overflow: hidden; }

.wf {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 0;
}
@media (max-width: 1040px) { .wf { grid-template-columns: 200px 1fr; } }

/* ─── shared glass surface ─────────────────────────────────────── */
.wf-glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0.035));
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(26px) saturate(165%);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.10);
}

/* ─── sidebar ──────────────────────────────────────────────────── */
.wf-side {
  display: flex; flex-direction: column;
  padding: 14px 12px; gap: 6px; overflow-y: auto;
  min-height: 0;   /* 2026-06-04 — scroll the folder list inside the fixed frame */
}
.wf-side::-webkit-scrollbar { width: 8px; }
.wf-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; }

.wf-meter { padding: 4px 8px 12px; }
.wf-meter__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.wf-meter__used { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.92); letter-spacing: -0.01em; }
.wf-meter__tier {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.62); padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.05);
}
.wf-meter__bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.10); overflow: hidden; }
.wf-meter__fill {
  height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, rgba(255,255,255,0.55), rgba(255,255,255,0.85));
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.wf-meter__fill.is-warn { background: linear-gradient(90deg, #f59e0b, #f87171); }
.wf-meter__sub { margin-top: 6px; font-size: 11px; color: rgba(255,255,255,0.5); }

.wf-side__label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: rgba(255,255,255,0.42); padding: 12px 8px 5px;
}
.wf-side__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 9px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: rgba(255,255,255,0.74);
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .16s, color .16s, border-color .16s;
}
.wf-side__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.wf-side__item.is-active {
  background: rgba(255,255,255,0.11); color: #fff;
  border-color: rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.wf-side__item svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .85; }
.wf-side__item .wf-side__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-side__count { font-size: 11px; color: rgba(255,255,255,0.45); font-variant-numeric: tabular-nums; }
.wf-side__sep { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 6px; }

/* ─── main column ──────────────────────────────────────────────── */
.wf-main { display: flex; flex-direction: column; gap: 14px; min-width: 0;
  /* 2026-06-04 — fill the section's fixed height + allow flex children to
     shrink so .wf-body's flex:1 and .wf-scroll's height:100% actually clamp
     and scroll INTERNALLY (was growing to content → whole pane scrolled). */
  height: 100%; min-height: 0; }

/* position+z-index so the "New" dropdown renders ABOVE the body panel
   (the body's backdrop-filter creates a stacking context that otherwise
   covers an absolutely-positioned dropdown). */
.wf-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: relative; z-index: 5; }
.wf-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.wf-crumb { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wf-crumb__title { font-size: 16px; font-weight: 650; color: #fff; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-crumb__chev { color: rgba(255,255,255,0.35); }
.wf-spacer { flex: 1; }

.wf-search {
  display: flex; align-items: center; gap: 8px; flex: 0 1 280px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.13);
}
.wf-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.5); flex: 0 0 auto; }
.wf-search input {
  border: 0; background: transparent; outline: none; width: 100%;
  color: #fff; font-size: 13px;
}
.wf-search input::placeholder { color: rgba(255,255,255,0.4); }

.wf-view { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); }
.wf-view button { width: 30px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: rgba(255,255,255,0.6); }
.wf-view button.is-active { background: rgba(255,255,255,0.14); color: #fff; }
.wf-view svg { width: 15px; height: 15px; }

.wf-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 11px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.92);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .16s, transform .12s, border-color .16s;
}
.wf-btn:hover { background: rgba(255,255,255,0.13); }
.wf-btn:active { transform: scale(.97); }
.wf-btn svg { width: 15px; height: 15px; }
.wf-btn--primary {
  background: rgba(255,255,255,0.16);
  color: #fff; border-color: rgba(255,255,255,0.30);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 10px rgba(0,0,0,0.14);
}
.wf-btn--primary:hover { background: rgba(255,255,255,0.24); border-color: rgba(255,255,255,0.4); }
.wf-btn--primary svg { opacity: 0.95; }

/* ─── body / grid / list ───────────────────────────────────────── */
.wf-body { position: relative; flex: 1; overflow: hidden; }
.wf-scroll { height: 100%; overflow-y: auto; padding: 16px; }
.wf-scroll::-webkit-scrollbar { width: 9px; }
.wf-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 9px; }

.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px; }
.wf-card {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  padding: 14px 12px 11px; border-radius: 15px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  transition: background .16s, transform .14s, border-color .16s, box-shadow .16s;
}
.wf-card:hover { background: rgba(255,255,255,0.10); transform: translateY(-2px); border-color: rgba(255,255,255,0.2); box-shadow: 0 10px 26px rgba(0,0,0,0.22); }
.wf-card.is-folder .wf-thumb { color: rgba(255,255,255,0.85); }
.wf-thumb {
  height: 78px; border-radius: 11px; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); overflow: hidden;
}
/* Absolute fill — grid centering was shrinking imgs to intrinsic height (thin strip bug) */
.wf-thumb img, .wf-thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block;
}
.wf-thumb svg { position: relative; z-index: 1; width: 34px; height: 34px; opacity: .9; }
.wf-thumb .wf-ext { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; color: rgba(255,255,255,0.75); margin-top: 4px; text-transform: uppercase; }
.wf-card__name { font-size: 12.5px; font-weight: 550; color: rgba(255,255,255,0.94); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.wf-card__meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: rgba(255,255,255,0.48); }

/* list view */
.wf-list { display: flex; flex-direction: column; }
.wf-row {
  display: grid; grid-template-columns: 28px 1fr 96px 120px 130px; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background .14s;
}
.wf-row:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.09); }
.wf-row__icon { display: grid; place-items: center; color: rgba(255,255,255,0.7); }
.wf-row__icon svg { width: 16px; height: 16px; }
.wf-row__name { font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.wf-row__sub { font-size: 12px; color: rgba(255,255,255,0.5); font-variant-numeric: tabular-nums; }
.wf-row__head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.38); border: 0; cursor: default; }
.wf-row__head:hover { background: transparent; }

/* source badges */
.wf-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; padding: 2px 6px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16); color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.05);
  white-space: nowrap;
}
.wf-badge--agent { color: #c4b5fd; border-color: rgba(167,139,250,0.4); background: rgba(124,92,250,0.12); }
.wf-badge--ref   { color: #7dd3fc; border-color: rgba(56,189,248,0.4); background: rgba(56,189,248,0.10); }
.wf-badge--star  { color: #fcd34d; border: 0; padding: 0; background: transparent; }

/* empty + loading */
.wf-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100%; min-height: 320px; text-align: center; padding: 40px; }
/* Only the big hero glyph (direct child) — NOT the icons inside the action
   buttons nested below, which were being inflated to 46px. */
.wf-empty > span > svg { width: 46px; height: 46px; color: rgba(255,255,255,0.3); }
.wf-empty h3 { margin: 0; font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.86); }
.wf-empty p { margin: 0; font-size: 13px; color: rgba(255,255,255,0.5); max-width: 320px; line-height: 1.5; }
.wf-empty__actions { display: flex; gap: 10px; margin-top: 4px; }
.wf-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px; }
.wf-skeleton > div { height: 132px; border-radius: 15px; background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%); background-size: 200% 100%; animation: wf-shimmer 1.3s infinite; }
@keyframes wf-shimmer { to { background-position: -200% 0; } }

/* drop overlay */
.wf-drop {
  position: absolute; inset: 8px; border-radius: 16px; z-index: 6;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px;
  background: rgba(20,20,30,0.55); border: 2px dashed rgba(255,255,255,0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 15px; font-weight: 600; pointer-events: none;
}
.wf-body.is-dragover .wf-drop { display: flex; }
.wf-drop svg { width: 38px; height: 38px; opacity: .9; }

/* ─── preview pane (slide-in right) — pure liquid glass ─────────── */
.wf-preview {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 70%); z-index: 8;
  display: flex; flex-direction: column; transform: translateX(102%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  border-radius: 18px 0 0 18px;
  background: rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.06);
  backdrop-filter: blur(40px) saturate(180%) brightness(1.06);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    -16px 0 48px rgba(0, 0, 0, 0.22);
}
.wf-preview.is-open { transform: translateX(0); }
/* shimmer loading state inside the preview body */
.wf-pv-load { display: flex; flex-direction: column; gap: 12px; }
.wf-pv-load__img, .wf-pv-load__line {
  border-radius: 12px;
  background: linear-gradient(100deg, rgba(255,255,255,0.05) 30%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.05) 70%);
  background-size: 200% 100%; animation: wf-shimmer 1.3s infinite;
}
.wf-pv-load__img { height: 230px; }
.wf-pv-load__line { height: 14px; }
.wf-pv-load p { margin: 6px 0 0; font-size: 12.5px; color: rgba(255,255,255,0.6); text-align: center; }
.wf-preview__head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}
.wf-preview__title { flex: 1; font-size: 14px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-preview__close {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.wf-preview__close:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.20); }
.wf-preview__body { flex: 1; overflow: auto; padding: 16px; background: transparent; }
.wf-preview__body img, .wf-preview__body video {
  display: block; max-width: 100%; margin: 0 auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  background: transparent;
}
.wf-preview__body audio { width: 100%; }
.wf-preview pre, .wf-editor {
  margin: 0; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, monospace; color: rgba(255,255,255,0.9);
  white-space: pre-wrap; word-break: break-word;
}
.wf-editor {
  width: 100%; min-height: 320px; resize: vertical; border-radius: 12px; padding: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255,255,255,0.12); outline: none;
}
.wf-preview__foot {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}
.wf-card-doc { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 20px; text-align: center; }
.wf-card-doc svg { width: 54px; height: 54px; color: rgba(255,255,255,0.6); }

/* ─── context menu ─────────────────────────────────────────────── */
.wf-menu {
  position: fixed; z-index: 40; min-width: 184px; padding: 6px;
  border-radius: 13px; display: none; flex-direction: column;
}
.wf-menu.is-open { display: flex; }
.wf-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 0; background: transparent; color: rgba(255,255,255,0.85); font-size: 13px;
  border-radius: 9px; cursor: pointer; text-align: left;
}
.wf-menu button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.wf-menu button.is-danger:hover { background: rgba(248,113,113,0.16); color: #fca5a5; }
.wf-menu svg { width: 15px; height: 15px; opacity: .8; }
.wf-menu__sep { height: 1px; background: rgba(255,255,255,0.08); margin: 5px 6px; }

/* ─── agent activity strip ─────────────────────────────────────── */
.wf-activity { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 12px; }
.wf-activity__dot { width: 7px; height: 7px; border-radius: 50%; background: #a78bfa; box-shadow: 0 0 0 3px rgba(167,139,250,0.18); flex: 0 0 auto; }
.wf-activity__txt { flex: 1; color: rgba(255,255,255,0.66); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-activity__txt b { color: rgba(255,255,255,0.9); font-weight: 600; }

/* New-menu dropdown */
.wf-newmenu { position: relative; }
.wf-newmenu__pop {
  position: absolute; top: 44px; right: 0; z-index: 60; min-width: 196px; padding: 6px;
  border-radius: 13px; display: none; flex-direction: column;
}
.wf-newmenu.is-open .wf-newmenu__pop { display: flex; }
.wf-newmenu__pop button { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: transparent; color: rgba(255,255,255,0.86); font-size: 13px; border-radius: 9px; cursor: pointer; text-align: left; }
.wf-newmenu__pop button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.wf-newmenu__pop svg { width: 15px; height: 15px; opacity: .8; }

.wf-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 60; padding: 11px 18px; border-radius: 12px; font-size: 13px; color: #fff;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 80vw;
}
.wf-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.wf-toast.is-err { border-color: rgba(248,113,113,0.5); color: #fecaca; }
