/* MyDrive — giao diện kiểu Google Drive */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f8fafd;
  color: #1f1f1f;
  font-size: 14px;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd6de; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab4c0; border: 2px solid transparent; background-clip: content-box; }

/* ---- Nút icon chung ---- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; color: #444746; flex: none;
}
.icon-btn:hover { background: #e4e9f1; }
.icon-btn.big { width: 40px; height: 40px; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.big svg { width: 22px; height: 22px; }

/* ---- Thanh trên cùng ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 14px; background: #f8fafd;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; color: #5e5e5e; user-select: none; margin-right: 6px; }
.brand-ic { font-size: 24px; }
.search {
  flex: 1; max-width: 720px; display: flex; align-items: center; gap: 10px;
  background: #e9eef6; border-radius: 24px; height: 48px; padding: 0 10px 0 16px;
}
.search:focus-within { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15), 0 0 0 1px #d3e3fd; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; color: #1f1f1f; }
.search svg { width: 20px; height: 20px; color: #444746; flex: none; }
.top-right { display: flex; gap: 2px; margin-left: auto; }
#viewToggle button {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: #444746;
}
#viewToggle button:hover { background: #e4e9f1; }
#viewToggle button.active { background: #c2e7ff; color: #001d35; }
#viewToggle svg { width: 20px; height: 20px; }

/* ---- Khung chính ---- */
.shell { display: flex; align-items: flex-start; }
.sidebar {
  width: 256px; flex: none; padding: 6px 12px 20px;
  position: sticky; top: 64px; align-self: flex-start;
  max-height: calc(100vh - 64px); overflow: auto;
}
body.sb-hidden .sidebar { display: none; }
.new-wrap { position: relative; padding: 4px 0 4px 4px; }
.btn-new {
  display: inline-flex; align-items: center; gap: 12px;
  background: #c2e7ff; color: #001d35; font-weight: 600; font-size: 14px;
  height: 52px; padding: 0 22px 0 16px; border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.14);
}
.btn-new:hover { background: #b3ddfe; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.btn-new svg { width: 22px; height: 22px; }
.nav { display: flex; flex-direction: column; margin-top: 12px; }
.nav button {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px; height: 38px; border-radius: 0 19px 19px 0;
  font-size: 13.5px; color: #1f1f1f; text-align: left; margin-right: 10px;
}
.nav button:hover { background: #e4e9f1; }
.nav button.active { background: #d3e3fd; font-weight: 600; color: #041e49; }
.nav-ic { font-size: 16px; width: 20px; text-align: center; }
.nav .g-dot { margin-left: auto; }
.storage { margin-top: 20px; padding: 0 16px; font-size: 12.5px; color: #5e5e5e; }
.usage-bar { height: 4px; background: #dde1e7; border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.usage-bar i { display: block; height: 100%; width: 0; background: #0b57d0; border-radius: 2px; transition: width .3s; }
.usage-bar.g { margin-top: 10px; }
.usage-bar.g i { background: #34a853; }

.main {
  flex: 1; min-width: 0; background: #fff;
  border-radius: 16px; margin: 0 12px 12px 4px;
  min-height: calc(100vh - 76px);
}
body.sb-hidden .main { margin-left: 12px; }

/* ---- Thanh công cụ ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 14px; min-height: 36px; }
.crumb { padding: 6px 10px; border-radius: 8px; color: #444746; }
.crumb:hover { background: #f0f4f9; }
.crumb.current { color: #1f1f1f; font-weight: 600; cursor: default; }
.crumb.current:hover { background: none; }
.crumb-sep { color: #9aa0a6; }
.crumb-q { padding: 6px 2px; font-weight: 600; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #444746; user-select: none; cursor: pointer; }
.group-toggle input { accent-color: #0b57d0; width: 16px; height: 16px; cursor: pointer; }
.group-toggle.disabled { opacity: .45; }
.btn-ghost {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #dadce0;
  font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; color: #444746; background: #fff;
}
.btn-ghost:hover { background: #f0f4f9; }
.btn-ghost svg { width: 16px; height: 16px; }
.btn-primary { height: 38px; padding: 0 20px; border-radius: 19px; background: #0b57d0; color: #fff; font-weight: 600; font-size: 14px; }
.btn-primary:hover { background: #0842a8; }
.btn-primary.danger { background: #d93025; }
.btn-primary.danger:hover { background: #b3261e; }

/* ---- Menu thả xuống ---- */
.menu {
  position: absolute; background: #fff; border-radius: 10px; z-index: 60; min-width: 210px;
  box-shadow: 0 2px 10px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.04);
  padding: 6px 0;
}
.menu.float { position: fixed; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; font-size: 13.5px; text-align: left; white-space: nowrap; }
.mi:hover { background: #f0f4f9; }
.mi.danger { color: #d93025; }
.mi .check { width: 18px; display: inline-flex; }
.mi .check svg { width: 16px; height: 16px; }
.mi-ic { width: 20px; text-align: center; }
.menu-sep { border-top: 1px solid #eceef1; margin: 6px 0; }
#newMenu { left: 0; top: calc(100% + 4px); }
#sortMenu { right: 0; top: calc(100% + 4px); }

/* ---- Tiêu đề cột (kiểu danh sách) ---- */
.list-head, .row {
  display: grid; grid-template-columns: 56px minmax(0,1fr) 150px 110px 48px;
  align-items: center; column-gap: 8px;
}
.list-head {
  position: sticky; top: 64px; z-index: 10; background: #fff;
  padding: 6px 20px; font-size: 12.5px; color: #444746; border-bottom: 1px solid #e8eaed;
}
.list-head .sortable { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; }
.list-head .sortable:hover { color: #1f1f1f; }
.list-head .arrow { color: #0b57d0; }

/* ---- Hàng (kiểu danh sách) ---- */
.row { padding: 0 20px; height: 44px; font-size: 13.5px; border-bottom: 1px solid #f2f4f7; }
.row:hover { background: #f0f4f9; }
.cell-ic { display: flex; align-items: center; }
.f-ic { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.cell-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-when { color: #5e5e5e; font-size: 12.5px; }
.cell-size { color: #5e5e5e; font-size: 12.5px; text-align: right; }
.row .more, .card .more { opacity: 0; }
.row:hover .more, .row .more.open, .card:hover .more, .card .more.open { opacity: 1; }

/* ---- Thẻ (kiểu lưới / thư viện) ---- */
.section { padding: 4px 0 10px; }
.section-head {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 26px 4px; font-size: 13.5px; font-weight: 600; color: #1f1f1f;
  cursor: pointer; user-select: none;
}
.section-head .chev {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: #444746; flex: none;
}
.section-head .chev svg { width: 16px; height: 16px; transition: transform .15s; }
.section-head .chev.closed svg { transform: rotate(-90deg); }
.section-count { color: #80868b; font-weight: 400; font-size: 12.5px; }
.cards { display: grid; gap: 12px; padding: 8px 20px 6px; }
.cards.grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cards.gallery { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  border: 1px solid #dde3ea; border-radius: 12px; overflow: hidden; background: #fff;
  display: flex; flex-direction: column; transition: box-shadow .12s;
}
.card:hover { box-shadow: 0 1px 6px rgba(0,0,0,.2); }
.card .thumb { height: 150px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cards.gallery .card .thumb { height: 215px; }
.card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.big-ic { width: 78px; height: 78px; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 38px; flex: none; }
.card-bar { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 12px; }
.card-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Trạng thái trống ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 90px 20px; color: #5e5e5e; text-align: center; }
.empty .e-ic { font-size: 58px; }
.empty .e-title { font-size: 17px; color: #1f1f1f; font-weight: 600; }

/* ---- Lớp phủ kéo–thả ---- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(248,250,253,.88); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.drop-box {
  border: 2px dashed #0b57d0; color: #0b57d0; border-radius: 20px;
  padding: 48px 72px; text-align: center; font-size: 20px; font-weight: 600; background: rgba(255,255,255,.6);
}
.drop-ic { font-size: 46px; margin-bottom: 10px; }
.drop-sub { font-size: 13px; font-weight: 400; color: #5e5e5e; margin-top: 8px; }

/* ---- Thông báo (toast) ---- */
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }
.toast {
  background: #1f1f1f; color: #fff; border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); font-size: 13px;
}
.t-row { display: flex; gap: 10px; align-items: flex-start; }
.t-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-sub { color: #c7c7c7; margin-top: 2px; }
.t-bar { height: 3px; background: #3c3c3c; border-radius: 2px; margin-top: 7px; overflow: hidden; }
.t-bar i { display: block; height: 100%; width: 0; background: #8ab4f8; transition: width .15s; }
.toast.done .t-sub { color: #81c995; }
.toast.err .t-sub { color: #f28b82; }
.toast.info { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toast.err.info span { color: #f28b82; }
.t-undo { color: #8ab4f8; font-weight: 600; flex: none; }

/* ---- Hộp xem trước ---- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.pv-panel { background: #fff; border-radius: 14px; width: min(1000px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid #eceef1; }
.pv-titles { flex: 1; min-width: 0; }
.pv-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-meta { font-size: 12px; color: #5e5e5e; margin-top: 2px; }
.pv-actions { display: flex; align-items: center; gap: 2px; }
.pv-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; background: #26272b; min-height: 300px; }
.pv-body img, .pv-body video { max-width: 100%; max-height: 82vh; min-height: 140px; object-fit: contain; display: block; border-radius: 4px; }
.pv-body iframe { width: 100%; height: 80vh; border: 0; background: #fff; }
.pv-text { margin: 0; padding: 20px; color: #e8eaed; font: 12.5px/1.6 Consolas, "Courier New", monospace; white-space: pre-wrap; word-break: break-word; align-self: stretch; }
.pv-fallback { color: #e8eaed; display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 48px; text-align: center; }
.pv-fallback .big-ic { background: #3c3d41; }
.pv-fallback .btn-primary { background: #8ab4f8; color: #062e6f; }
.pv-loading { color: #9aa0a6; padding: 40px; }
.pv-audio-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 30px; }
.pv-audio-wrap .pv-audio-ic { font-size: 64px; }
.pv-audio-wrap audio { width: min(480px, 80vw); }

/* ---- Hộp thoại ---- */
.dlg-panel { background: #fff; border-radius: 14px; width: min(420px, 94vw); padding: 22px; }
.dlg-title { font-size: 16px; font-weight: 600; }
.dlg-msg { color: #5e5e5e; font-size: 13.5px; margin-top: 8px; }
.dlg-input-wrap { margin-top: 14px; }
.dlg-input-wrap input { width: 100%; height: 40px; border: 1px solid #dadce0; border-radius: 8px; padding: 0 12px; font: inherit; outline: 0; }
.dlg-input-wrap input:focus { border-color: #0b57d0; box-shadow: 0 0 0 1px #0b57d0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---- Kéo–thả nội bộ (chuyển tệp vào thư mục) ---- */
.drag-target { outline: 2px dashed #0b57d0; outline-offset: -2px; background: #e8f0fe !important; }
.dragging { opacity: .45; }

/* ---- Màn hẹp ---- */
@media (max-width: 860px) {
  .group-toggle span { display: none; }
  .list-head, .row { grid-template-columns: 56px minmax(0,1fr) 48px; }
  .col-when, .col-size { display: none; }
  .brand span:last-child { display: none; }
}

/* ---- Vùng chọn kéo chuột & chọn nhiều mục ---- */
.marquee {
  position: fixed; z-index: 65; pointer-events: none;
  border: 1px solid rgba(11,87,208,.55); background: rgba(11,87,208,.10); border-radius: 2px;
}
.row.selected { background: #d3e3fd; }
.card.selected { border-color: #0b57d0; box-shadow: 0 0 0 1px #0b57d0 inset; background: #f4f8ff; }
.row.selected .more, .card.selected .more { opacity: 1; }

/* ---- Google Drive ---- */
.g-nav-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px; height: 38px; margin: 4px 10px 0 0;
  border-radius: 0 19px 19px 0; font-size: 13.5px; color: #1f1f1f; text-align: left; width: calc(100% - 10px);
}
.g-nav-btn:hover { background: #e4e9f1; }
.g-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; background: #9aa0a6; flex: none; }
.g-dot.on { background: #34a853; }
.google-body { margin-top: 12px; max-height: 62vh; overflow: auto; font-size: 13.5px; }
.g-hint { background: #e8f0fe; color: #041e49; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.g-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.75; color: #444746; }
.g-steps a { color: #0b57d0; }
.g-steps code, .g-note code { background: #f1f3f4; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.g-input { width: 100%; height: 40px; border: 1px solid #dadce0; border-radius: 8px; padding: 0 12px; font: inherit; outline: 0; margin-top: 8px; }
.g-input:focus { border-color: #0b57d0; box-shadow: 0 0 0 1px #0b57d0; }
.g-note { color: #5e5e5e; font-size: 12.5px; margin-top: 12px; line-height: 1.6; }
.g-status { background: #e6f4ea; color: #137333; border-radius: 8px; padding: 10px 12px; font-weight: 600; }
.g-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1f3f4; }
.g-row a { color: #0b57d0; text-decoration: none; }
.g-row a:hover { text-decoration: underline; }
.g-list-title { font-weight: 600; margin: 14px 0 4px; }
.g-progress { margin-top: 12px; }
.g-progress .t-bar { background: #e1e5ea; }
.g-progress .t-bar i { background: #34a853; }
.g-prog-text { color: #5e5e5e; font-size: 12.5px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-err { color: #d93025; font-size: 12.5px; padding: 3px 0; }

/* ---- Nơi lưu & tệp trên Drive ---- */
.dest-wrap { position: relative; }
#destMenu { right: 0; top: calc(100% + 4px); }
.mi.disabled { opacity: .55; }
.cloud-badge { font-size: 11px; margin-left: 4px; }
.card .thumb { position: relative; }
.thumb .cloud-badge {
  position: absolute; top: 6px; right: 6px; margin: 0;
  background: rgba(255,255,255,.92); border-radius: 8px; padding: 1px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ---- Trang Convert PDF ---- */
.conv-wrap { max-width: 1400px; margin: 16px auto; padding: 0 8px; }
.conv-drop { border: 2px dashed #c4c7c5; border-radius: 14px; padding: 36px 20px; text-align: center; color: #5e5e5e; cursor: pointer; transition: .15s; background: #fafbfc; }
.conv-drop:hover, .conv-drop.over { border-color: #0b57d0; background: #f4f8fe; }
.conv-fmt { display: flex; align-items: center; gap: 10px; margin: 16px 2px 10px; color: #3c4043; font-size: 13.5px; }
.conv-fmt select { height: 36px; border: 1px solid #dadce0; border-radius: 8px; padding: 0 8px; background: #fff; font: inherit; cursor: pointer; }
.conv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e3e5ea; border-radius: 12px; margin-bottom: 8px; background: #fff; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-name .cell-size { color: #80868b; font-weight: 400; margin-left: 6px; }
.conv-sub { font-size: 12px; color: #80868b; margin-top: 2px; }
.conv-bar { height: 5px; background: #e1e5ea; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.conv-bar i { display: block; height: 100%; background: #0b57d0; width: 0; transition: width .2s; }
.conv-err { color: #d93025; font-size: 12px; margin-top: 2px; }
.conv-ok { color: #137333; font-size: 12px; margin-top: 2px; }
.conv-row button:disabled { opacity: .5; cursor: default; }
.conv-src { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; font-size: 13px; color: #3c4043; flex-wrap: wrap; }
.conv-src #convSrcText b { color: #137333; }
.conv-cfg { border: 1px solid #e3e5ea; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }

/* ---- Khung so sánh song song PDF ↔ kết quả convert ---- */
.conv-item { margin-bottom: 12px; }
.conv-item .conv-row { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.conv-item .conv-split + .conv-row, .conv-item > .conv-row:only-child { border-radius: 12px; }
.conv-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; border: 1px solid #e3e5ea; border-top: 0; border-radius: 0 0 12px 12px; background: #f8f9fa; }
.conv-pane { border: 1px solid #e3e5ea; border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.conv-pane-title { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: #3c4043; background: #f1f3f4; border-bottom: 1px solid #e3e5ea; }
.conv-pane-title .t-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-pane-title .btn-ghost { height: 28px; padding: 0 10px; font-size: 12px; }
.conv-frame { width: 100%; height: max(640px, calc(100vh - 240px)); border: 0; background: #525659; }
.conv-pane-body { height: max(640px, calc(100vh - 240px)); overflow: auto; background: #fff; }
.conv-pane-body pre { margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 Consolas, Menlo, monospace; }
.conv-pane-body .docx-wrapper { background: #e8eaed; padding: 12px; min-height: 100%; box-sizing: border-box; }
.conv-pane-body .docx-wrapper > section.docx { box-shadow: 0 1px 5px rgba(0,0,0,.18); margin-bottom: 14px; }
.conv-fallback { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 320px; gap: 12px; color: #5e5e5e; text-align: center; padding: 20px; font-size: 13px; line-height: 1.6; }
@media (max-width: 900px) { .conv-split { grid-template-columns: 1fr; } .conv-frame, .conv-pane-body { height: 420px; } }
.conv-order { display: flex; flex-direction: column; gap: 2px; }
.conv-order .icon-btn { width: 26px; height: 22px; padding: 0; font-size: 12px; line-height: 1; }
.conv-pages { width: 170px; height: 34px; border: 1px solid #dadce0; border-radius: 8px; padding: 0 8px; font: inherit; font-size: 12px; color: #3c4043; }
.conv-pages:focus { border-color: #0b57d0; outline: 0; }
.conv-pages:disabled { opacity: .5; }
@media (max-width: 900px) { .conv-pages { width: 110px; } }
.conv-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 12px; }
.conv-thumb { margin: 0; }
.conv-thumb img { width: 100%; height: 190px; object-fit: cover; border: 1px solid #e3e5ea; border-radius: 8px; background: #f1f3f4; display: block; }
.conv-thumb figcaption { font-size: 11.5px; color: #5e5e5e; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
