:root {
  --drive-bg: #ffffff;
  --drive-sidebar-bg: #f8f9fa;
  --drive-search-bg: #e9eef6;
  --drive-search-focus-bg: #ffffff;
  --drive-active-pill: #c2e7ff;
  --drive-active-text: #001d35;
  
  --text-primary: #1f1f1f;
  --text-secondary: #444746;
  --text-subtle: #747775;
  
  --folder-card-bg: #f0f4f9;
  --folder-card-hover: #e9eef6;
  --folder-card-border: #e1e8f0;
  
  --border-subtle: #e0e0e0;
  --border-light: #f1f3f4;

  --new-btn-bg: #ffffff;
  --new-btn-text: #1f1f1f;
  --new-btn-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  
  --font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-pill: 28px;
  --radius-card: 12px;
  --radius-sm: 8px;
  
  --transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --drive-bg: #131314;
  --drive-sidebar-bg: #1e1f20;
  --drive-search-bg: #282a2c;
  --drive-search-focus-bg: #303134;
  --drive-active-pill: #004a77;
  --drive-active-text: #c2e7ff;
  
  --text-primary: #e3e2e6;
  --text-secondary: #c4c6c0;
  --text-subtle: #8e918f;
  
  --folder-card-bg: #1e1f20;
  --folder-card-hover: #282a2c;
  --folder-card-border: #333537;
  
  --border-subtle: #333537;
  --border-light: #282a2c;

  --new-btn-bg: #303134;
  --new-btn-text: #e3e2e6;
  --new-btn-shadow: 0 1px 3px 0 rgba(0,0,0,0.5), 0 4px 8px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--drive-bg);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Main Container Frame */
.drive-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Top Drive Header */
.drive-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--drive-bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  width: 240px;
}

.drive-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.drive-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}

/* Header Search Container */
.header-search-container {
  flex: 1;
  max-width: 720px;
  margin: 0 24px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--drive-search-bg);
  border-radius: var(--radius-pill);
  height: 48px;
  padding: 0 16px;
  transition: var(--transition);
}

.search-box:focus-within {
  background: var(--drive-search-focus-bg);
  box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

.search-box-icon {
  color: var(--text-secondary);
  font-size: 20px;
  margin-right: 12px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

/* Right Header Controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(60, 64, 67, 0.08);
  color: var(--text-primary);
}

/* Drive Body Area */
.drive-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Sidebar */
.drive-sidebar {
  width: 256px;
  background: var(--drive-sidebar-bg);
  padding: 12px 12px 16px 12px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  user-select: none;
  overflow-y: auto;
}

/* + New Floating Pill Button */
.new-btn-container {
  position: relative;
  margin-bottom: 16px;
  margin-left: 4px;
}

.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px 0 16px;
  background: var(--new-btn-bg);
  border: none;
  border-radius: 16px;
  box-shadow: var(--new-btn-shadow);
  cursor: pointer;
  transition: var(--transition);
}

.btn-new:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  filter: brightness(0.96);
}

.btn-new span {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--new-btn-text);
}

.btn-new .plus-icon path {
  fill: var(--new-btn-text);
}

.new-dropdown {
  position: absolute;
  top: 60px;
  left: 0;
  width: 200px;
  background: var(--drive-sidebar-bg);
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  padding: 8px 0;
  z-index: 100;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.dropdown-item:hover {
  background: #f1f3f4;
}

.dropdown-item i {
  font-size: 18px;
  color: var(--text-secondary);
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item a:hover {
  background: rgba(60, 64, 67, 0.08);
}

.nav-item.active a {
  background: var(--drive-active-pill);
  color: var(--drive-active-text);
  font-weight: 700;
}

.nav-item a i {
  font-size: 18px;
  color: var(--text-secondary);
}

.nav-item.active a i {
  color: var(--drive-active-text);
}

/* Sidebar Folders Tree Section */
.sidebar-folder-tree-section {
  margin-top: 12px;
  padding: 0 8px;
}

.folder-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 6px;
  padding: 0 8px;
}

.icon-btn-sm {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.icon-btn-sm:hover {
  background: rgba(60, 64, 67, 0.08);
}

.tree-node {
  padding-left: calc(var(--depth, 0) * 12px);
}

.tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 8px;
  border-radius: 16px;
}

.tree-row:hover {
  background: rgba(60, 64, 67, 0.08);
}

.tree-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-menu {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
}

/* Main Workspace Area */
.drive-main-workspace {
  flex: 1;
  background: var(--drive-bg);
  padding: 16px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-top-left-radius: 16px;
  border-left: 1px solid var(--border-light);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-heading {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-primary);
}

/* Drag & Drop Banner */
.drag-drop-banner {
  border: 2px dashed #c2e7ff;
  background: #f8fafd;
  border-radius: var(--radius-card);
  padding: 14px 20px;
  text-align: center;
  transition: var(--transition);
}

.drag-drop-banner.dragover {
  background: #c2e7ff;
  border-color: #1a73e8;
}

.drop-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #0b57d0;
  font-size: 14px;
  font-weight: 500;
}

.drop-content i {
  font-size: 22px;
}

/* Drive Section Headings */
.drive-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-section-bar {
  margin-top: 8px;
}

.section-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.section-toggle-btn h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.section-toggle-btn i {
  font-size: 14px;
  color: var(--text-secondary);
}

/* View Mode Pill Toggle Buttons */
.view-toggle-pill-group {
  display: flex;
  align-items: center;
  background: #e9eef6;
  border-radius: 100px;
  padding: 3px;

}

.toggle-pill-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-pill-btn:hover {
  color: var(--text-primary);
}

.toggle-pill-btn.active {
  background: #c2e7ff;
  color: #001d35;
}

/* Folders Cards Grid */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--folder-card-bg);
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.folder-card:hover {
  background: var(--folder-card-hover);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.folder-card-icon i {
  font-size: 24px;
}

.folder-card-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.folder-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-card-location {
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-card-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  opacity: 0.7;
}

.folder-card-menu-btn:hover {
  opacity: 1;
  background: rgba(60, 64, 67, 0.08);
}

/* Files Container & Table (List View) */
.files-container.list-view {
  width: 100%;
}

.drive-file-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.drive-file-table th {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.drive-file-table th i {
  font-size: 12px;
  margin-left: 4px;
}

.drive-file-table tbody tr {
  height: 48px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

.drive-file-table tbody tr:hover {
  background: #f1f5f9;
}

.drive-file-table td {
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Columns */
.col-name { width: 45%; }
.col-size { width: 15%; }
.col-modified { width: 20%; }
.col-actions { width: 15%; text-align: right; }

.file-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-type-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* File Icon Colors */
.icon-doc { color: #1a73e8; }
.icon-sheet { color: #188038; }
.icon-code { color: #e37400; }
.icon-pdf { color: #d93025; }
.icon-img { color: #129eaf; }
.icon-video { color: #a142f4; }
.icon-zip { color: #f29900; }

.file-title-link {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-title-link:hover {
  color: #1a73e8;
}

.file-size-text,
.file-modified-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.action-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
}

.action-menu-btn:hover {
  background: rgba(60, 64, 67, 0.08);
  color: var(--text-primary);
}

/* Grid View Mode */
.files-container.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.grid-file-card {
  background: var(--folder-card-bg);
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.grid-file-card:hover {
  background: var(--folder-card-hover);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.grid-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-file-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-file-preview-box {
  height: 100px;
  background: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 1px solid var(--border-light);
}

.grid-file-footer {
  font-size: 11px;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
}

/* Modal Overlays & Cards */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.preview-overlay[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
}

.modal-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #747775;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
}

.modal-input:focus {
  border-color: #1a73e8;
  border-width: 2px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.btn-flat {
  padding: 8px 16px;
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: #0b57d0;
  cursor: pointer;
  border-radius: 100px;
}

.btn-flat:hover {
  background: #edf2fc;
}

.btn-solid-blue {
  padding: 8px 24px;
  background: #0b57d0;
  border: none;
  border-radius: 100px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  cursor: pointer;
}

.btn-solid-blue:hover {
  background: #0056b3;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* File Preview Overlay */
.preview-panel {
  width: 100%;
  max-width: 900px;
  height: 85vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8f9fa;
}

.preview-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-body {
  flex: 1;
  background: #202124;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.preview-image {
  max-width: 100%;
  max-height: calc(85vh - 70px);
  object-fit: contain;
}

.preview-frame {
  width: 100%;
  height: calc(85vh - 70px);
  border: none;
  background: #ffffff;
}

.preview-missing {
  color: #ffffff;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* File Detail Page */
.detail-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.detail-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--drive-bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.detail-header-left {
  display: flex;
  align-items: center;
}

.detail-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 48px;
  background: var(--drive-bg);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  margin: -6px 0 20px -10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.back-link:hover {
  background: var(--folder-card-hover);
  color: var(--text-primary);
}

.detail-file-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--folder-card-bg);
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
}

.detail-icon-box {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: var(--radius-card);
  background: var(--drive-bg);
  border: 1px solid var(--folder-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #1a73e8;
}

.detail-title-group {
  flex: 1;
  min-width: 0;
}

.detail-title-group h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-sep {
  color: var(--text-subtle);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  flex-shrink: 0;
  text-transform: capitalize;
}

.status-ready {
  background: #e6f4ea;
  color: #1e8e3e;
}

.status-uploading {
  background: #fef7e0;
  color: #b06000;
}

.status-failed {
  background: #fce8e6;
  color: #c5221f;
}

[data-theme="dark"] .status-ready {
  background: rgba(30, 142, 62, 0.18);
  color: #81c995;
}

[data-theme="dark"] .status-uploading {
  background: rgba(176, 96, 0, 0.18);
  color: #fdd663;
}

[data-theme="dark"] .status-failed {
  background: rgba(197, 34, 31, 0.18);
  color: #f28b82;
}

.detail-preview {
  margin-top: 20px;
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--folder-card-bg);
}

.detail-preview .preview-frame {
  height: 60vh;
  display: block;
  background: #ffffff;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.detail-card {
  background: var(--folder-card-bg);
  border: 1px solid var(--folder-card-border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.detail-card label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.detail-card span {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-download-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  border: none;
  background: #1a73e8;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download-primary:hover {
  background: #1765cc;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px rgba(60, 64, 67, 0.15);
}

.btn-download-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid #747775;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download-secondary:hover {
  background: var(--folder-card-hover);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}

