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

:root {
  --primary: #ff6b35;
  --primary-dark: #e85a2a;
  --secondary: #004e89;
  --background: #0a0e27;
  --surface: #1a1f3a;
  --surface-light: #252b4a;
  --text: #e8e9f3;
  --text-secondary: #a0a3bd;
  --success: #06d6a0;
  --error: #ef476f;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.3);
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem 1rem;
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.6s ease-out;
}

.logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  color: var(--primary);
  filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.5));
}

h1 {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #ffb347 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Search Section */
.search-section {
  margin-bottom: 3rem;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.search-box {
  display: flex;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px var(--shadow);
  transition: all 0.3s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(255, 107, 53, 0.3);
  transform: translateY(-2px);
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  padding: 1rem 1.5rem;
  font-family: inherit;
}

#searchInput::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 107, 53, 0.6);
}

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

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

.search-icon {
  width: 20px;
  height: 20px;
}

/* Loading Section */
.loading-section {
  text-align: center;
  padding: 4rem 2rem;
  animation: fadeIn 0.3s ease-out;
}

.spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--surface-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error Section */
.error-section {
  background: rgba(239, 71, 111, 0.1);
  border: 1px solid var(--error);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.error-icon {
  width: 48px;
  height: 48px;
  color: var(--error);
  margin-bottom: 1rem;
}

#errorMessage {
  color: var(--error);
  font-size: 1.1rem;
}

/* Results Section */
.results-section {
  animation: fadeInUp 0.6s ease-out;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-header h2 {
  font-size: 2rem;
  font-weight: 700;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.result-count {
  background: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--primary);
}

.search-url {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--surface);
}

.search-url:hover {
  color: var(--primary);
  background: var(--surface-light);
}

.search-url svg {
  width: 16px;
  height: 16px;
}

/* Table Actions Bar */
.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  flex-wrap: wrap;
  gap: 1rem;
}

.selection-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.export-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text);
}

.action-btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

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

.action-btn.primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border: none;
  color: white;
}

.action-btn.primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
  transform: translateY(-1px);
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

/* Checkbox Styles */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-size: 0.9rem;
}

.checkbox-label input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: var(--surface-light);
}

.checkbox-label:hover .checkmark {
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.table-checkbox {
  justify-content: center;
}

/* Table Container */
.table-container {
  overflow-x: auto;
  background: var(--surface);
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--border);
  border-top: none;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.products-table th,
.products-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.products-table th {
  background: var(--surface-light);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.products-table tbody tr {
  transition: background 0.2s ease;
}

.products-table tbody tr:hover {
  background: var(--surface-light);
}

.products-table tbody tr.selected {
  background: rgba(255, 107, 53, 0.1);
}

.products-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column Widths */
.col-select {
  width: 50px;
  text-align: center;
}
.col-image {
  width: 80px;
}
.col-title {
  min-width: 250px;
}
.col-price {
  width: 120px;
}
.col-moq {
  width: 120px;
}
.col-supplier {
  width: 200px;
}
.col-actions {
  width: 100px;
  text-align: center;
}

/* Table Cell Content */
.table-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-light);
}

.table-title {
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.table-price {
  color: var(--primary);
  font-weight: 600;
  font-size: 1rem;
}

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

.table-supplier {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

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

.view-link svg {
  width: 14px;
  height: 14px;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .search-box {
    flex-direction: column;
  }

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

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .export-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .action-btn span {
    display: none;
  }

  .action-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Mobile Table Cards View */
@media (max-width: 640px) {
  .table-container {
    border-radius: 12px;
  }

  .products-table {
    min-width: unset;
  }

  .products-table thead {
    display: none;
  }

  .products-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    align-items: center;
  }

  .products-table tbody td {
    border: none;
    padding: 0;
  }

  .products-table .col-select {
    order: 1;
    width: auto;
  }

  .products-table .col-image {
    order: 2;
    width: auto;
  }

  .products-table .col-title {
    order: 3;
    flex: 1;
    min-width: calc(100% - 100px);
  }

  .products-table .col-price {
    order: 4;
    width: 50%;
  }

  .products-table .col-moq {
    order: 5;
    width: 50%;
  }

  .products-table .col-supplier {
    order: 6;
    width: 100%;
  }

  .products-table .col-actions {
    order: 7;
    width: 100%;
    text-align: left;
    margin-top: 0.5rem;
  }
}
