/* GDrive Explorer — Windows 11 File Explorer look */
:root {
  --bg: #f3f3f3;
  --panel: #ffffff;
  --sidebar: #f9f9f9;
  --border: #e3e3e3;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --accent: #0067c0;
  --hover: #e9e9e9;
  --selected: #cfe6f8;
  --danger: #d13438;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px; color: var(--text); background: #d9dee5;
  user-select: none;
}
.hidden { display: none !important; }
button { font-family: inherit; }

/* ===== App frame ===== */
.explorer {
  display: flex; flex-direction: column; height: 100vh; max-width: 1600px;
  margin: 0 auto; background: var(--bg);
  border: 1px solid #c7ccd4; border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.25);
}

/* ===== Title bar ===== */
.titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: linear-gradient(#fdfdfd, #f1f1f1);
  border-bottom: 1px solid var(--border);
}
.titlebar-left { display: flex; align-items: center; gap: 8px; }
.app-icon { width: 20px; height: 20px; }
.app-title { font-weight: 600; }
.mode-badge {
  font-size: 11px; background: #e8f3ff; color: var(--accent);
  border: 1px solid #bcdcfb; padding: 2px 8px; border-radius: 20px;
}
.titlebar-right { display: flex; align-items: center; gap: 10px; }
.drive-switcher { display: flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; border-radius: 20px;
  padding: 3px 8px 3px 3px; font-size: 12px; max-width: 230px;
}
.chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chip img { width: 20px; height: 20px; border-radius: 50%; }
.chip .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .chip-x {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px;
}
.chip .chip-x:hover { color: var(--danger); }
.chip.needs-auth { opacity: .55; border-style: dashed; }
.add-drive {
  border: 1px dashed var(--accent); background: #fff; color: var(--accent);
  border-radius: 20px; padding: 5px 12px; cursor: pointer; font-size: 12px;
}
.add-drive:hover { background: #e8f3ff; }
.add-drive.big { font-size: 15px; padding: 10px 26px; margin: 8px 0; }
.remember { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.signout-all {
  border: 1px solid var(--border); background: #fff; border-radius: 20px;
  padding: 5px 12px; cursor: pointer; color: var(--danger); font-size: 12px;
}
.signout-all:hover { background: #fdecec; }

/* ===== Setup banner ===== */
.setup-banner {
  background: #fff4d6; border-bottom: 1px solid #e8d48a; color: #5c4b00;
  padding: 8px 14px; font-size: 13px;
}
.setup-banner code { background: #fff; padding: 1px 6px; border-radius: 4px; border: 1px solid #e8d48a; }

/* ===== Tab bar ===== */
.tabbar { display: flex; align-items: flex-end; padding: 6px 12px 0; gap: 6px; }
.tab {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 7px 12px; max-width: 320px;
}
.tab-icon { width: 16px; height: 16px; }
.tab .tab-close { cursor: pointer; color: var(--muted); padding: 0 2px; }
.tab .tab-close:hover { color: var(--danger); }
.tabs-spacer { flex: 1; }
.account-tag { font-size: 12px; color: var(--muted); padding-bottom: 8px; }

/* ===== Command bar ===== */
.commandbar {
  display: flex; align-items: center; gap: 2px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; margin: 0 12px; padding: 4px 6px;
}
.cmd {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: none; cursor: pointer; padding: 6px 10px;
  border-radius: 6px; font-size: 11px; color: var(--text); min-width: 62px;
}
.cmd:hover:not(:disabled) { background: var(--hover); }
.cmd:disabled { opacity: .35; cursor: default; }
.cmd.danger { color: var(--danger); }
.cmd-sep { width: 1px; align-self: stretch; background: var(--border); margin: 4px 6px; }

/* ===== Address bar ===== */
.addressbar {
  display: flex; align-items: center; gap: 6px; margin: 6px 12px 0;
}
.nav-btn {
  border: none; background: none; font-size: 16px; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; color: var(--text);
}
.nav-btn:hover:not(:disabled) { background: var(--hover); }
.nav-btn:disabled { opacity: .3; cursor: default; }
.crumbs {
  flex: 1; display: flex; align-items: center; background: #fff;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
  overflow-x: auto; white-space: nowrap;
}
.crumb { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.crumb:hover { background: var(--hover); }
.crumb-sep { color: var(--muted); margin: 0 2px; }
.searchbox { position: relative; width: 260px; }
.searchbox input {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 30px 7px 10px; font-size: 13px; outline: none; background: #fff;
}
.searchbox input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ===== Main ===== */
.main { flex: 1; display: flex; min-height: 0; margin: 6px 12px 0; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar);
  border: 1px solid var(--border); border-radius: 8px 0 0 8px;
  border-right: none; display: flex; flex-direction: column; overflow: hidden;
}
.side-section { padding: 6px 0; border-bottom: 1px solid var(--border); }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px;
  cursor: pointer; border-radius: 0;
}
.side-item:hover { background: var(--hover); }
.side-item.active { background: var(--selected); font-weight: 600; }
.side-label { font-size: 11px; color: var(--muted); padding: 10px 14px 4px; text-transform: uppercase; letter-spacing: .5px; }
.tree { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.tree-node { }
.tree-row {
  display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 12px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-row:hover { background: var(--hover); }
.tree-row.active { background: var(--selected); }
.tree-toggle {
  width: 16px; text-align: center; color: var(--muted); cursor: pointer; font-size: 10px;
}
.tree-children { }
.storage { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; }
.storage-bar { height: 6px; background: #e0e0e0; border-radius: 3px; margin: 6px 0 4px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--accent); width: 0; border-radius: 3px; }
.storage-text { color: var(--muted); }

.content {
  flex: 1; background: #fff; border: 1px solid var(--border); border-radius: 0 8px 8px 0;
  position: relative; overflow: auto; min-width: 0; outline: none;
}
.empty-state { text-align: center; padding: 70px 20px; }
.empty-icon { width: 72px; height: 72px; opacity: .8; }
.empty-state h2 { margin: 18px 0 8px; }
.empty-state p { color: var(--muted); max-width: 460px; margin: 8px auto; }
.empty-state .tiny { font-size: 11px; }
.filewrap { min-height: 100%; }

/* Details (table) view */
.details-view { width: 100%; border-collapse: collapse; font-size: 13px; }
.details-view thead th {
  position: sticky; top: 0; background: #fff; z-index: 1; text-align: left;
  font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border);
  padding: 8px 10px; cursor: pointer; user-select: none; white-space: nowrap;
}
.details-view thead th:hover { background: var(--hover); }
.details-view td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.details-view tbody tr { cursor: default; }
.details-view tbody tr:hover { background: #f5f9fd; }
.details-view tbody tr.selected { background: var(--selected); }
.details-view tbody tr.selected:hover { background: #c2dcf3; }
.item-icon { width: 22px; display: inline-block; text-align: center; margin-right: 8px; }
.badge { font-size: 12px; margin-left: 6px; }
.badge.public { color: #0b7a3e; } .badge.shared { color: var(--accent); } .badge.private { color: #b5b5b5; }
.shortcut-arrow { color: var(--accent); font-size: 11px; margin-left: 4px; }

/* Icon / list views */
.grid-view { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; align-content: flex-start; }
.tile {
  width: 96px; padding: 10px 6px; text-align: center; border-radius: 6px;
  border: 1px solid transparent; cursor: default; overflow: hidden;
}
.tile:hover { background: #f5f9fd; }
.tile.selected { background: var(--selected); border-color: #9ecbf0; }
.tile .t-icon { font-size: 42px; line-height: 1.2; }
.tile .t-name { font-size: 12px; margin-top: 4px; word-break: break-word; max-height: 3.4em; overflow: hidden; }
.list-rows { padding: 6px 12px; }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: default;
}
.list-row:hover { background: #f5f9fd; }
.list-row.selected { background: var(--selected); }

/* Details pane */
.detailspane {
  width: 250px; flex-shrink: 0; background: var(--sidebar);
  border: 1px solid var(--border); border-left: none; border-radius: 0 8px 8px 0;
  padding: 14px; overflow-y: auto;
}
.dp-empty { color: var(--muted); text-align: center; margin-top: 60px; }
.dp-icon { font-size: 52px; text-align: center; }
.dp-name { font-weight: 600; text-align: center; margin: 10px 0; word-break: break-word; }
.dp-rows { font-size: 12px; }
.dp-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; gap: 8px; }
.dp-row .k { color: var(--muted); } .dp-row .v { text-align: right; overflow: hidden; text-overflow: ellipsis; }

/* Busy overlay */
.busy {
  position: absolute; inset: 0; background: rgba(255,255,255,.75); z-index: 5;
  display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
}
.spinner { width: 34px; height: 34px; border: 4px solid #d7e9fa; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Status bar ===== */
.statusbar {
  display: flex; align-items: center; gap: 8px; padding: 5px 14px;
  border-top: 1px solid var(--border); background: var(--sidebar);
  font-size: 12px; color: var(--muted); margin-top: 6px;
}
.status-sep { color: #c9c9c9; } .status-spacer { flex: 1; }

/* ===== Context menu ===== */
.ctx {
  position: fixed; z-index: 1000; min-width: 250px; max-height: 70vh; overflow-y: auto;
  background: #fff; border: 1px solid #cfd4da; border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 4px;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-radius: 5px; cursor: pointer; font-size: 13px;
}
.ctx-item:hover { background: var(--selected); }
.ctx-item.disabled { opacity: .35; pointer-events: none; }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.ctx-head { font-size: 11px; color: var(--muted); padding: 6px 12px 2px; text-transform: uppercase; letter-spacing: .5px; }
.ctx-icon { width: 20px; text-align: center; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1100;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 10px; width: 460px; max-width: 92vw; max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-title { padding: 16px 20px 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 14px 20px; overflow-y: auto; font-size: 13px; }
.modal-actions { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.btn {
  padding: 7px 18px; border-radius: 6px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--border); background: #fff;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0057a3; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.modal input[type=text], .modal input[type=email] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; margin: 6px 0;
}
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.perm-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.perm-row .p-email { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.perm-row select { font-size: 12px; }
.link-row { display: flex; gap: 6px; margin-top: 10px; }
.link-row input { flex: 1; }

/* ===== Toasts ===== */
.toasts { position: fixed; bottom: 60px; right: 20px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #323232; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.3); max-width: 420px;
}
.toast.ok { background: #107c10; } .toast.err { background: #a4262c; }

@media (max-width: 1100px) {
  .detailspane { display: none; }
  .sidebar { width: 190px; }
  .searchbox { width: 180px; }
}
