/* ═══ ANS Drive — Google Drive-style theme ═══ */
:root {
  --accent: #1a73e8;
  --accent-dark: #1b66c9;
  --accent-soft: #e8f0fe;
  --selected: #c2e7ff;
  --brand-red: #e11d48;
  --page: #f8fafd;          /* page background (Drive's light blue-grey) */
  --panel: #ffffff;
  --hover: #f1f3f4;
  --line: #dadce0;
  --line-soft: #eceef1;
  --text: #1f1f1f;
  --text-dim: #5f6368;
  --shadow: 0 1px 3px rgba(60,64,67,.18), 0 4px 10px rgba(60,64,67,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--page); color: var(--text); height: 100vh; overflow: hidden;
  font-size: 14px;
}
.hidden { display: none !important; }
svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── logo ── */
.logo-line { display: flex; align-items: center; gap: 8px; }
.logo-img { height: 26px; width: auto; max-width: 140px; object-fit: contain; }
.logo-img.lg { height: 40px; max-width: 210px; }
.logo-name { font-size: 20px; font-weight: 500; color: var(--text); }
/* "Drive" wordmark next to the logo — grey, light, like Google Drive */
.logo-tag { color: var(--text-dim); font-weight: 400; font-size: 21px; letter-spacing: 0; }
.logo-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.logo-big { margin-bottom: 26px; }

/* ── login ── */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--page); }
.login-card {
  width: 380px; background: #fff; border: 1px solid var(--line-soft);
  border-radius: 24px; padding: 40px 36px; box-shadow: var(--shadow);
}
.login-card label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 15px; outline: none; transition: border .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { color: #d93025; font-size: 13px; margin-top: 12px; }

/* ── buttons ── */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 10px 22px; border-radius: 22px; font-size: 14px; font-weight: 500;
  transition: background .15s, box-shadow .15s;
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: var(--shadow); }
.btn-block { width: 100%; margin-top: 24px; padding: 12px; }
.btn-nowrap { white-space: nowrap; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--text); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 22px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.btn-ghost:hover { background: var(--hover); }
.btn-text { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.btn-text:hover { color: var(--text); background: var(--hover); }
.icon-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(60,64,67,.12); color: var(--text); }

/* ── app layout ── */
.app { display: flex; flex-direction: column; height: 100vh; }

/* top app bar (Drive-style) */
.appbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; flex-shrink: 0;
}
.appbar-logo { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.search-box {
  flex: 1; max-width: 640px; display: flex; align-items: center; gap: 12px;
  background: #e9eef6; border: 1px solid transparent; border-radius: 24px; padding: 11px 18px;
  color: var(--text-dim); transition: background .15s, box-shadow .15s;
}
.search-box:focus-within { background: #fff; box-shadow: var(--shadow); }
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-red);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: #fff;
  cursor: default;
}

.app-body { flex: 1; display: flex; min-height: 0; }

/* sidebar */
.sidebar {
  width: 244px; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}
.new-wrap { position: relative; padding: 4px 4px 8px; }
.btn-new {
  background: #fff; color: var(--text); border: none;
  padding: 15px 24px 15px 18px; border-radius: 16px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  transition: box-shadow .15s, background .15s;
}
.btn-new:hover { background: #f8fafd; box-shadow: 0 2px 6px rgba(60,64,67,.25), 0 8px 18px rgba(60,64,67,.12); }
.btn-new svg { color: var(--text); width: 20px; height: 20px; }

/* dropdown + context menu */
.menu {
  position: absolute; z-index: 120; min-width: 180px;
  background: #fff; border-radius: 8px; padding: 6px 0;
  box-shadow: 0 2px 8px rgba(60,64,67,.28), 0 8px 24px rgba(60,64,67,.14);
}
.new-wrap .menu { top: 100%; left: 4px; margin-top: 4px; }
.ctx-menu { position: fixed; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; text-align: left; cursor: pointer;
  padding: 10px 18px; font-size: 14px; color: var(--text);
}
.menu-item:hover { background: var(--hover); }
.menu-item svg { color: var(--text-dim); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  border-radius: 24px; color: var(--text); font-size: 14px; cursor: pointer;
}
.side-link:hover { background: var(--hover); }
.side-link.active { background: var(--selected); color: #001d35; font-weight: 500; }

.storage-box { margin-top: auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.storage-ico { color: var(--text-dim); width: 20px; height: 20px; }
.storage-info { flex: 1; }
.storage-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
#storageFill { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .4s; }
.storage-text { font-size: 12px; color: var(--text-dim); margin-top: 7px; }
.mode-tag { font-size: 11px; color: var(--text-dim); text-align: center; padding-bottom: 4px; }

/* main content card */
.main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--panel); margin: 0 12px 12px 0; border-radius: 16px;
  overflow: hidden;
}
.main-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px 6px; }
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 17px; min-width: 0; overflow: hidden; }
.crumb { color: var(--text-dim); cursor: pointer; padding: 5px 10px; border-radius: 18px; white-space: nowrap; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text); }
.crumb-sep { color: var(--text-dim); font-size: 14px; }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; flex-shrink: 0; }
.vt-btn { background: #fff; border: none; padding: 7px 16px; cursor: pointer; color: var(--text-dim); display: flex; }
.vt-btn.active { background: var(--selected); color: #001d35; }
.vt-btn svg { width: 16px; height: 16px; }

/* trash banner */
.trash-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 6px 22px 0; padding: 10px 16px; border-radius: 10px;
  background: var(--hover); color: var(--text-dim); font-size: 13px;
}
.trash-banner .btn-text { color: var(--accent); font-weight: 600; }

/* star indicator */
.star-ind { width: 14px; height: 14px; flex-shrink: 0; }

/* sortable headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
.sort-arrow { font-size: 11px; }

/* ── file area ── */
.file-area { flex: 1; overflow-y: auto; padding: 4px 22px 22px; position: relative; }
.file-area.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: 16px; background: var(--accent-soft); }
.drop-hint {
  display: none; position: sticky; top: 8px; z-index: 5; text-align: center;
  background: var(--accent-soft); color: var(--accent); padding: 10px; border-radius: 10px; font-weight: 600;
}
.file-area.dragover .drop-hint { display: block; }

/* list view */
.file-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.file-table th {
  text-align: left; font-size: 13px; font-weight: 500; color: var(--text-dim);
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.file-table td { padding: 0 12px; height: 48px; border-bottom: 1px solid var(--line-soft); }
.file-row { cursor: pointer; user-select: none; }
.file-row:hover { background: var(--hover); }
.file-row.selected { background: var(--selected); }
.name-cell { display: flex; align-items: center; gap: 14px; min-width: 0; }
.name-cell .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficon { width: 22px; height: 22px; }
.ficon.big { width: 64px; height: 64px; }
.col-owner, .col-date { color: var(--text-dim); width: 170px; font-size: 13px; }
.col-size { color: var(--text-dim); width: 95px; font-size: 13px; }
.col-actions { width: 150px; text-align: right; }
.row-actions { display: flex; gap: 0; justify-content: flex-end; opacity: 0; }
.file-row:hover .row-actions, .file-row.selected .row-actions { opacity: 1; }

/* grid view */
.grid-label { font-size: 13px; font-weight: 500; color: var(--text-dim); margin: 14px 4px 10px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.folder-chip {
  display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 16px;
  background: var(--page); border-radius: 12px; cursor: pointer; user-select: none;
}
.folder-chip:hover { background: var(--hover); }
.folder-chip.selected { background: var(--selected); }
.folder-chip .fname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.chip-more { opacity: 0; }
.folder-chip:hover .chip-more { opacity: 1; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.file-card {
  background: var(--page); border-radius: 12px; overflow: hidden; cursor: pointer; user-select: none;
}
.file-card:hover { background: var(--hover); }
.file-card.selected { outline: 2px solid var(--accent); background: var(--accent-soft); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.card-head .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 13px; }
.card-thumb {
  height: 140px; margin: 0 8px 8px; border-radius: 8px; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.empty-state { text-align: center; padding: 90px 0; color: var(--text-dim); }
.empty-state svg { width: 60px; height: 60px; margin-bottom: 14px; opacity: .45; }
.empty-state p { font-size: 17px; color: var(--text); margin-bottom: 4px; }
.empty-state span { font-size: 13px; }

/* ── upload panel ── */
.upload-panel {
  position: fixed; right: 24px; bottom: 24px; width: 390px;
  background: #fff; border-radius: 14px 14px 0 0; overflow: hidden;
  box-shadow: 0 -2px 8px rgba(60,64,67,.15), 0 8px 28px rgba(60,64,67,.28); z-index: 50;
}
.upload-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #1f1f1f; color: #fff; font-size: 14px; font-weight: 500;
}
.upload-panel-head .btn-text { color: #bbb; }
.upload-panel-head .btn-text:hover { color: #fff; background: none; }
.upload-item { padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.upload-item-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.upload-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item-stat { color: var(--text-dim); white-space: nowrap; }
.upload-item-stat.done { color: #188038; }
.cancel-btn { padding: 4px 7px; font-size: 12px; border-radius: 50%; }
.progress { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ── modal ── */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 520px; max-width: 94vw; background: #fff; border-radius: 20px; padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { font-size: 19px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; margin-bottom: 18px; }
.user-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--page); border-radius: 12px; font-size: 14px;
}
.user-row .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .role { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 10px; font-weight: 600; }
.user-row .btn-text { margin-left: auto; }
.add-user-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-user-form input, .add-user-form select {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13px; outline: none; min-width: 0;
}
.add-user-form input:focus, .add-user-form select:focus { border-color: var(--accent); }
.add-user-form button { grid-column: span 2; }

/* share modal */
.share-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; line-height: 1.5; }
.share-new { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.share-new select {
  flex: 1; min-width: 150px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13px; outline: none;
}
.share-links { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.share-link-row { background: var(--page); border-radius: 12px; padding: 10px 12px; }
.share-link-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; flex-wrap: wrap; }
.share-link-top .tag { color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.share-link-top .btn-text { margin-left: auto; }
.share-link-url { display: flex; gap: 8px; }
.share-link-url input {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 12px; outline: none;
}
.share-link-url button {
  padding: 8px 16px; border-radius: 18px; border: none; background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.share-link-url button:hover { background: var(--accent-dark); }

/* ── preview overlay (dark, like Drive's) ── */
.preview-back {
  position: fixed; inset: 0; background: rgba(15, 15, 18, .95); z-index: 200;
  display: flex; flex-direction: column;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; flex-shrink: 0; color: #fff;
}
.preview-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.preview-actions .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.preview-actions .btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.preview-close { font-size: 18px; padding: 6px 12px; color: #ddd; }
.preview-close:hover { color: #fff; background: rgba(255,255,255,.12); }
.preview-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 12px 16px 20px; min-height: 0;
}
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.preview-body video { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; }
.preview-body iframe { width: 100%; height: 100%; border: none; border-radius: 8px; background: #fff; }
.preview-body .audio-wrap { text-align: center; width: min(520px, 92%); }
.preview-body .audio-wrap .audio-icon { font-size: 64px; margin-bottom: 20px; color: var(--brand-red); }
.preview-body audio { width: 100%; }

/* preview prev/next arrows */
.preview-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 210;
  width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font-size: 26px; line-height: 1;
}
.preview-nav:hover { background: rgba(255,255,255,.25); }
.preview-nav.prev { left: 18px; }
.preview-nav.next { right: 18px; }

/* move modal */
.move-crumbs { display: flex; align-items: center; gap: 2px; font-size: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.move-list { border: 1px solid var(--line-soft); border-radius: 12px; max-height: 300px; overflow-y: auto; margin-bottom: 14px; }
.move-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.move-row:last-child { border-bottom: none; }
.move-row:hover { background: var(--hover); }
.move-row .fname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move-row .open-arrow { color: var(--text-dim); }
.move-empty { padding: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }
.move-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* google login */
.google-btn-wrap { margin-bottom: 4px; }
#googleBtn { display: flex; justify-content: center; }
.or-div {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 2px;
  color: var(--text-dim); font-size: 12px;
}
.or-div::before, .or-div::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

/* folder permission modal */
.perm-list { border: 1px solid var(--line-soft); border-radius: 12px; max-height: 280px; overflow-y: auto; margin-bottom: 14px; }
.perm-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { background: var(--hover); }
.perm-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── responsive ── */
.menu-btn { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }

@media (max-width: 1000px) {
  .col-owner { display: none; }
  .appbar-logo { min-width: 0; }
}
@media (max-width: 768px) {
  .menu-btn { display: inline-flex; }
  .appbar { padding: 8px 10px; gap: 8px; }
  .appbar-logo .logo-tag { font-size: 15px; }
  .logo-img { height: 22px; max-width: 110px; }
  .search-box { padding: 9px 14px; }
  .user-chip .btn-text { display: none; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 95; width: 272px;
    transform: translateX(-105%); transition: transform .25s ease;
    background: #fff; box-shadow: 8px 0 30px rgba(0,0,0,.18); padding-top: 16px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin: 0; border-radius: 12px 12px 0 0; }
  .main-head { padding: 10px 12px 4px; }
  .col-date { display: none; }
  .col-actions { width: 96px; }
  .row-actions { opacity: 1; }
  .file-area { padding: 4px 8px 16px; }
  .file-table td { padding: 0 6px; }
  .file-table th { padding: 10px 6px; }
  .name-cell { gap: 10px; }
  .folder-grid, .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .card-thumb { height: 110px; }
  .upload-panel { left: 10px; right: 10px; bottom: 0; width: auto; }
  .modal { padding: 18px; border-radius: 16px; max-height: 88vh; overflow-y: auto; }
  .add-user-form { grid-template-columns: 1fr; }
  .add-user-form button { grid-column: auto; }
  .share-new { flex-direction: column; }
  .share-new select { min-width: 0; }
  .login-card { width: 94vw; max-width: 380px; padding: 28px 24px; }
  .preview-head { padding: 10px 12px; }
  .crumbs { font-size: 15px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c7cbd1; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
