/* ==================== CSS RESET & VARIABLES ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --primary: #667eea;
  --primary-dark: #5568d3;
  --success: #10b981;
  --danger: #ef4444;

  /* Backgrounds */
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;

  /* Text */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  /* Borders */
  --border: #e5e7eb;
  --border-light: #f3f4f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms ease;

  /* Z-index */
  --z-copy-btn: 15;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 1000;
  --z-toast: 1100;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==================== HEADER ==================== */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: var(--space-lg) var(--space-xl);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.header h1 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-toggle {
  display: flex;
  gap: var(--space-xs);
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.view-toggle button {
  background: transparent;
  border: none;
  color: white;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  transition: background var(--transition);
  min-width: 44px;
  min-height: 44px;
}

.view-toggle button.active {
  background: rgba(255, 255, 255, 0.25);
}

.view-toggle button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==================== BREADCRUMB ==================== */
.breadcrumb {
  background: var(--bg-card);
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  font-size: 0.9375rem;
}

.breadcrumb-item {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

.breadcrumb-item:hover {
  color: var(--primary-dark);
  background: var(--bg-hover);
}

.breadcrumb-separator {
  color: var(--text-muted);
  user-select: none;
}

/* ==================== CONTAINER ==================== */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* ==================== TOOLBAR ==================== */
.toolbar {
  background: var(--bg-card);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr auto auto;
  align-items: center;
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  transition: all var(--transition);
  background: var(--bg-page);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.625rem 1rem;
  border: 2px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.sort-select {
  padding: 0.625rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition);
  min-width: 160px;
}

.sort-select:hover {
  border-color: var(--primary);
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ==================== SEARCH SCOPE TOGGLE ==================== */
.search-scope-toggle {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.search-scope-current {
  color: var(--text-secondary);
  font-weight: 500;
}

.search-scope-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.search-scope-btn:hover {
  background: rgba(102, 126, 234, 0.1);
}

/* ==================== GRID ==================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-xl);
}

.grid.list-view {
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

/* ==================== ITEMS ==================== */
.item {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  border: 2px solid transparent;
}

.item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.item.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.list-view .item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.list-view .item:hover {
  transform: translateX(4px);
}

.item-checkbox {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 10;
  width: 22px;
  height: 22px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition);
  accent-color: var(--primary);
}

.item:hover .item-checkbox,
.item.selected .item-checkbox {
  opacity: 1;
}

.list-view .item-checkbox {
  position: relative;
  top: auto;
  left: auto;
  opacity: 1;
  margin-left: var(--space-md);
}

.item-thumbnail {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
  overflow: hidden;
  position: relative;
  padding: var(--space-sm);
}

.list-view .item-thumbnail {
  width: 100px;
  height: 100px;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.item-thumbnail img,
.item-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.item-icon {
  font-size: 3.5rem;
  opacity: 0.5;
  z-index: 1;
}

.list-view .item-icon {
  font-size: 2.5rem;
}

.folder-icon::before {
  content: "📁";
}

.file-icon::before {
  content: "📄";
}

.audio-icon::before {
  content: "🎵";
}

.video-icon::before {
  content: "🎬";
}

/* ==================== SEGMENTED COPY BUTTON - FIXED ==================== */
.copy-btn-group {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  display: inline-flex;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: var(--z-copy-btn);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--primary);
  height: 36px;
  pointer-events: auto;
}

/* Show on hover for thumbnails - Multiple selectors for reliability */
.item:hover .copy-btn-group,
.item-thumbnail:hover .copy-btn-group {
  opacity: 1;
  visibility: visible;
}

/* Main copy button */
.copy-btn-main {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 var(--space-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  white-space: nowrap;
  line-height: 1;
  position: relative;
}

/* Dropdown toggle button */
.copy-dropdown-toggle {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 var(--space-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 32px;
  line-height: 1;
  position: relative;
}

.copy-btn-main:hover,
.copy-dropdown-toggle:hover {
  background: var(--primary-dark);
}

.copy-btn-main.copied {
  background: var(--success);
  border-right-color: rgba(255, 255, 255, 0.3);
}

/* List view overrides */
.list-view .copy-btn-group {
  position: relative;
  bottom: auto;
  right: auto;
  opacity: 1;
  visibility: visible;
  margin-right: var(--space-md);
  margin-left: auto;
}

/* Modal specific styles */
.modal-copy-container {
  margin-top: var(--space-md);
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 10;
  min-height: 48px;
}

.modal-copy-container .copy-btn-group {
  position: relative;
  bottom: auto;
  right: auto;
  opacity: 1;
  visibility: visible;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  height: 44px;
}

.modal-copy-container .copy-btn-main {
  padding: 0 1.5rem;
  font-size: 0.9375rem;
  height: 100%;
}

.modal-copy-container .copy-dropdown-toggle {
  padding: 0 1rem;
  height: 100%;
  font-size: 0.875rem;
}

/* ==================== COPY OPTIONS MENU ==================== */
.copy-options-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 0.375rem 0;
  min-width: 280px;
  max-width: 380px;
  max-height: 420px;
  overflow-y: auto;
  animation: slideUp 200ms ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.copy-options-menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: background 150ms ease;
  gap: 0.25rem;
}

.copy-options-menu button:hover {
  background: var(--bg-hover);
}

.copy-options-menu button small {
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.copy-options-menu button:first-child {
  border-left: 3px solid var(--primary);
  background: rgba(102, 126, 234, 0.05);
}

.copy-options-menu button:first-child small {
  color: var(--primary);
  font-weight: 600;
}

/* ==================== ITEM INFO ==================== */
.item-info {
  padding: var(--space-lg);
}

.list-view .item-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}

.item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: var(--space-sm);
  word-break: break-word;
  line-height: 1.4;
}

.list-view .item-name {
  margin-bottom: 0;
}

.item-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.item-type-badge {
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-image {
  background: #dbeafe;
  color: #1e40af;
}

.badge-video {
  background: #fce7f3;
  color: #be123c;
}

.badge-audio {
  background: #f3e8ff;
  color: #7e22ce;
}

.badge-folder {
  background: #fed7aa;
  color: #c2410c;
}

.badge-file {
  background: #d1fae5;
  color: #065f46;
}

/* Highlight search results */
mark {
  background: rgba(255, 235, 59, 0.5);
  color: inherit;
  padding: 0.125rem 0.25rem;
  border-radius: 0.125rem;
  font-weight: 600;
}

/* ==================== SELECTION BAR ==================== */
.selection-bar {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--bg-card);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  z-index: var(--z-fixed);
  transition: transform 300ms ease;
  border: 1px solid var(--border);
  min-width: 320px;
}

.selection-bar.active {
  transform: translateX(-50%) translateY(0);
}

.selection-count {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

.selection-actions {
  display: flex;
  gap: var(--space-sm);
}

.selection-btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border);
}

/* ==================== TOAST ==================== */
.copied-toast {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  background: var(--success);
  color: white;
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  z-index: var(--z-toast);
  max-width: 420px;
  transform: translateX(calc(100% + var(--space-xl)));
  transition: transform 300ms ease;
}

.copied-toast.show {
  transform: translateX(0);
}

.toast-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.9375rem;
}

.toast-message {
  font-size: 0.8125rem;
  opacity: 0.95;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.97);
  z-index: var(--z-modal);
  backdrop-filter: blur(8px);
}

.modal.active {
  display: block;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

#modalBody {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 40px 220px;
}

.modal-content img,
.modal-content video {
  max-width: 90vw;
  max-height: calc(100vh - 320px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  animation: zoomIn 300ms ease;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

#modalBody>div {
  padding: 3rem;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  min-width: 320px;
  max-width: 600px;
  width: 90%;
  animation: zoomIn 300ms ease;
}

#modalBody>div h3 {
  margin-bottom: 1.5rem;
  color: #1f2937;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.modal-content audio {
  width: 100%;
  border-radius: var(--radius-lg);
}

.modal-info {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
  backdrop-filter: blur(30px);
  padding: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
}

.modal-info-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-file-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-filename {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-metadata {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-metadata span {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  font-weight: 500;
}

.modal-actions {
  display: flex;
  justify-content: center;
}

/* ==================== UPLOAD ==================== */
.upload-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-fixed);
}

.upload-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition);
}

.upload-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.upload-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: var(--z-modal);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.upload-modal.active {
  display: flex;
  animation: fadeIn 200ms ease;
}

.upload-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: zoomIn 300ms ease;
}

.upload-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.upload-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.upload-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--transition);
}

.upload-modal-close:hover {
  color: var(--text-primary);
}

.upload-path-selector-container {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upload-path-selector-container label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* Current path display */
.upload-current-path {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.upload-current-path-icon {
  color: var(--primary);
  font-size: 1.125rem;
  flex-shrink: 0;
}

.upload-current-path-text {
  flex: 1;
  font-weight: 500;
}

.upload-current-path-label {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

/* Path selector wrapper for breadcrumb layout */
.upload-path-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.upload-path-separator {
  color: var(--text-muted);
  font-size: 0.875rem;
  user-select: none;
}

.upload-path-selector {
  min-width: 150px;
  max-width: 250px;
  padding: 0.625rem 2rem 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 12px;
  font-weight: 500;
}

.upload-path-selector:hover {
  border-color: var(--primary);
  background-color: rgba(102, 126, 234, 0.02);
}

.upload-path-selector:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.upload-path-selector option {
  padding: 0.5rem 0.75rem;
  background: white;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.upload-path-selector option:disabled {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
}

/* Alternative layout option */
.upload-change-path-toggle {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem 1rem;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.upload-change-path-toggle:hover {
  background: rgba(102, 126, 234, 0.05);
  border-color: var(--primary);
}

.upload-selectors-wrapper {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  max-height: 300px;
  overflow-y: auto;
  animation: slideDown 200ms ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.upload-selectors-wrapper.active {
  display: flex;
}

.upload-path-selector-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

.upload-path-selector-row label {
  min-width: 90px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  flex-shrink: 0;
}

.upload-path-selector-row select {
  flex: 1;
  min-width: 0;
}


.upload-drop-zone {
  border: 3px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-page);
  margin-bottom: var(--space-lg);
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.05);
}

.upload-drop-zone-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.upload-drop-zone-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.upload-drop-zone-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.upload-file-input {
  display: none;
}

.upload-file-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: var(--space-lg);
}

.upload-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-page);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.upload-file-thumbnail {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.upload-file-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.upload-file-info {
  flex: 1;
  min-width: 0;
}

.upload-file-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-file-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.upload-file-remove:hover {
  background: rgba(239, 68, 68, 0.1);
}

.upload-actions {
  display: flex;
  gap: var(--space-md);
}

.upload-submit-btn,
.upload-cancel-btn {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-submit-btn {
  background: var(--primary);
  color: white;
}

.upload-submit-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.upload-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.upload-cancel-btn {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.upload-cancel-btn:hover {
  background: var(--border);
}

.upload-status {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.upload-status.success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success);
}

.upload-status.error {
  background: #fef2f2;
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

/* ==================== STATES ==================== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 5rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.125rem;
  font-weight: 500;
}

.loading {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  color: var(--text-muted);
  font-size: 1.125rem;
  font-weight: 500;
}

.error-message {
  background: #fef2f2;
  color: #991b1b;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  border-left: 4px solid var(--danger);
  font-weight: 500;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --space-xl: 1.5rem;
  }

  .header {
    padding: var(--space-md) var(--space-lg);
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .breadcrumb {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
  }

  .container {
    padding: var(--space-lg);
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
  }

  .item-thumbnail {
    aspect-ratio: 1;
  }

  .toolbar {
    padding: var(--space-md);
  }

  .filter-buttons {
    width: 100%;
  }

  .filter-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.8125rem;
  }

  .sort-select {
    width: 100%;
  }

  .search-scope-toggle {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .search-scope-btn {
    align-self: flex-end;
  }

  .selection-bar {
    left: var(--space-md);
    right: var(--space-md);
    width: calc(100% - var(--space-xl));
    min-width: 0;
    flex-direction: column;
  }

  .selection-actions {
    width: 100%;
  }

  .selection-btn {
    flex: 1;
  }

  .copied-toast {
    right: var(--space-md);
    left: var(--space-md);
    max-width: calc(100% - var(--space-xl));
  }

  .modal-close {
    top: 16px;
    right: 16px;
    padding: 10px 20px;
    font-size: 0.9375rem;
  }

  #modalBody {
    padding: 80px 20px 240px;
  }

  .modal-content img,
  .modal-content video {
    max-width: 95vw;
    max-height: calc(100vh - 320px);
  }

  .modal-info {
    padding: 24px 20px;
  }

  .modal-filename {
    font-size: 1.125rem;
  }

  .modal-metadata {
    font-size: 0.875rem;
    gap: 12px;
  }

  .upload-container {
    bottom: var(--space-lg);
    right: var(--space-lg);
  }

  .upload-btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
  }

  .upload-modal {
    padding: var(--space-lg);
  }

  .upload-modal-content {
    padding: var(--space-xl);
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-sm);
  }

  .item-info {
    padding: var(--space-md);
  }

  .item-name {
    font-size: 0.875rem;
  }

  .filter-buttons {
    flex-direction: column;
  }

  .filter-btn {
    width: 100%;
  }

  .modal-close {
    top: 12px;
    right: 12px;
    padding: 8px 16px;
    font-size: 0.875rem;
  }

  #modalBody {
    padding: 70px 12px 260px;
  }

  .modal-content img,
  .modal-content video {
    max-width: 96vw;
    max-height: calc(100vh - 330px);
  }

  #modalBody>div {
    padding: 2rem 1.5rem;
    min-width: 280px;
  }

  .modal-info {
    padding: 20px 16px;
  }

  .modal-filename {
    font-size: 1rem;
  }

  .modal-metadata {
    font-size: 0.8125rem;
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-metadata span {
    font-size: 0.75rem;
  }

  .upload-container {
    bottom: var(--space-md);
    right: var(--space-md);
  }

  .upload-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .upload-modal {
    padding: var(--space-md);
  }

  .upload-modal-content {
    padding: var(--space-lg);
    max-width: 100%;
  }

  .upload-drop-zone {
    padding: var(--space-xl);
  }

  .upload-actions {
    flex-direction: column;
  }

  .upload-path-selector-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .upload-path-selector-row label {
    min-width: auto;
    font-size: 0.75rem;
  }

  .upload-path-selector-row select {
    width: 100%;
  }

  .upload-current-path {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .item-checkbox {
    opacity: 1;
  }

  .copy-btn-group {
    opacity: 1;
    visibility: visible;
  }

  .item:hover {
    transform: none;
  }

  .item:active {
    transform: scale(0.98);
  }

  button,
  .filter-btn,
  .selection-btn {
    min-height: 44px;
  }

  .modal-close {
    min-width: 44px;
    min-height: 44px;
  }
}

@media print {

  .header,
  .breadcrumb,
  .toolbar,
  .selection-bar,
  .copied-toast,
  .modal,
  .copy-btn-group,
  .item-checkbox,
  .upload-container {
    display: none !important;
  }

  .grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .item {
    break-inside: avoid;
  }
}