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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

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

main {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.step {
  animation: fadeIn 0.3s ease-in;
}

.step.hidden {
  display: none;
}

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

h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.search-box {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.search-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.search-options label {
  color: var(--text-light);
  font-size: 0.9rem;
}

.search-options select {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}

.search-options select:focus {
  outline: none;
  border-color: var(--primary);
}

input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-hover);
}

button:disabled {
  background: var(--secondary);
  cursor: not-allowed;
}

.back-btn {
  background: var(--secondary);
  margin-top: 1rem;
}

.back-btn:hover {
  background: #475569;
}

.primary-btn {
  margin-top: 1rem;
  width: 100%;
}

.hint {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.list {
  display: grid;
  gap: 0.75rem;
}

.list-item {
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg);
  position: relative;
}

.list-item:hover {
  border-color: var(--primary);
  background: #f1f5f9;
  transform: translateX(4px);
}

.list-item.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.list-item.status-checking {
  opacity: 0.6;
  cursor: wait;
}

.list-item.status-in-stock {
  border-left: 4px solid var(--success);
  background: #f0fdf4;
}

.list-item.status-out-of-stock {
  border-left: 4px solid var(--danger);
  background: #fef2f2;
}

.list-item.status-limited {
  border-left: 4px solid var(--warning);
  background: #fffbeb;
}

.list-item.status-unknown {
  border-left: 4px solid var(--secondary);
  background: #f8fafc;
}

.branch-status {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.branch-status.in-stock {
  color: #065f46;
}

.branch-status.out-of-stock {
  color: #991b1b;
}

.branch-status.limited {
  color: #92400e;
}

.branch-status.unknown {
  color: #64748b;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.in-stock {
  background: var(--success);
}

.status-indicator.out-of-stock {
  background: var(--danger);
}

.status-indicator.limited {
  background: var(--warning);
}

.status-indicator.unknown {
  background: var(--secondary);
}

.product-info {
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.product-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.5rem;
}

.availability-info {
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.availability-info h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.status {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.status.in-stock {
  background: #d1fae5;
  color: #065f46;
}

.status.out-of-stock {
  background: #fee2e2;
  color: #991b1b;
}

.status.limited {
  background: #fef3c7;
  color: #92400e;
}

.status.unknown {
  background: #e5e7eb;
  color: #374151;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-light);
  font-weight: 500;
}

.info-value {
  color: var(--text);
  font-weight: 600;
}

.loading {
  text-align: center;
  padding: 3rem;
}

.loading.hidden {
  display: none;
}

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

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

.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  border: 1px solid #fecaca;
}

.error code {
  background: #fecaca;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  display: inline-block;
  margin: 0.25rem 0;
}

.error.hidden {
  display: none;
}

footer {
  margin-top: 2rem;
}

details {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem;
  user-select: none;
}

summary:hover {
  color: var(--primary);
}

.info-content {
  padding: 1rem 0.5rem;
  margin-top: 1rem;
}

.info-content h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.info-content h4 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.info-content ol,
.info-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.info-content li {
  margin-bottom: 0.5rem;
}

.info-content code {
  background: #f1f5f9;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

@media (max-width: 640px) {
  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 1.5rem;
  }

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

  button {
    width: 100%;
  }
}
