*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --hdr: 64px;
  --sidebar: 256px;
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --surface: #fff;
  --text: #202124;
  --muted: #5f6368;
  --border: #e0e0e0;
  --hover: #f1f3f4;
  --active-bg: #c2e7ff;
  --active-text: #041e49;
}

body { font-family: 'Google Sans', Roboto, Arial, sans-serif; color: var(--text); background: #fff; }

/* ── Layout ── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.body-wrap { display: flex; flex: 1; overflow: hidden; }

/* ── Header ── */
.header {
  height: var(--hdr); display: flex; align-items: center; padding: 0 16px; gap: 8px;
  border-bottom: 1px solid var(--border); background: #fff; position: relative; z-index: 100;
}
.menu-toggle { flex-shrink: 0; }
.logo-link { display: flex; align-items: center; gap: 4px; text-decoration: none; padding: 8px; border-radius: 50%; flex-shrink: 0; }
.logo-link:hover { background: var(--hover); }
.logo-svg { width: 40px; height: 34px; }
.logo-text { font-size: 22px; color: #5f6368; font-weight: 400; white-space: nowrap; }
.search-wrap { flex: 1; display: flex; justify-content: center; padding: 0 16px; }
.search-bar {
  display: flex; align-items: center; gap: 12px; background: #f1f3f4; border-radius: 24px;
  padding: 0 20px; height: 46px; width: 100%; max-width: 720px;
  transition: background .2s, box-shadow .2s;
}
.search-bar:focus-within { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 4px 8px rgba(0,0,0,.1); }
.search-input { flex: 1; border: none; background: transparent; font-size: 16px; color: var(--text); outline: none; font-family: inherit; }
.header-right { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #5f6368; }
.icon-btn:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #1a73e8; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; cursor: pointer; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar); background: #fff; display: flex; flex-direction: column;
  padding: 8px 0 16px; flex-shrink: 0; overflow-y: auto;
}
.new-btn-wrap { position: relative; padding: 8px 12px; }
.new-btn {
  display: flex; align-items: center; gap: 12px; padding: 0 24px 0 16px; height: 56px;
  background: #fff; border: 1px solid #dadce0; border-radius: 28px;
  font-size: 14px; font-family: inherit; color: var(--text); cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); transition: box-shadow .15s, background .15s;
  width: 100%;
}
.new-btn:hover { box-shadow: 0 2px 6px rgba(0,0,0,.2); background: #f8f9fa; }
.new-menu {
  position: absolute; top: 72px; left: 12px; width: 220px;
  background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.2);
  padding: 8px 0; z-index: 200; display: none;
}
.new-menu.open { display: block; }
.new-menu-item { display: flex; align-items: center; gap: 16px; padding: 10px 16px; font-size: 14px; color: var(--text); cursor: pointer; }
.new-menu-item:hover { background: var(--hover); }
.new-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.sidebar-nav { padding: 4px 0; }
.nav-item {
  display: flex; align-items: center; gap: 16px; height: 40px;
  padding: 0 12px 0 24px; margin-right: 16px; border-radius: 0 20px 20px 0;
  font-size: 14px; color: var(--text); cursor: pointer; transition: background .1s;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--active-bg); color: var(--active-text); font-weight: 500; }
.nav-item svg { flex-shrink: 0; }
.sidebar-storage { margin-top: auto; padding: 16px 24px; }
.storage-bar { height: 4px; background: #e8eaed; border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.storage-fill { height: 100%; background: var(--blue); border-radius: 2px; }
.storage-text { font-size: 12px; color: var(--muted); }

/* ── Main ── */
.main { flex: 1; overflow-y: auto; background: #fff; }
.main-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 24px; min-height: 52px;
}
.breadcrumb { display: flex; align-items: center; gap: 2px; }
.breadcrumb-item { font-size: 16px; color: var(--text); padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.breadcrumb-item:hover { background: var(--hover); }
.breadcrumb-item:last-child { pointer-events: none; }
.breadcrumb-sep { color: var(--muted); font-size: 16px; }
.view-controls { display: flex; gap: 2px; }
.view-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.view-btn:hover { background: var(--hover); }
.view-btn.active { color: var(--blue); }

/* ── File Grid ── */
.files-container { padding: 0 16px 24px; }
.section-label { font-size: 14px; color: var(--muted); padding: 8px 8px 4px; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding-bottom: 8px; }
.file-card {
  position: relative; border: 1px solid #e0e0e0; border-radius: 8px;
  overflow: hidden; cursor: pointer; background: #fff;
  transition: box-shadow .1s, background .1s; user-select: none;
}
.file-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.file-card.selected { background: #e8f0fe; border-color: #1a73e8; }
.file-preview {
  height: 118px; display: flex; align-items: center; justify-content: center;
  background: #f8f9fa; border-bottom: 1px solid #e0e0e0; pointer-events: none;
}
.file-footer { padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.file-footer-info { flex: 1; overflow: hidden; }
.file-name { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.file-more-btn { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; opacity: 0; }
.file-card:hover .file-more-btn { opacity: 1; }
.file-more-btn:hover { background: var(--hover); }

/* ── File List ── */
.files-list { display: flex; flex-direction: column; }
.list-header { display: grid; grid-template-columns: 1fr 140px 160px 48px; padding: 4px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.list-item { display: grid; grid-template-columns: 1fr 140px 160px 48px; align-items: center; padding: 0 16px; height: 48px; cursor: pointer; border-radius: 4px; }
.list-item:hover { background: var(--hover); }
.list-item.selected { background: #e8f0fe; }
.list-name-cell { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.list-item-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-size, .list-date { font-size: 13px; color: var(--muted); }
.list-actions { display: flex; justify-content: flex-end; }
.list-more-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); opacity: 0; }
.list-item:hover .list-more-btn { opacity: 1; }
.list-more-btn:hover { background: var(--hover); }

/* ── File icons ── */
.icon-folder { color: #5f6368; }
.icon-doc { color: #4285f4; }
.icon-sheet { color: #0f9d58; }
.icon-file { color: #5f6368; }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 80px 24px; text-align: center; }
.empty-state svg { color: #e0e0e0; }
.empty-state h3 { font-size: 22px; font-weight: 400; color: var(--text); margin-top: 16px; }
.empty-state p { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ── Context menu ── */
.context-menu { position: fixed; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.2); padding: 8px 0; min-width: 200px; z-index: 1000; display: none; }
.context-menu.open { display: block; }
.ctx-item { padding: 10px 20px; font-size: 14px; color: var(--text); cursor: pointer; }
.ctx-item:hover { background: var(--hover); }
.ctx-item.ctx-danger { color: #d93025; }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 8px; padding: 24px; min-width: 400px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.modal h2 { font-size: 18px; font-weight: 400; margin-bottom: 16px; }
.modal input { width: 100%; padding: 12px 16px; border: 1px solid #dadce0; border-radius: 4px; font-size: 16px; outline: none; font-family: inherit; }
.modal input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-text { padding: 8px 24px; border: none; background: transparent; color: var(--blue); font-size: 14px; cursor: pointer; border-radius: 4px; font-family: inherit; }
.btn-text:hover { background: #e8f0fe; }
.btn-primary { padding: 8px 24px; border: none; background: var(--blue); color: #fff; font-size: 14px; cursor: pointer; border-radius: 4px; font-family: inherit; }
.btn-primary:hover { background: var(--blue-dark); }

/* ── Drop overlay ── */
.drop-overlay { position: fixed; inset: 0; background: rgba(26,115,232,.08); border: 3px dashed var(--blue); z-index: 9000; display: none; align-items: center; justify-content: center; pointer-events: none; }
.drop-overlay.active { display: flex; }
.drop-msg { font-size: 24px; font-weight: 500; color: var(--blue); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 12px 24px; border-radius: 4px; background: #323232; color: #fff; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 200; height: 100%; box-shadow: 4px 0 8px rgba(0,0,0,.2); transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .logo-text { display: none; }
}
