/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 480px;
}

/* ============ Header ============ */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* ============ Card ============ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: opacity 0.3s ease;
}

.hidden { display: none !important; }

/* ============ QR Code ============ */
.qrcode-card {
  text-align: center;
}

.qrcode-wrapper {
  width: 260px;
  height: 260px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 12px;
  border: 2px dashed var(--border);
  overflow: hidden;
}

.qrcode-img {
  width: 240px;
  height: 240px;
  border-radius: 8px;
  object-fit: contain;
}

/* ============ Spinner ============ */
.loading-spinner {
  text-align: center;
  color: var(--text-muted);
}

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

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

/* ============ Status Bar ============ */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: #f0f4ff;
  margin-bottom: 0.8rem;
}

.status-icon {
  font-size: 1.2rem;
}

.status-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============ Button ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(0.97); }

/* ============ Result Card ============ */
.result-card {
  border-color: var(--success);
  border-width: 2px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.result-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.result-icon { font-size: 1.5rem; }

.result-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.cookie-box {
  display: flex;
  gap: 0.5rem;
}

.cookie-box textarea {
  flex: 1;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 80px;
  background: #f8f9fc;
  color: var(--text);
  line-height: 1.5;
}

.copy-btn {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
  align-self: flex-start;
  transition: background 0.2s;
}

.copy-btn:hover { background: #f0f4ff; }
.copy-btn:active { transform: scale(0.97); }

.toast {
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--success);
  color: #fff;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s;
}

/* ============ Error Card ============ */
.error-card {
  border-color: var(--error);
  border-width: 2px;
  text-align: center;
}

.error-message {
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mt-1 { margin-top: 0.5rem; }

/* ============ Footer ============ */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ============ Responsive ============ */
@media (max-width: 480px) {
  body { padding: 1rem 0.8rem; }
  .qrcode-wrapper { width: 220px; height: 220px; }
  .qrcode-img { width: 200px; height: 200px; }
  .cookie-box { flex-direction: column; }
  .copy-btn { align-self: stretch; text-align: center; }
}
