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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-gradient-start: #1e1b4b;
  --bg-gradient-end: #312e81;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
  color: white;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 16px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.95rem;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: white;
  text-decoration: underline;
}

.breadcrumb-sep {
  color: rgba(255, 255, 255, 0.5);
}

/* Status Indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

.status-dot.success {
  background: var(--success);
  animation: none;
}

.status-dot.error {
  background: var(--danger);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Mode Badge */
.mode-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.mode-badge.admin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.mode-badge.project {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

/* Main Content */
.main-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon {
  font-size: 1.1rem;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-back {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  text-decoration: none;
}

.btn-back:hover {
  background: #f1f5f9;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

/* Delete Warning */
.delete-warning {
  text-align: center;
  padding: 20px 0;
}

.delete-warning p {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.delete-warning .warning-text {
  color: var(--danger);
  font-size: 0.95rem;
}

/* Version Card Delete Button */
.version-card {
  position: relative;
}

.version-card .card-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fee2e2;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
}

.version-card:hover .card-delete {
  opacity: 1;
}

.version-card .card-delete:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.1);
}

/* Project/Version/File Lists */
.project-list,
.version-list,
.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Cards */
.project-card,
.version-card,
.file-card {
  background: #fafbfc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}

.project-card:hover,
.version-card:hover,
.file-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.card-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  word-break: break-all;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag.ok,
.tag.success {
  background: #dcfce7;
  color: #166534;
}

.tag.warn,
.tag.warning {
  background: #fef3c7;
  color: #92400e;
}

.tag.info {
  background: #e0e7ff;
  color: #3730a3;
}

.tag.html {
  background: #fce7f3;
  color: #9d174d;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: auto;
}

.card-link:hover {
  text-decoration: underline;
}

/* Empty State */
.project-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

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

/* Pagination */
.pagination {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

.pagination-actions button {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.pagination-actions button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalIn 0.2s ease-out;
}

.modal-lg {
  max-width: 600px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
  padding: 4px;
  line-height: 1;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 160px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-prefix-group {
  display: flex;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-prefix-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-prefix {
  padding: 12px 14px;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-family: "SF Mono", Monaco, monospace;
  font-size: 0.95rem;
  white-space: nowrap;
  border-right: 1px solid var(--border-color);
}

.input-prefix-group input {
  flex: 1;
  padding: 12px 14px;
  border: none;
  font-size: 1rem;
  font-family: "SF Mono", Monaco, monospace;
}

.input-prefix-group input:focus {
  outline: none;
}

.form-hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Upload Mode Hint */
.upload-mode-hint {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.upload-mode-hint.hangti {
  background: #fef3c7;
  border-color: #fcd34d;
}

.upload-mode-hint .hint-label {
  font-weight: 600;
  color: #1e40af;
  white-space: nowrap;
}

.upload-mode-hint.hangti .hint-label {
  color: #92400e;
}

.upload-mode-hint .hint-text {
  font-size: 0.9rem;
  color: #1e3a8a;
  line-height: 1.5;
}

.upload-mode-hint.hangti .hint-text {
  color: #78350f;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafbfc;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: #f0f0ff;
}

.upload-zone .upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.upload-zone h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.upload-zone .upload-hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Progress */
.progress-summary {
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.progress-bar-container {
  background: #e2e8f0;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-list {
  max-height: 300px;
  overflow-y: auto;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.progress-item.success {
  background: #dcfce7;
}

.progress-item.error {
  background: #fee2e2;
}

.progress-item-name {
  flex: 1;
  word-break: break-all;
}

.progress-item-status {
  font-size: 1.1rem;
}

/* Notifications */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  animation: slideIn 0.3s ease;
  max-width: 380px;
  font-size: 0.95rem;
}

.notification.success {
  border-left-color: var(--success);
}

.notification.error {
  border-left-color: var(--danger);
}

.notification.warning {
  border-left-color: var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Path Navigation */
.path-nav {
  margin-bottom: 16px;
}

.path-nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.path-item {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.path-item:hover {
  background: #e0e7ff;
}

.path-item.current {
  color: var(--text-primary);
  background: white;
  border: 1px solid var(--border-color);
}

.path-sep {
  color: var(--text-secondary);
  margin: 0 2px;
}

/* File Browser */
.file-browser {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.browser-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f1f5f9;
}

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

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

.browser-item.back-item {
  background: #fafbfc;
}

.browser-item.back-item:hover {
  background: #f1f5f9;
}

.item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

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

.item-name {
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.item-arrow {
  font-size: 1.2rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--primary);
  transform: scale(1.05);
}

.folder-item .item-icon {
  color: #fbbf24;
}

.file-item {
  cursor: default;
}

/* File Card Specific (legacy, keep for compatibility) */
.file-card {
  display: flex;
  flex-direction: column;
}

.file-card .card-icon {
  font-size: 2.5rem;
}

.file-card .file-size {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.file-card .file-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.file-card .file-actions a {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.file-card .file-actions .btn-view {
  background: var(--primary);
  color: white;
}

.file-card .file-actions .btn-view:hover {
  background: var(--primary-dark);
}

.file-card .file-actions .btn-download {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.file-card .file-actions .btn-download:hover {
  background: #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .header h1 {
    font-size: 1.8rem;
  }

  .main-content {
    padding: 20px;
  }

  .project-list,
  .version-list,
  .file-list {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-direction: column;
  }

  .action-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .pagination {
    flex-direction: column;
    text-align: center;
  }

  .modal {
    margin: 16px;
  }

  .notification-container {
    left: 16px;
    right: 16px;
  }

  .notification {
    max-width: none;
  }
}
