/* ============================================================
   EXPLORER — Windows-style file manager view for Documents
   ============================================================ */

/* ---- Toolbar ---- */
.xp-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.xp-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xp-toolbar-right { display: flex; align-items: center; gap: 8px; }

.xp-newbtn-wrap { position: relative; }
.xp-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); min-width: 200px; padding: 6px; display: none;
}
.xp-menu.open { display: block; }
.xp-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--ink);
}
.xp-menu button:hover { background: var(--paper-dim); }
.xp-menu .swatch { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; }
.xp-menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ---- Breadcrumb ---- */
.xp-breadcrumb {
  display: flex; align-items: center; gap: 4px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: 13px; flex: 1; min-width: 220px;
}
.xp-breadcrumb .crumb {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; color: var(--ink-soft); font-weight: 500;
}
.xp-breadcrumb .crumb:hover { background: var(--paper-dim); color: var(--ink); }
.xp-breadcrumb .crumb.current { color: var(--ink); font-weight: 700; }
.xp-breadcrumb .crumb svg { width: 14px; height: 14px; stroke-width: 2; }
.xp-breadcrumb .sep { color: var(--ink-faint); }
.xp-breadcrumb .sep svg { width: 13px; height: 13px; }

/* ---- View toggle / sort ---- */
.xp-toggle-group { display: flex; background: var(--paper-dim); border-radius: 8px; padding: 3px; }
.xp-toggle-group button {
  width: 30px; height: 28px; border: none; background: none; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
}
.xp-toggle-group button svg { width: 15px; height: 15px; stroke-width: 1.8; }
.xp-toggle-group button.active { background: var(--surface); color: var(--ledger); box-shadow: var(--shadow-card); }

.xp-select {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; color: var(--ink-soft); font-family: var(--font-body);
}

/* ---- Explorer surface ---- */
.xp-surface {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  min-height: 420px; box-shadow: var(--shadow-card); position: relative;
}
.xp-statusbar {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 18px;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono);
}

/* ---- Grid (icon) view ---- */
.xp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px;
  padding: 18px; user-select: none;
}
.xp-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px;
  border-radius: 10px; border: 1.5px solid transparent; cursor: default; text-align: center;
}
.xp-tile:hover { background: var(--paper-dim); }
.xp-tile.selected { background: var(--ledger-100); border-color: var(--ledger); }
.xp-tile .xp-icon { width: 52px; height: 44px; display: flex; align-items: center; justify-content: center; }
.xp-tile .xp-icon svg.folder-svg { width: 52px; height: 42px; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08)); }
.xp-tile .xp-icon .file-ico { width: 42px; height: 42px; border-radius: 8px; }
.xp-tile .xp-icon .file-ico svg { width: 20px; height: 20px; }
.xp-tile .xp-label {
  font-size: 12px; line-height: 1.3; word-break: break-word; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xp-tile .xp-label input {
  width: 100%; font-size: 12px; text-align: center; border: 1px solid var(--ledger); border-radius: 4px;
  padding: 2px 4px; font-family: var(--font-body); outline: none;
}
.xp-tile .xp-meta { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-faint); }

/* ---- List (details) view ---- */
.xp-list-wrap { padding: 4px 4px 4px; }
table.xp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.xp-table thead th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 10px 18px; border-bottom: 1px solid var(--line);
}
table.xp-table tbody td { padding: 9px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.xp-table tbody tr { cursor: default; }
table.xp-table tbody tr:hover td { background: var(--paper-dim); }
table.xp-table tbody tr.selected td { background: var(--ledger-100); }
table.xp-table tbody tr:last-child td { border-bottom: none; }
.xp-row-name { display: flex; align-items: center; gap: 10px; }
.xp-row-name svg.folder-svg { width: 22px; height: 18px; flex-shrink: 0; }
.xp-row-name .file-ico { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; }
.xp-row-name .file-ico svg { width: 13px; height: 13px; }
.xp-row-name input {
  font-size: 13px; border: 1px solid var(--ledger); border-radius: 4px; padding: 2px 6px; outline: none; font-family: var(--font-body);
}

/* ---- Context menu ---- */
.ctx-menu {
  position: fixed; z-index: 100; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-pop); min-width: 190px; padding: 6px; display: none;
}
.ctx-menu.open { display: block; }
.ctx-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--ink);
}
.ctx-menu button svg { width: 15px; height: 15px; stroke-width: 1.8; color: var(--ink-soft); }
.ctx-menu button:hover { background: var(--paper-dim); }
.ctx-menu button.danger { color: var(--brick); }
.ctx-menu button.danger svg { color: var(--brick); }
.ctx-menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ---- Empty state ---- */
.xp-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 70px 20px; color: var(--ink-faint); gap: 10px; }
.xp-empty svg { width: 40px; height: 40px; stroke-width: 1.4; }

/* ---- Toast ---- */
.xp-toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.xp-toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 9px; animation: xp-in 0.18s ease;
}
.xp-toast svg { width: 15px; height: 15px; stroke-width: 2; color: var(--sage); flex-shrink: 0; }
@keyframes xp-in { from { opacity:0; transform: translateY(6px);} to { opacity:1; transform: translateY(0);} }

@media (max-width: 700px) {
  .xp-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
