/* Index page styles */
.page-index {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.upload-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.new-txt-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.new-txt-btn:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  transition: all 0.3s;
  margin-bottom: 24px;
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.drop-zone svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.drop-zone p {
  font-size: 0.9375rem;
  margin-bottom: 4px;
}

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

/* Compact Upload Zone (shown when files exist) */
.upload-zone-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
  background: var(--bg-card);
}

.upload-zone-compact:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.upload-zone-compact.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* File List Table (unified layout for all screen sizes) */
.file-list-table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.file-list-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.file-list-body {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-light);
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background: var(--bg-hover);
}

/* Column layout */
.file-icon-col {
  width: 40px;
  flex-shrink: 0;
  font-size: 1.5rem;
  text-align: center;
}

.file-name-col {
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

.file-name-col .file-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.5;
}

.file-type-col {
  width: 80px;
  flex-shrink: 0;
  text-align: center;
}

.file-size-col {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding-right: 8px;
}

.file-date-col {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding-right: 8px;
}

.file-action-col {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.file-action-col .action-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.2s;
}

.file-action-col .download-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Type badges */
.type-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-badge.pdf { background: #fee2e2; color: #dc2626; }
.type-badge.markdown { background: #dbeafe; color: #2563eb; }
.type-badge.word { background: #e0e7ff; color: #4f46e5; }
.type-badge.xlsx { background: #d1fae5; color: #059669; }
.type-badge.pptx { background: #fef3c7; color: #d97706; }
.type-badge.archive { background: #f3e8ff; color: #7c3aed; }
.type-badge.txt { background: #ecfeff; color: #0891b2; }

[data-theme="dark"] .type-badge.pdf { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .type-badge.markdown { background: #172554; color: #93c5fd; }
[data-theme="dark"] .type-badge.word { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .type-badge.xlsx { background: #022c22; color: #6ee7b7; }
[data-theme="dark"] .type-badge.pptx { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .type-badge.archive { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .type-badge.txt { background: #083344; color: #67e8f9; }

/* Delete confirm modal */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: confirmFadeIn 0.2s ease;
}

.confirm-overlay.confirm-closing {
  animation: confirmFadeOut 0.2s ease forwards;
}

@keyframes confirmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirmFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.confirm-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 32px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: confirmSlideIn 0.2s ease;
}

.confirm-closing .confirm-modal {
  animation: confirmSlideOut 0.2s ease forwards;
}

@keyframes confirmSlideIn {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes confirmSlideOut {
  from { transform: scale(1) translateY(0); opacity: 1; }
  to { transform: scale(0.9) translateY(10px); opacity: 0; }
}

.confirm-icon {
  margin-bottom: 12px;
}

.confirm-modal h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-modal p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-actions button {
  padding: 8px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.confirm-cancel {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.confirm-cancel:hover {
  background: var(--border-light);
}

.confirm-ok {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}

.confirm-ok:hover {
  opacity: 0.9;
}

/* Upload progress overlay */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: confirmFadeIn 0.2s ease;
}

.upload-overlay.upload-closing {
  animation: confirmFadeOut 0.25s ease forwards;
}

.upload-progress-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 32px 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: confirmSlideIn 0.2s ease;
}

.upload-closing .upload-progress-modal {
  animation: confirmSlideOut 0.25s ease forwards;
}

.upload-progress-icon {
  margin-bottom: 12px;
  animation: uploadBounce 1.2s ease-in-out infinite;
}

@keyframes uploadBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.upload-progress-modal h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.upload-file-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  word-break: break-all;
  max-height: 40px;
  overflow: hidden;
}

.upload-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.upload-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Responsive */
@media (max-width: 767px) {
  .page-index {
    padding: 16px;
  }
  .page-header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .drop-zone {
    padding: 40px 16px;
  }
  .file-list-header {
    display: none;
  }
  .file-item {
    flex-wrap: wrap;
    padding: 12px;
    gap: 4px 0;
  }
  .file-icon-col {
    width: 36px;
  }
  .file-name-col {
    flex: 1;
    min-width: 0;
    padding-right: 0;
  }
  .file-type-col,
  .file-size-col,
  .file-date-col {
    width: auto;
    flex: 0 0 auto;
    font-size: 0.75rem;
    padding-right: 0;
    text-align: left;
  }
  .file-name-col .file-name {
    font-size: 0.875rem;
  }
  .file-meta-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding-left: 36px;
    font-size: 0.75rem;
    color: var(--text-secondary);
  }
  .file-action-col {
    width: 64px;
  }
}

@media (min-width: 768px) {
  .file-list-table {
    /* slightly larger on desktop */
  }
  .file-list-body {
    max-height: calc(100vh - 240px);
  }
}
