/**
 * Modern File List Design - Borderless Elegant Version
 * Inspired by Dropbox, Google Drive, Linear
 */

/* ========================================
   1. File Table - Clean Borderless Design
   ======================================== */

/* Remove ALL borders */
#table_files,
#table_files thead,
#table_files tbody,
#table_files thead th,
#table_files tbody td,
#table_files tbody tr {
  border: none !important;
}

/* Table Layout */
#table_files {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
  table-layout: fixed;
  background: transparent;
}

/* Column Widths */
#table_files thead th:first-child,
#table_files tbody td:first-child {
  width: 50px;
  text-align: center;
}

#table_files thead th:nth-child(2),
#table_files tbody td:nth-child(2) {
  width: auto;
  min-width: 200px;
}

#table_files thead th:nth-child(3),
#table_files tbody td:nth-child(3) {
  width: 120px;
  white-space: nowrap;
  text-align: center !important;
}

#table_files thead th:nth-child(4),
#table_files tbody td:nth-child(4) {
  width: 150px;
  white-space: nowrap;
  text-align: center !important;
}

/* ========================================
   2. Table Header - Enhanced Visibility
   ======================================== */

#table_files thead {
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 10;
}

#table_files thead th {
  padding: 1rem;
  font-weight: 600;              /* Semi-bold for clarity */
  font-size: 0.875rem;           /* 14px - slightly larger */
  text-transform: none;
  letter-spacing: -0.01em;       /* Tighter spacing */
  color: #111827;                /* Dark for contrast */
  background: #FFFFFF;
  border-bottom: 2px solid #e5e7eb;
  vertical-align: middle;
  position: relative;
}

/* ========================================
   3. Table Body - Spacious & Breathable
   ======================================== */

#table_files tbody tr {
  height: 60px;                  /* Increased row height */
  position: relative;            /* Create stacking context */
  z-index: 1;                    /* Base z-index */
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

#table_files tbody tr:hover {
  background-color: #f9fafb;     /* More visible hover */
  z-index: 2;                    /* Slightly higher on hover, but still below dropdown */
}

#table_files tbody tr.selected {
  background-color: #eff6ff;     /* Blue tint for selected */
}

#table_files tbody td {
  padding: 1rem;
  vertical-align: middle;
}

/* Overflow is controlled inside the cell, not on td itself */
/* td overflow: hidden would clip dropdown menus */
/* Long file names are clipped by .file-name and .file-name-link instead */

/* ========================================
   4. File Item Layout
   ======================================== */

.file-item-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.file-item-main {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
  /* overflow: hidden removed - was blocking dropdown menu */
}

/* File Icon */
.file-icon-wrapper {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-item-wrapper:hover .file-icon-wrapper {
  transform: scale(1.05);
}

.file-icon-wrapper img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* File Info */
.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111827;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111827;
  transition: color 0.15s ease;
}

.file-name-link:hover {
  color: #2563eb;
  text-decoration: none;
}

.file-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.file-badge:hover {
  transform: scale(1.1);
}

.file-badge i {
  font-size: 0.75rem;
}

.file-badge i.orange {
  color: #f59e0b;
}

.file-badge i.grey {
  color: #d1d5db;
}

/* ========================================
   5. File Actions
   ======================================== */

.file-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

#table_files tbody tr:hover .file-actions {
  opacity: 1;
}

.file-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.file-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: #6B7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-action-btn:hover {
  color: #2563eb;
  background: #eff6ff;
}

.file-action-btn i {
  font-size: 0.875rem;
}

/* File Action Placeholder - 保持宽度一致 */
.file-action-placeholder {
  display: inline-block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* File Dropdown Menu */
.file-more-menu {
  position: relative;
}

/* When dropdown is open, ensure parent has high z-index */
.file-more-menu.show {
  z-index: 10000;
}

.file-dropdown-menu {
  position: fixed;
  min-width: 200px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  z-index: 10000;
  display: none;
}

/* Dropup variant when opened upward */
.file-more-menu.dropup .file-dropdown-menu {
  transform: translateY(-0.5rem);
}

.file-more-menu.show .file-dropdown-menu {
  display: block;
}

.file-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #111827;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.file-dropdown-item:hover {
  background: #f3f4f6;
  color: #2563eb;
  text-decoration: none;
}

.file-dropdown-item.text-danger {
  color: #dc2626;
}

.file-dropdown-item.text-danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.file-dropdown-item i {
  width: 16px;
  text-align: center;
}

.file-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.375rem 0;
}

/* ========================================
   6. DataTables Controls - Enhanced Styling
   ======================================== */

/* Wrapper Spacing - Clean Padding */
.dataTables_wrapper .row:first-child {
  padding: 1.25rem;
  margin: 0;
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
}

.dataTables_wrapper .row:last-child {
  padding: 1rem 1.25rem;
  margin: 0;
  background: #fafbfc;
  border-top: 1px solid #e5e7eb;
}

/* Length Control - Left Side */
.dataTables_length {
  margin: 0;
}

.dataTables_length label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
}

.dataTables_length select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #111827;
  background-color: #FFFFFF;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  min-width: 70px;
  height: 38px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.dataTables_length select:hover {
  border-color: #d1d5db;
  background-color: #f9fafb;
}

.dataTables_length select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Search Filter - Right Side */
.dataTables_filter {
  margin: 0;
  text-align: right;
}

.dataTables_filter label {
  display: inline-block;
  margin: 0;
  position: relative;
  color: transparent;
  font-size: 0;
  line-height: 0;
}

/* Note: Search icon is already added in bootstrap-override.css or modern-override.css */

.dataTables_filter input {
  padding: 0.5rem 1rem 0.5rem 2.75rem !important;
  font-size: 0.9375rem !important;
  color: #111827 !important;
  background-color: #f9fafb !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 6px !important;
  min-width: 280px !important;
  height: 38px !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  margin: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.dataTables_filter input:hover {
  background-color: #FFFFFF !important;
  border-color: #d1d5db !important;
}

.dataTables_filter input:focus {
  outline: none !important;
  background-color: #FFFFFF !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.dataTables_filter input::placeholder {
  color: #9ca3af;
}

/* Info Text - Bottom Left */
.dataTables_info {
  font-size: 0.875rem;
  color: #6B7280;
  margin: 0;
  font-weight: 500;
}

/* ========================================
   7. Pagination - Modern Minimal
   ======================================== */

.pagination {
  margin: 0;
  gap: 0.25rem;
}

.page-item {
  margin: 0;
}

.page-link {
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
  background: transparent;
  border: none;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.page-link:hover {
  color: #111827;
  background: #f3f4f6;
  text-decoration: none;
}

.page-item.active .page-link {
  color: #FFFFFF;
  background: #2563eb;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.page-item.disabled .page-link {
  color: #d1d5db;
  opacity: 0.5;
  cursor: not-allowed;
}

.page-item.disabled .page-link:hover {
  background: transparent;
}

/* ========================================
   8. File Checkbox - Consistent Sizing
   ======================================== */

/* Ensure consistent checkbox size in thead and tbody */
#table_files thead th .custom-control-input,
#table_files tbody td .custom-control-input {
  width: 18px;
  height: 18px;
}

#table_files thead th .custom-control-label::before,
#table_files tbody td .custom-control-label::before,
#table_files thead th .custom-control-label::after,
#table_files tbody td .custom-control-label::after {
  width: 18px;
  height: 18px;
  top: 0;
  left: -1.25rem;
}

/* Checkbox container alignment */
#table_files thead th .custom-control-checkbox,
#table_files tbody td .custom-control-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding-left: 0;
  margin: 0;
}

/* ========================================
   9. Responsive - Mobile
   ======================================== */

@media (max-width: 767px) {
  /* Hide size and date columns */
  #table_files thead th:nth-child(3),
  #table_files thead th:nth-child(4),
  #table_files tbody td:nth-child(3),
  #table_files tbody td:nth-child(4) {
    display: none;
  }

  /* Smaller row height */
  #table_files tbody tr {
    height: 52px;
  }

  /* Smaller icons */
  .file-icon-wrapper {
    width: 32px;
    height: 32px;
  }

  .file-icon-wrapper img {
    width: 24px;
    height: 24px;
  }

  /* Always show file actions */
  .file-actions {
    opacity: 1;
  }

  /* Smaller padding */
  #table_files thead th,
  #table_files tbody td {
    padding: 0.75rem 0.5rem;
  }

  /* Full width search */
  .dataTables_filter input {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Smaller pagination */
  .page-link {
    min-width: 32px;
    height: 32px;
    font-size: 0.8125rem;
  }
}

/* ========================================
   10. Loading & Empty States
   ======================================== */

.dataTables_empty {
  padding: 3rem 1rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.dataTables_processing {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 9999;
}

/* ========================================
   14. File List Breadcrumb - Compact Design
   ======================================== */

/* File breadcrumb header - integrate path and back button */
.file-breadcrumb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  min-height: 38px;          /* Fixed height to prevent layout shift */
  flex-wrap: wrap;
}

.file-breadcrumb-wrapper {
  flex: 1;
  min-width: 0;
}

/* File-specific breadcrumb navigation - compact style */
.file-breadcrumb-nav {
  font-size: 0.9375rem;     /* 15px - smaller than default 20px */
  gap: 0.375rem;            /* 6px - tighter spacing */
  margin-bottom: 0;         /* Remove bottom margin */
  min-height: 24px;         /* Ensure consistent height */
}

.file-breadcrumb-nav .breadcrumb-item {
  max-width: 200px;         /* Limit item width */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-breadcrumb-nav .breadcrumb-separator {
  opacity: 0.5;
}

/* Breadcrumb back button - integrated with breadcrumb */
.breadcrumb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #2563eb;           /* Primary blue */
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.breadcrumb-back-btn:hover {
  color: #1d4ed8;           /* Darker blue on hover */
  background: #eff6ff;      /* Light blue background */
  text-decoration: none;
  transform: translateX(-2px);
}

.breadcrumb-back-btn i {
  font-size: 0.875rem;
}

/* Legacy back button styling - deprecated, now using .breadcrumb-back-btn */
/* .file-breadcrumb-back {
  flex-shrink: 0;
  font-size: 0.875rem;
  white-space: nowrap;
} */

/* Ensure consistent height for page-header when using file breadcrumb */
.page-header:has(.file-breadcrumb-nav) {
  min-height: 38px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .file-breadcrumb-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .file-breadcrumb-nav {
    font-size: 0.875rem;    /* Even smaller on mobile */
  }

  .file-breadcrumb-nav .breadcrumb-item {
    max-width: 120px;       /* Shorter on mobile */
  }

  /* Back button on mobile */
  .breadcrumb-back-btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.625rem;
  }
}

/* ========================================
   File Status States - Preparing/Processing
   ======================================== */

/* 文件准备中状态 - 半透明 */
.file-item-preparing {
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.file-item-preparing:hover {
  opacity: 0.65;
}

/* 文件名内联状态图标 */
.file-name .fa-spinner {
  margin-left: 0.5rem;
  vertical-align: middle;
}

