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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px;
}

header {
  text-align: center;
  padding: 32px 0 24px;
}

header h1 {
  font-size: 1.8rem;
  color: #1a1a2e;
  margin-bottom: 6px;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
}

/* 頁籤 */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.tab {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: none;
  font-size: 1rem;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
  color: #555;
}

.tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 搜尋框 */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: #2563eb;
}

.search-box button,
#batchBtn {
  padding: 12px 24px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-box button:hover,
#batchBtn:hover:not(:disabled) {
  background: #1d4ed8;
}

#batchBtn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* 上傳區 */
.upload-area {
  background: #fff;
  border: 2px dashed #d0d5dd;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.upload-area p {
  margin-bottom: 12px;
  color: #555;
}

.file-input-wrapper {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.hint {
  margin-top: 8px;
  font-size: 0.85rem;
}

.hint a {
  color: #2563eb;
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

/* 進度條 */
.progress-area {
  margin-bottom: 20px;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 4px;
  width: 0;
  transition: width 0.3s;
}

#progressText {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

/* 結果區 */
.result-area {
  min-height: 40px;
}

.result-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.result-card .company-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 6px;
}

.result-card .info-row {
  display: flex;
  gap: 24px;
  font-size: 0.9rem;
  color: #555;
}

.result-card .info-row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.result-card .label {
  color: #888;
}

.result-header {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.no-result {
  text-align: center;
  color: #999;
  padding: 32px 0;
  font-size: 0.95rem;
}

.error-msg {
  text-align: center;
  color: #dc2626;
  padding: 16px;
  background: #fef2f2;
  border-radius: 8px;
}

/* 查詢中動畫 */
.loading {
  text-align: center;
  padding: 32px 0;
  color: #666;
}

.loading::after {
  content: "";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}

/* 下載按鈕 */
.download-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.2s;
}

.download-btn:hover {
  background: #047857;
}

/* 批次結果表格 */
.batch-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

.batch-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e5e7eb;
}

.batch-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}

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

.batch-table .status-ok {
  color: #059669;
}

.batch-table .status-na {
  color: #999;
}

footer {
  text-align: center;
  padding: 32px 0 16px;
  color: #aaa;
  font-size: 0.8rem;
}

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

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

  .result-card .info-row {
    flex-direction: column;
    gap: 4px;
  }
}
