/* ===== GrubTech Expansion Builder — Design System ===== */
/* Satoshi font, brand blue #2B7EBC */

/* --- CSS Variables --- */
:root {
  --brand: #2B7EBC;
  --brand-light: #3a8fd0;
  --brand-dark: #1a5a8a;

  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-subtle: #f1f5f9;
  --surface-brand-light: #f5faff;

  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  --shadow-elevated: 0 20px 50px rgba(0,0,0,0.12);
  --shadow-brand-sm: 0 2px 8px rgba(43,126,188,0.08);
  --shadow-brand: 0 4px 20px rgba(43,126,188,0.12);
  --shadow-brand-lg: 0 8px 30px rgba(43,126,188,0.15);
}

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

html, body {
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--surface-muted);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes slideRight {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Layout --- */
.page-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  animation: fadeInUp 0.5s ease;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow-elevated);
}

/* --- Logo --- */
.logo-container {
  text-align: center;
  margin-bottom: 28px;
}
.logo-container img { width: 160px; }

/* --- Step Header --- */
.step-header {
  margin-bottom: 28px;
  text-align: center;
}
.step-badge {
  display: inline-block;
  background: var(--surface-brand-light);
  color: var(--brand);
  border: 1px solid rgba(43,126,188,0.2);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.step-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.step-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Progress Bar --- */
.progress-bar-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  transition: all 0.3s ease;
}
.progress-dot.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.progress-dot.done {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.progress-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color 0.3s ease;
}
.progress-step.active .progress-label { color: var(--brand); font-weight: 600; }
.progress-step.done .progress-label { color: var(--success); }
.progress-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  max-width: 48px;
  transition: background 0.3s ease;
}
.progress-connector.done { background: var(--success); }

/* --- Divider --- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 24px 0;
}

/* --- Form fields --- */
.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input-group label .req { color: var(--error); }

input[type="text"],
input[type="date"],
input[type="email"],
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: var(--text-tertiary); }
input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43,126,188,0.1);
}

/* Error state for inputs */
input.input-error {
  border-color: var(--error);
}
input.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}
.field-error {
  color: var(--error);
  font-size: 12px;
  margin-top: 4px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --- Buttons --- */
.primary_button {
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-brand-sm);
}
.primary_button:hover {
  box-shadow: var(--shadow-brand-lg);
  transform: translateY(-1px);
}
.primary_button:active { transform: translateY(0); }
.primary_button:disabled {
  background: var(--surface-subtle);
  color: var(--text-tertiary);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  border: 1px solid var(--border);
}

.secondary_button {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.secondary_button:hover {
  background: var(--surface-subtle);
  border-color: var(--brand);
  color: var(--brand);
}

.btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
}
.btn-row.right { justify-content: flex-end; }

/* --- Location Cards --- */
.location-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
  background: var(--surface-muted);
  position: relative;
  animation: slideRight 0.25s ease;
  transition: border-color 0.2s;
}
.location-card:hover { border-color: var(--brand); }

.location-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.location-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--error);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background 0.2s;
}
.remove-btn:hover { background: rgba(239,68,68,0.08); }

/* --- Channel Select (tag-style) --- */
.channel-search-container {
  position: relative;
  margin-bottom: 10px;
}
.channel-search-container input {
  padding-left: 14px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--surface);
}

.channel-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  background: var(--surface);
  user-select: none;
}
.channel-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface-brand-light);
}
.channel-chip.selected {
  border-color: var(--brand);
  background: var(--surface-brand-light);
  color: var(--brand);
  font-weight: 600;
}
.channel-chip input[type="checkbox"] {
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* --- Selected channels pills --- */
.selected-channels-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin-top: 10px;
}
.ch-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-brand-light);
  border: 1px solid rgba(43,126,188,0.3);
  color: var(--brand);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.ch-pill .remove-chip {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
}
.ch-pill .remove-chip:hover { opacity: 1; }

/* --- Summary / Review --- */
.summary-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.summary-block-header {
  background: var(--surface-subtle);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--text-secondary); }
.summary-row .value { font-weight: 600; color: var(--text-primary); }
.summary-channels {
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Legal --- */
.legal-text {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin: 16px 0;
  max-height: 200px;
  overflow-y: auto;
}
.legal-text strong { color: var(--text-primary); font-weight: 600; }

.legal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 20px;
}
.legal-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand);
}
.legal-checkbox label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* --- Spinner --- */
.spinner-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.spinner-overlay.active { display: flex; }
.spinner-circle {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(43,126,188,0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-overlay p {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* --- Success --- */
.success-wrapper {
  text-align: center;
  padding: 20px 0 10px;
}
.success-icon {
  width: 64px;
  height: 64px;
  background: rgba(16,185,129,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
  color: var(--success);
}
.success-wrapper h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 8px;
}
.success-wrapper p { color: var(--text-secondary); font-size: 14px; }

/* --- Error state --- */
.error-msg {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
}

/* --- Info box --- */
.info-box {
  background: var(--surface-brand-light);
  border: 1px solid rgba(43,126,188,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--brand);
  font-weight: 500;
  margin-bottom: 16px;
}

/* --- Add location button --- */
.add-location-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  margin-bottom: 4px;
}
.add-location-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface-brand-light);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* --- Responsive --- */
@media (max-width: 600px) {
  .page-container { padding: 16px 12px 60px; }
  .card { padding: 24px 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: repeat(2, 1fr); }
}
