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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.5rem;
  color: #2c3e50;
}

/* API Key入力 */
.api-key-area {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.api-key-area input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.875rem;
}

.api-key-area input:focus {
  outline: none;
  border-color: #3498db;
}

.save-button {
  padding: 12px 16px;
  background-color: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: bold;
  cursor: pointer;
}

.save-button:hover {
  background-color: #219a52;
}

/* アップロードエリア */
.upload-area {
  text-align: center;
  margin-bottom: 24px;
}

.upload-button {
  display: inline-block;
  background-color: #3498db;
  color: white;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.upload-button:hover {
  background-color: #2980b9;
}

.upload-button:active {
  background-color: #2472a4;
}

.file-name {
  margin-top: 8px;
  font-size: 0.875rem;
  color: #666;
}

.mock-button {
  margin-top: 12px;
  padding: 8px 16px;
  background-color: #95a5a6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.mock-button:hover {
  background-color: #7f8c8d;
}

/* ローディング */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

/* エラー */
.error {
  background-color: #fee;
  border: 1px solid #fcc;
  color: #c00;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  text-align: left;
  font-size: 0.8rem;
  word-break: break-all;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* 結果エリア */
.result-area {
  background-color: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-area h2 {
  font-size: 1.125rem;
  margin-bottom: 16px;
  color: #2c3e50;
}

/* 項目リスト */
.items-list {
  margin-bottom: 24px;
}

.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  gap: 8px;
}

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

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

.item-name {
  font-size: 0.9375rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-price {
  font-weight: bold;
  font-size: 0.9375rem;
  color: #2c3e50;
}

.segment-control {
  display: flex;
  border: 1px solid #3498db;
  border-radius: 6px;
  overflow: hidden;
}

.segment-control button {
  padding: 6px 12px;
  border: none;
  background: white;
  color: #3498db;
  font-size: 0.75rem;
  cursor: pointer;
  border-right: 1px solid #3498db;
}

.segment-control button:last-child {
  border-right: none;
}

.segment-control button.active {
  background: #3498db;
  color: white;
}

.segment-control button:hover:not(.active) {
  background: #ebf5fb;
}

/* 税率選択 */
.tax-selector {
  margin-bottom: 24px;
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.tax-selector h3 {
  font-size: 0.875rem;
  margin-bottom: 12px;
  color: #666;
}

.tax-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tax-options label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.875rem;
}

.tax-options input[type="radio"] {
  margin-right: 6px;
  accent-color: #3498db;
}

/* 合計エリア */
.total-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background-color: #3498db;
  border-radius: 8px;
  color: white;
}

.total-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.total-label {
  font-size: 1rem;
}

.total-amount {
  font-size: 1.5rem;
  font-weight: bold;
}

.total-currency {
  font-size: 1rem;
}

.copy-button {
  background-color: white;
  color: #3498db;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.copy-button:hover {
  background-color: #f0f0f0;
}

.copy-button:active {
  background-color: #e0e0e0;
}

.copy-button.copied {
  background-color: #27ae60;
  color: white;
}

/* レスポンシブ */
@media (max-width: 320px) {
  .container {
    padding: 16px;
  }

  .upload-button {
    padding: 12px 24px;
    font-size: 0.875rem;
  }

  .tax-options {
    flex-direction: column;
    gap: 8px;
  }
}
