/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #ffffff;
  color: #111827;
  min-height: 100vh;
  line-height: 1.5;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Loading Spinner */
.spinner {
  border: 2px solid #f3f4f6;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Layout */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

header .container {
  padding: 1.5rem 1rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

header p {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Main Content */
main {
  padding: 2rem 0;
}

/* Controls Section */
.controls {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  background-color: #ffffff;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

/* Range Slider */
.range-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex: 1;
  height: 0.375rem;
  background: #e5e7eb;
  border-radius: 0.25rem;
  appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

.range-slider::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
  padding: 0 0.25rem;
}

.number-input {
  width: 6rem;
}

/* Grid Layout */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

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

.filters-grid-compact {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.25rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background-color: #3b82f6;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-secondary {
  background-color: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background-color: #f9fafb;
}

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

.btn-group {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.btn-toggle {
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
}

.btn-toggle:hover {
  color: #2563eb;
}

.btn-toggle svg {
  width: 1rem;
  height: 1rem;
  margin-right: 0.375rem;
}

/* Additional Filters */
.additional-filters {
  margin-bottom: 1.5rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.additional-filters.hidden {
  display: none;
}

/* Progress Bar */
.progress-container {
  width: 100%;
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.progress-status {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: #6b7280;
}

.progress-status .spinner {
  margin-right: 0.5rem;
}

.progress-percentage {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.progress-bar-outer {
  width: 100%;
  background-color: #e5e7eb;
  border-radius: 9999px;
  height: 0.5rem;
  overflow: hidden;
}

.progress-bar-inner {
  background-color: #3b82f6;
  height: 0.5rem;
  transition: width 0.2s;
}

.progress-text {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

/* Table */
.table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
}

thead {
  background-color: #f9fafb;
}

th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

tr:last-child td {
  border-bottom: none;
}

/* Car Card */
.car-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.car-card a {
  text-decoration: none;
  color: inherit;
}

.car-image {
  border-radius: 0.25rem;
  border: 1px solid #e5e7eb;
}

.car-image img {
  width: 12rem;
  height: auto;
  display: block;
}

.car-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-top: 0.5rem;
}

.car-info {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.car-price {
  margin-top: 0.5rem;
}

.car-price-krw {
  font-size: 0.875rem;
  color: #374151;
}

.car-price-eur {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

/* Details Sections */
.detail-section {
  margin-bottom: 1rem;
}

.detail-section h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.5rem;
}

.detail-section p {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.6;
}

.detail-section pre {
  font-size: 0.75rem;
  white-space: pre-wrap;
  font-family: inherit;
}

.detail-section img {
  max-width: 150px;
}

/* Score Badge */
.score-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: #3b82f6;
  color: #ffffff;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Analysis */
.analysis-text {
  font-size: 0.75rem;
  white-space: pre-wrap;
  color: #6b7280;
  line-height: 1.5;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .filters-grid-compact {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .filters-grid-compact {
    grid-template-columns: 1fr;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .container {
    padding: 0 0.5rem;
  }
}
