/* ============================================================================
   Contigo Data Explorer — Drive viewer (Google-Drive-style)
   ============================================================================ */

.drive-page { padding: 16px 20px 40px; }

/* Preview disclaimer banner */
.drive-disclaimer {
  display: flex; align-items: center; gap: 10px;
  background: var(--yellow-soft); border: 1px solid var(--yellow);
  color: var(--text); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.drive-disclaimer strong { color: #8a5a00; }

/* Header + search */
.drive-head { margin-bottom: 14px; }
.drive-head h1 { font-size: 22px; margin: 0 0 2px; color: var(--text); }
.drive-head p { margin: 0; color: var(--text-secondary); font-size: 13px; }

.drive-searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: 24px; padding: 9px 16px; margin: 14px 0;
  box-shadow: var(--shadow-sm); max-width: 720px;
}
.drive-searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drive-searchbar .ds-icon { font-size: 16px; opacity: .7; }
.drive-searchbar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--text); font-family: var(--font);
}
.drive-searchbar .ds-clear {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1; padding: 0 4px;
}
.drive-search-hint { font-size: 12px; color: var(--text-muted); margin: -6px 0 14px; }

/* Path bar */
.drive-pathbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-bottom: 14px; font-size: 14px;
}
.drive-pathbar .dp-crumb {
  color: var(--accent); cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.drive-pathbar .dp-crumb:hover { background: var(--accent-soft); }
.drive-pathbar .dp-crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.drive-pathbar .dp-crumb.current:hover { background: transparent; }
.drive-pathbar .dp-sep { color: var(--text-muted); }

/* Toolbar + view toggle (list default, grid optional) */
.drive-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-bottom: 8px;
}
.drive-toolbar-label { font-size: 12px; color: var(--text-muted); }
.drive-view-toggle {
  display: inline-flex; border: 1px solid var(--border-strong);
  border-radius: var(--radius); overflow: hidden;
}
.drive-view-btn {
  border: none; background: var(--bg-raised); color: var(--text-secondary);
  padding: 6px 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.drive-view-btn:hover { background: var(--bg-sunken); color: var(--text); }
.drive-view-btn.active { background: var(--accent-soft); color: var(--accent); }

/* List view (Google Drive default style) */
.drive-list-wrap {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.drive-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.drive-list thead th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-secondary);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}
.drive-list tbody tr.drive-row {
  cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.drive-list tbody tr.drive-row:last-child { border-bottom: none; }
.drive-list tbody tr.drive-row:hover { background: var(--accent-soft); }
.drive-list td { padding: 9px 14px; vertical-align: middle; color: var(--text); }
.drive-list .dl-name { min-width: 200px; width: 45%; }
.drive-list .dl-name-inner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.drive-list .dl-icon { font-size: 18px; flex: none; }
.drive-list .dl-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.drive-list .dl-loc { color: var(--text-secondary); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-list .dl-owner { color: var(--text-secondary); font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-list .dl-size { color: var(--text-muted); font-size: 12px; white-space: nowrap; width: 72px; text-align: right; }

/* Section label */
.drive-section-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin: 18px 0 10px;
}

/* Grid */
.drive-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.drive-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
  min-width: 0;
}
.drive-card:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.drive-card .dc-icon { font-size: 22px; flex: none; }
.drive-card .dc-body { min-width: 0; flex: 1; }
.drive-card .dc-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drive-card .dc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.drive-empty { color: var(--text-muted); font-size: 14px; padding: 30px 4px; }

/* Search results */
.drive-results { display: flex; flex-direction: column; gap: 8px; }
.drive-result {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
}
.drive-result:hover { border-color: var(--accent); background: var(--accent-soft); }
.drive-result .dr-icon { font-size: 20px; }
.drive-result .dr-body { min-width: 0; flex: 1; }
.drive-result .dr-name { font-size: 14px; font-weight: 600; color: var(--text); }
.drive-result .dr-path { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.drive-result .dr-snippet {
  font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drive-result .dr-snippet mark, .drive-doc mark {
  background: var(--yellow-soft); color: var(--text); padding: 0 2px; border-radius: 2px;
}
.drive-result .dr-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 10px; flex: none;
  background: var(--bg-sunken); color: var(--text-secondary);
}
.drive-result .dr-tag.shared { background: var(--purple-soft); color: var(--purple); }
.drive-result .dr-tag.content { background: var(--green-soft); color: var(--green); }

/* Viewer */
.drive-viewer-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.drive-back-btn {
  border: 1px solid var(--border-strong); background: var(--bg-raised); color: var(--text);
  border-radius: var(--radius); padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.drive-back-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.drive-viewer-title { font-size: 16px; font-weight: 600; color: var(--text); min-width: 0; }

/* File details panel (anonymized index fields only — no CSV metadata) */
.drive-details {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.drive-details-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px;
}
.drive-detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 3px; }
.drive-detail-value { font-size: 13px; color: var(--text); word-break: break-word; }

.drive-doc-wrap { display: flex; justify-content: center; }
.drive-doc {
  background: #ffffff; color: #111;
  width: 100%; max-width: 850px; min-height: 400px;
  padding: 56px 64px; border-radius: 4px; box-shadow: var(--shadow-lg);
  font-family: 'Calibri', 'Inter', sans-serif; font-size: 15px; line-height: 1.6;
}
[data-theme="dark"] .drive-doc { background: #f7f7f7; }
.drive-doc img { max-width: 100%; height: auto; }
.drive-doc table { border-collapse: collapse; max-width: 100%; margin: 10px 0; }
.drive-doc td, .drive-doc th { border: 1px solid #ccc; padding: 6px 9px; vertical-align: top; }
.drive-doc h1, .drive-doc h2, .drive-doc h3 { color: #111; line-height: 1.3; }
.drive-doc p { margin: 0 0 10px; }
.drive-doc a { color: #0052cc; }

.drive-loading { color: var(--text-secondary); font-size: 14px; padding: 30px 4px; }
.drive-error {
  background: var(--red-soft); border: 1px solid var(--red); color: var(--text);
  border-radius: var(--radius); padding: 14px 16px; font-size: 13px;
}

/* ---- v0 Google Drive embed render ---- */
.drive-embed-wrap {
  width: 100%; height: calc(100vh - 250px); min-height: 520px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: #fff;
}
.drive-embed { width: 100%; height: 100%; border: 0; display: block; }
.drive-embed-note { font-size: 12px; color: var(--text-muted); margin: 8px 2px 0; }
.drive-open-ext {
  font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none;
  white-space: nowrap; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
}
.drive-open-ext:hover { background: var(--accent-soft); }
.drive-disclaimer-v0 { background: #eaf2ff; color: #1c3d6e; border-bottom: 1px solid #cfe0fb; }

/* ---- Google-Drive-style left rail (My Drive / Shared with me) ---- */
.drive-layout { display: flex; gap: 18px; align-items: flex-start; }
.drive-rail { width: 210px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.drive-rail-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 16px; border-radius: 0 999px 999px 0;
  font-size: 14px; color: var(--text); cursor: pointer;
}
.drive-rail-item:hover { background: var(--accent-soft); }
.drive-rail-item.active { background: #c2e7ff; color: #001d35; font-weight: 600; }
.drive-rail-item .dri-n { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.drive-rail-item.active .dri-n { color: #001d35; opacity: 0.7; }
#drive-body { flex: 1; min-width: 0; }
.ftic { width: 17px; height: 17px; display: inline-block; vertical-align: middle; }
.dl-icon, .dc-icon, .dr-icon { display: inline-flex; align-items: center; }
@media (max-width: 720px) {
  .drive-layout { flex-direction: column; }
  .drive-rail { width: 100%; flex-direction: row; flex-wrap: wrap; }
}
