/* simpleFileBox Design System & Responsive Styles */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select {
  font-family: inherit;
  font-size: 14px;
}

/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #fff;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: #f1f5f9;
}

.btn-danger {
  background-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* Layout */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Navigation / Breadcrumb */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 14px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.crumb-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
}
.crumb-item:hover {
  background: var(--primary-light);
}

.crumb-separator {
  color: var(--text-muted);
}

.crumb-current {
  color: var(--text-main);
  font-weight: 600;
  padding: 2px 6px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 200px;
  transition: width 0.2s ease;
  background: #fff;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  width: 260px;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Selection action bar */
.selection-bar {
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDown 0.2s ease-out;
}

.selection-info {
  font-weight: 500;
  font-size: 14px;
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* File Container - List View */
.file-list {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.file-row-header {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.file-row:last-child {
  border-bottom: none;
}
.file-row:hover {
  background-color: #f8fafc;
}
.file-row.selected {
  background-color: var(--primary-light);
}

.file-row-name {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-title {
  font-weight: 500;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* File Container - Grid View */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.grid-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.grid-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}
.grid-card.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}

.grid-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
}

.grid-menu-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

.grid-icon-wrap {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 10px;
}

.grid-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Mobile Floating Action Button (FAB) */
.fab-container {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.fab-main.active {
  transform: rotate(45deg);
  background: #475569;
}

.fab-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.2s ease;
}
.fab-menu.active {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Folder Tree in Move/Copy Modal */
.folder-picker-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 260px;
  overflow-y: auto;
}

.folder-picker-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}
.folder-picker-item:hover {
  background: #f8fafc;
}
.folder-picker-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Context Menu / Bottom Sheet */
.context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  min-width: 180px;
  padding: 6px 0;
  display: none;
}
.context-menu.active {
  display: block;
}

.context-menu-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}
.context-menu-item:hover {
  background: #f1f5f9;
}
.context-menu-item.danger {
  color: var(--danger);
}
.context-menu-item.danger:hover {
  background: #fef2f2;
}

/* Upload Manager Floating Panel */
.upload-manager-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 70;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.upload-manager-panel.minimized .upload-queue-container {
  display: none;
}

.upload-manager-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #f1f5f9;
}

.upload-manager-header:hover {
  background: #f8fafc;
}

.upload-manager-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.upload-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.upload-spinner.completed {
  border: 2.5px solid var(--success);
  border-top-color: var(--success);
  animation: none;
}

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

.upload-manager-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-manager-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
}

.upload-manager-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.upload-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.upload-btn-icon:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.upload-global-progress-bar {
  margin-top: 0;
  height: 3px;
  border-radius: 0;
  background: #f1f5f9;
}

.upload-queue-container {
  max-height: 280px;
  overflow-y: auto;
  background: #ffffff;
}

.upload-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s;
}

.upload-item:hover {
  background: #f8fafc;
}

.upload-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.upload-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.upload-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.upload-item-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.upload-item-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.upload-item-progress-wrap {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.upload-item-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.15s ease;
}

.upload-item-progress-fill.success {
  background: var(--success);
}

.upload-item-progress-fill.error {
  background: var(--danger);
}

.upload-item-progress-fill.paused {
  background: #f59e0b;
}

.upload-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.upload-item-status-badge {
  font-weight: 500;
}
.upload-item-status-badge.uploading { color: var(--primary); }
.upload-item-status-badge.success { color: var(--success); }
.upload-item-status-badge.paused { color: #d97706; }
.upload-item-status-badge.error { color: var(--danger); }
.upload-item-status-badge.waiting { color: var(--text-muted); }

/* Responsive adjustments */
@media (max-width: 640px) {
  .upload-manager-panel {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.15s ease;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.active {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }

/* Drag & Drop Zone */
.drag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 130, 246, 0.15);
  border: 4px dashed var(--primary);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.drag-overlay.active {
  opacity: 1;
}
.drag-box {
  background: #fff;
  padding: 24px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Media Preview Modal */
.preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
  overflow: auto;
}
.preview-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.preview-content video, .preview-content audio {
  max-width: 100%;
}
.preview-content pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-sm);
  width: 100%;
  font-size: 13px;
  max-height: 60vh;
  overflow: auto;
}

/* Animations */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Tweaks for Mobile */
@media (max-width: 768px) {
  .fab-container {
    display: block;
  }
  
  .toolbar-group.desktop-only {
    display: none;
  }
  
  .search-input {
    width: 150px;
  }
  .search-input:focus {
    width: 180px;
  }
  
  .file-row-header {
    display: none;
  }
  
  .file-row {
    grid-template-columns: 36px 1fr 40px;
    padding: 12px 10px;
  }
  
  .file-row-size, .file-row-date {
    display: none;
  }
  
  .file-meta-mobile {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
  }

  .upload-status-card {
    left: 16px;
    right: 16px;
    bottom: 88px;
    width: auto;
  }

  /* Bottom sheet style for context menu on mobile */
  .context-menu.mobile-sheet {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .context-menu.mobile-sheet .context-menu-item {
    padding: 14px 20px;
    font-size: 16px;
  }
}

/* Folder Lock & Tabs */
.lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-left: 6px;
  vertical-align: middle;
}
.lock-badge.locked {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-btn:hover:not(.active) {
  color: var(--text-main);
  background: #f8fafc;
}

/* Disk Usage Header Badge */
.disk-usage-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.disk-usage-badge:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.disk-icon {
  color: #64748b;
  flex-shrink: 0;
}
.disk-usage-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.disk-usage-text {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  white-space: nowrap;
  font-size: 13px;
}
.disk-free-val {
  color: var(--primary);
  font-weight: 600;
}
.disk-total-text {
  color: var(--text-muted);
  font-size: 12px;
}
.disk-progress-bar {
  width: 90px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}
.disk-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
/* Warning when disk usage > 85%, Danger when > 95% */
.disk-usage-badge.warning .disk-progress-fill {
  background: #f59e0b;
}
.disk-usage-badge.warning .disk-free-val {
  color: #d97706;
}
.disk-usage-badge.danger .disk-progress-fill {
  background: #ef4444;
}
.disk-usage-badge.danger .disk-free-val {
  color: #ef4444;
}

@media (max-width: 768px) {
  .disk-usage-badge {
    padding: 4px 8px;
    font-size: 12px;
    gap: 6px;
  }
  .disk-progress-bar {
    display: none;
  }
}


