/**
 * app.css — Styles for wizard, landing page, and dashboard
 * @version 0.1.0
 */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1e293b;
  background: #f9fafb;
}

/* --- App container --- */
.app-wrap {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-y: auto;
}

.app-content {
  width: 100%;
  max-width: 800px;
  padding: 48px 40px;
  margin: auto 0;
}

/* --- Progress bar --- */
.app-progress {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 40px;
}

.app-progress span {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background 0.3s;
}

.app-progress span.active {
  background: #2563eb;
}

/* --- Typography --- */
.app-title {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px;
  line-height: 1.3;
  text-align: center;
}

.app-subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 32px;
  line-height: 1.6;
  text-align: center;
}

/* --- Buttons --- */
.app-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

.app-btn {
  padding: 12px 32px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.app-btn-primary {
  background: #2563eb;
  color: #fff;
}

.app-btn-primary:hover {
  background: #3b82f6;
}

.app-btn-secondary {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.app-btn-secondary:hover {
  background: #f9fafb;
  color: #3b82f6;
}

.app-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Form fields --- */
.app-form {
  max-width: 480px;
  margin: 0 auto 24px;
  text-align: left;
}

.app-field {
  margin-bottom: 20px;
}

.app-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.app-field input,
.app-field textarea,
.app-field select {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.app-field input:focus,
.app-field textarea:focus,
.app-field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.app-field textarea {
  resize: vertical;
  min-height: 80px;
}

.app-field input::placeholder,
.app-field textarea::placeholder {
  color: #9ca3af;
}

/* --- Progressive field reveal --- */
.app-field-reveal {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  margin-bottom: 0 !important;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease 0.1s,
              margin-bottom 0.45s ease;
}

.app-field-reveal.upcoming {
  max-height: 400px;
  opacity: 0.3;
  pointer-events: none;
  margin-bottom: 20px !important;
}

.app-field-reveal.visible {
  max-height: 400px;
  opacity: 1;
  pointer-events: auto;
  margin-bottom: 20px !important;
  overflow: visible;
}

/* --- Color palette cards --- */
.app-palettes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  text-align: left;
}

.app-palette-card {
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  animation: app-fade-up 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.app-palette-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.app-palette-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb, 0 4px 16px rgba(37,99,235,0.15);
}

@keyframes app-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-palette-strip {
  display: flex;
  height: 48px;
}

.app-palette-color {
  flex: 1;
}

.app-palette-name {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  padding: 8px 12px;
  letter-spacing: 0.01em;
}

/* --- Font preset cards --- */
.app-fonts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.app-font-card {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  overflow: hidden;
}

.app-font-card:hover {
  border-color: #9ca3af;
}

.app-font-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.app-font-preview {
  padding: 20px 16px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.app-font-heading {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  margin-bottom: 6px;
}

.app-font-body {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.app-font-name {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  padding: 10px 16px;
  text-align: center;
}

/* --- Style preset tabs --- */
.app-styles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.app-style-tab {
  padding: 14px 8px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.app-style-tab:hover {
  border-color: #9ca3af;
}

.app-style-tab.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.app-style-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.app-style-desc {
  display: block;
  font-size: 11px;
  color: #9ca3af;
}

.app-style-tab.selected .app-style-name {
  color: #2563eb;
}

/* --- Page selection cards --- */
.app-pages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  text-align: center;
}

.app-page-card {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  padding: 20px 12px;
}

.app-page-card:hover {
  border-color: #9ca3af;
}

.app-page-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.app-page-card.required {
  opacity: 0.7;
  cursor: default;
}

.app-page-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.app-page-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.app-page-card.selected .app-page-name {
  color: #2563eb;
}

/* --- Loading state --- */
.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 60px 0;
  text-align: center;
}

.app-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

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

.app-loading-msg {
  color: #6b7280;
  font-size: 15px;
  transition: opacity 0.3s ease;
}

.app-loading-progress {
  width: 200px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.app-loading-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}

/* --- Done state --- */
.app-done-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 28px;
}

.app-done-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.app-done-links a {
  color: #2563eb;
  font-weight: 500;
  text-decoration: none;
  font-size: 15px;
}

.app-done-links a:hover {
  text-decoration: underline;
}

/* --- Landing page specific --- */
.landing-hero {
  background: #0f172a;
  color: #fff;
  padding: 100px 24px 80px;
  text-align: center;
}

.landing-hero h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero p {
  font-size: 20px;
  color: rgba(255,255,255,0.7);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.landing-hero .app-btn {
  font-size: 18px;
  padding: 16px 40px;
  background: #f59e0b;
  color: #0f172a;
  border-radius: 50px;
  font-weight: 600;
}

.landing-hero .app-btn:hover {
  background: #fbbf24;
}

.landing-section {
  padding: 80px 24px;
  max-width: 960px;
  margin: 0 auto;
}

.landing-section h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.landing-step {
  text-align: center;
}

.landing-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 16px;
}

.landing-step h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.landing-step p {
  font-size: 15px;
  color: #6b7280;
  line-height: 1.6;
}

.landing-cta {
  background: #0f172a;
  color: #fff;
  text-align: center;
  padding: 80px 24px;
}

.landing-cta h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
}

.landing-cta p {
  color: rgba(255,255,255,0.7);
  margin-bottom: 32px;
  font-size: 18px;
}

.landing-footer {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: 13px;
}

/* --- Error message --- */
.app-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  text-align: center;
}

/* --- Dashboard --- */
.dash-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.dash-logo {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-user-name {
  font-size: 14px;
  color: #6b7280;
}

.dash-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dash-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.dash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 0;
  color: #6b7280;
}

.dash-empty {
  text-align: center;
  padding: 80px 0;
  color: #6b7280;
}

.dash-empty h2 {
  font-size: 20px;
  color: #1e293b;
  margin-bottom: 8px;
}

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

.dash-site-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  transition: box-shadow 0.2s;
}

.dash-site-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.dash-site-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.dash-site-info p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
}

.dash-site-date {
  font-size: 12px;
  color: #9ca3af;
}

.dash-site-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .app-content { padding: 32px 20px; }
  .app-palettes { grid-template-columns: repeat(2, 1fr); }
  .app-fonts { grid-template-columns: 1fr; }
  .app-styles { grid-template-columns: repeat(2, 1fr); }
  .app-pages { grid-template-columns: repeat(2, 1fr); }
  .app-title { font-size: 24px; }
  .landing-hero h1 { font-size: 32px; }
  .landing-steps { grid-template-columns: 1fr; gap: 24px; }
}
