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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #050816;
  min-height: 100vh;
  padding: 2rem;
  color: #e2e8f0;
}

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

header {
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.brand-text h1 {
  font-size: 2.4rem;
  color: #f8fafc;
  margin-bottom: 0.35rem;
}

.brand-text p {
  font-size: 1rem;
  color: #94a3b8;
}

.card {
  background: #111827;
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.45);
  border: 1px solid #1e293b;
}

.card h2 {
  margin-bottom: 1rem;
  color: #38bdf8;
}

.hint {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.upload-zone {
  border: 2px dashed #334155;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #38bdf8;
  background: #1e293b;
  transform: translateY(-2px);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-zone h3 {
  margin-bottom: 0.5rem;
  color: #e2e8f0;
}

.upload-zone p {
  color: #94a3b8;
  margin-bottom: 1rem;
}

.upload-zone button {
  background: #38bdf8;
  color: #02111f;
  border: none;
  padding: 0.55rem 1.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.upload-zone button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.35);
}

.files-list {
  margin-top: 1rem;
  text-align: left;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  max-height: 300px;
}

.file-item {
  background: #1f2937;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #cbd5f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .remove-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.2s;
}

.file-item .remove-btn:hover {
  background: #dc2626;
}

.primary-btn {
  background: #38bdf8;
  color: #02111f;
  border: none;
  padding: 1rem 2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(56, 189, 248, 0.35);
}

.primary-btn:disabled {
  background: #1f2a3d;
  color: #475569;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: #38bdf8;
  border: 2px solid #38bdf8;
  padding: 1rem 2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.secondary-btn:hover {
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-2px);
}

.match-item {
  background: #0f172a;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid #38bdf8;
}

.match-item.weak {
  border-left-color: #facc15;
}

.match-item.unmatched {
  border-left-color: #ef4444;
}

.match-info {
  flex: 1;
}

.match-files {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: #f8fafc;
}

.match-file {
  flex: 1;
  font-weight: 500;
}

.match-status {
  margin-top: 0.5rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

.confidence-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.confidence-badge.strong {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

.confidence-badge.moderate {
  background: rgba(249, 115, 22, 0.18);
  color: #f97316;
}

.confidence-badge.weak,
.confidence-badge.unmatched {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}

.progress-container {
  text-align: center;
  padding: 2rem;
}

.progress-bar {
  width: 100%;
  height: 28px;
  background: #1f2937;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #22d3ee);
  width: 0%;
  transition: width 0.3s ease;
}

#progress-text {
  color: #94a3b8;
  font-size: 0.9rem;
}

.success {
  color: #34d399;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.result-item {
  background: #0f172a;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #1f2937;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-icon {
  font-size: 1.2rem;
}

.result-info h4 {
  margin-bottom: 0.25rem;
  color: #f1f5f9;
}

.result-info p {
  font-size: 0.85rem;
  color: #94a3b8;
}

.status-text {
  font-size: 0.85rem;
  color: #94a3b8;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.copy-actions {
  justify-content: flex-end;
}

.warning-text {
  color: #facc15;
}

.copy-hint {
  background: rgba(56, 189, 248, 0.1);
  border-left: 4px solid #38bdf8;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #bae6fd;
  font-size: 0.9rem;
}

.copy-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.copy-header h2 {
  margin: 0;
  color: #38bdf8;
}

.copy-header p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.copy-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.copy-table-container {
  overflow-x: auto;
}

.copy-tab {
  background: #1f2937;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.1rem;
  color: #cbd5f5;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.copy-tab.active {
  background: #38bdf8;
  color: #02111f;
  transform: translateY(-1px);
}

.copy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.copy-table th,
.copy-table td {
  border: 1px solid #1f2a3d;
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.copy-table thead {
  background: #1e293b;
  color: #f1f5f9;
}

.copy-table tbody tr:nth-child(odd) {
  background: #121e33;
}

.copy-table tbody tr:nth-child(even) {
  background: #0f172a;
}

.copy-table td {
  cursor: pointer;
  position: relative;
}

.copy-table td.copied::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -1.8rem;
  right: 0.5rem;
  background: #34d399;
  color: #02130f;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.copy-table td:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }

  .upload-grid {
    gap: 0.75rem;
  }

  .upload-zone {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
    margin-top: 1rem;
  }

  body {
    padding-top: 80px;
    padding-bottom: 80px;
  }

  .container {
    padding-bottom: 80px;
  }

  #matches-list {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    margin-bottom: 1rem;
  }

  #download-list {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    margin-bottom: 1rem;
  }
}

/* Download Section Styles */
.download-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.download-item {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.download-item:hover {
  border-color: #f97316;
  background: #2a3544;
}

.download-file-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.download-file-info strong {
  color: #f9fafb;
  font-size: 1.1rem;
}

.file-size {
  color: #9ca3af;
  font-size: 0.9rem;
}

.download-buttons {
  display: flex;
  gap: 0.75rem;
}

.download-btn {
  background: #38bdf8;
  color: #02111f;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-btn:hover {
  background: #0ea5e9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.download-btn:active {
  transform: translateY(0);
}

.match-item {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.match-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 1rem;
  align-items: center;
}

.match-file {
  background: #111827;
  padding: 1rem;
  border-radius: 8px;
}

.match-arrow {
  color: #f97316;
  font-size: 1.5rem;
  font-weight: bold;
}

.match-info {
  color: #9ca3af;
  font-size: 0.85rem;
  text-align: right;
}

@media (max-width: 768px) {
  .download-item {
    flex-direction: column;
    gap: 1rem;
  }

  .download-buttons {
    width: 100%;
    flex-direction: column;
  }

  .download-btn {
    width: 100%;
  }

  .match-pair {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .match-arrow {
    text-align: center;
  }
}
