@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --card: #1c1c1c;
  --border: #2a2a2a;
  --accent: #7c6fff;
  --accent-dim: rgba(124,111,255,0.15);
  --accent-hover: #9487ff;
  --text: #f0f0f0;
  --text-secondary: #7a7a7a;
  --text-dim: #4a4a4a;
  --danger: #ff4757;
  --danger-dim: rgba(255,71,87,0.15);
  --success: #2ed573;
  --warning: #ffa502;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --nav-h: 64px;
  --top-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: 1rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Layout ── */
.page { min-height: 100dvh; display: flex; flex-direction: column; }
.page-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.page-content.no-nav { padding-bottom: 16px; }

/* ── Top Bar ── */
.topbar {
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.topbar-title { font-size: 1.1rem; font-weight: 600; flex: 1; }
.topbar-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.topbar-icon:hover, .topbar-icon:active { background: var(--card); color: var(--text); }
.topbar-icon svg { width: 20px; height: 20px; }

/* ── Bottom Nav ── */
.bottom-nav {
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 4px 0;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; }
.nav-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.nav-item.active .nav-dot { opacity: 1; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 48px; padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--card); color: var(--text); }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.input {
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .input-action {
  position: absolute; right: 0; top: 0;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}

/* ── File Grid ── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .file-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .file-grid { grid-template-columns: repeat(4, 1fr); }
}
.file-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex; flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
}
.file-card:active { transform: scale(0.97); }
.file-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.file-card-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.file-card-name {
  font-size: 0.85rem; font-weight: 500;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.file-card-meta { font-size: 0.75rem; color: var(--text-secondary); }
.file-card-menu {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.15s;
}
.file-card:hover .file-card-menu { opacity: 1; }

/* type colors */
.type-folder { background: rgba(255,165,0,0.15); color: #ffa502; }
.type-image { background: rgba(46,213,115,0.15); color: #2ed573; }
.type-video { background: rgba(124,111,255,0.15); color: #7c6fff; }
.type-doc { background: rgba(30,144,255,0.15); color: #1e90ff; }
.type-zip { background: rgba(255,71,87,0.15); color: #ff4757; }
.type-code { background: rgba(255,165,0,0.15); color: #ffa502; }
.type-note { background: rgba(255,215,0,0.15); color: #ffd700; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.85rem; color: var(--text-secondary);
  overflow-x: auto; white-space: nowrap;
  padding: 8px 0;
  scrollbar-width: none;
}
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb-item { color: var(--text-secondary); }
.breadcrumb-item.active { color: var(--text); font-weight: 500; }
.breadcrumb svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── FAB ── */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(124,111,255,0.4);
  z-index: 90;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:active { transform: scale(0.93); }
.fab svg { width: 24px; height: 24px; }

/* ── Bottom Sheet ── */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(4px);
}
.sheet-backdrop.open { opacity: 1; pointer-events: all; }
.sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border);
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-height: 90dvh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 16px;
}
.sheet-title {
  font-size: 1rem; font-weight: 600;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sheet-body { padding: 16px; }

/* ── Action Sheet Items ── */
.action-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.12s;
}
.action-item:hover, .action-item:active { background: var(--card); }
.action-item svg { width: 20px; height: 20px; color: var(--text-secondary); }
.action-item.danger { color: var(--danger); }
.action-item.danger svg { color: var(--danger); }

/* ── Progress Bar ── */
.progress-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.progress-bar.success { background: var(--success); }

/* ── Upload Items ── */
.upload-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.upload-item:last-child { border-bottom: none; }
.upload-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.upload-info { flex: 1; min-width: 0; }
.upload-name { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-size { font-size: 0.78rem; color: var(--text-secondary); }
.upload-status { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }

/* ── Tags / Pills ── */
.pill {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.82rem; font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.pill.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── Search Bar ── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 44px;
  margin-bottom: 12px;
}
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.95rem; flex: 1;
}
.search-bar svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }

/* ── Notes ── */
.note-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.note-list-item:hover, .note-list-item:active { background: var(--card); }
.note-list-item.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.note-title { font-size: 0.95rem; font-weight: 500; margin-bottom: 4px; }
.note-preview { font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note-date { font-size: 0.75rem; color: var(--text-dim); margin-top: 6px; }
.note-editor {
  width: 100%; flex: 1;
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.95rem;
  resize: none; line-height: 1.7;
  font-family: 'Inter', monospace;
  min-height: 300px;
}
.editor-toolbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.toolbar-btn {
  width: 34px; height: 34px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 0.82rem; font-weight: 600;
  transition: all 0.12s;
}
.toolbar-btn:hover { background: var(--card); color: var(--text); }
.toolbar-btn.active { background: var(--accent-dim); color: var(--accent); }

/* ── Storage ── */
.storage-ring { position: relative; display: inline-flex; }
.storage-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.storage-pct { font-size: 1.4rem; font-weight: 700; }
.storage-sub { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Share List ── */
.share-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.share-item:last-child { border-bottom: none; }
.share-info { flex: 1; min-width: 0; }
.share-file { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-exp { font-size: 0.78rem; color: var(--text-secondary); }

/* ── Preview ── */
.preview-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #000;
  position: relative;
  overflow: hidden;
}
.preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

/* ── Login ── */
.login-wrap {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-logo {
  width: 64px; height: 64px;
  background: var(--accent-dim);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  border: 1px solid rgba(124,111,255,0.3);
}
.login-logo svg { width: 32px; height: 32px; color: var(--accent); }
.login-card {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 16px;
}
.login-heading { font-size: 1.5rem; font-weight: 700; text-align: center; }
.login-sub { font-size: 0.9rem; color: var(--text-secondary); text-align: center; margin-bottom: 8px; }
.error-msg {
  background: var(--danger-dim);
  border: 1px solid rgba(255,71,87,0.3);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: none;
}
.error-msg.show { display: block; }

/* ── Empty State ── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-secondary);
  text-align: center;
}
.empty-icon { font-size: 3rem; opacity: 0.5; }
.empty-title { font-size: 1rem; font-weight: 500; color: var(--text); }
.empty-desc { font-size: 0.88rem; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ── Section Title ── */
.section-title {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 16px 0 8px;
}

/* ── Copy Box ── */
.copy-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 0 0 12px;
  height: 44px;
}
.copy-box span { flex: 1; font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn {
  height: 44px; padding: 0 14px;
  background: var(--accent-dim);
  color: var(--accent);
  border-left: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 500;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Toggle ── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0;
}
.toggle {
  width: 44px; height: 26px;
  background: var(--border);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(18px); }

/* ── Status Badge ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 0.72rem; font-weight: 500;
}
.badge-success { background: rgba(46,213,115,0.15); color: var(--success); }
.badge-warn { background: rgba(255,165,2,0.15); color: var(--warning); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }

/* ── Drop Zone ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.dropzone svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.6; }

/* ── Responsive ── */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  .bottom-nav { display: none; }
  .page-content { padding-bottom: 16px; }
  .fab { bottom: 24px; }
}
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}

/* ── Sidebar Drawer ─────────────────────────────────────────────────────── */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(3px);
}
.sidebar-backdrop.open { opacity: 1; pointer-events: all; }

.sidebar-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 272px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 301;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}
.sidebar-drawer.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.5); }

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  flex: 1; display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700; color: var(--text);
}
.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border-radius: 10px;
  border: 1px solid rgba(124,111,255,0.3);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-icon svg { width: 17px; height: 17px; color: var(--accent); }
.sidebar-close {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: background 0.12s;
}
.sidebar-close:hover { background: var(--card); color: var(--text); }

.sidebar-body {
  flex: 1; overflow-y: auto; padding: 8px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-label {
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 10px 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  border: none; background: none; width: 100%; text-align: left;
}
.sidebar-item:hover { background: var(--card); color: var(--text); }
.sidebar-item.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-item-badge {
  margin-left: auto;
  font-size: 0.72rem; font-weight: 600;
  background: var(--accent-dim); color: var(--accent);
  padding: 2px 7px; border-radius: 100px;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 6px 10px; }

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.sidebar-storage-head {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; margin-bottom: 6px;
}
.sidebar-storage-used { font-weight: 600; color: var(--text); }
.sidebar-storage-total { color: var(--text-secondary); }
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-top: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500;
  color: var(--danger); cursor: pointer;
  transition: background 0.12s;
  border: none; background: none; width: 100%;
}
.sidebar-logout:hover { background: var(--danger-dim); }
.sidebar-logout svg { width: 16px; height: 16px; }
