/* style.css – ScapeWise by Growise (Mobile-first, 16px inputs, 0 horizontal scroll, Print/PDF ready) */
:root {
  --bg-dark: #060d12;
  --bg-panel: #0c1821;
  --bg-card: rgba(15, 29, 39, 0.94);
  --bg-input: #0a141c;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --amber: #f59e0b;
  --sky: #38bdf8;
  --danger: #ef4444;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(16, 185, 129, 0.24);
  --radius: 14px;
}

*, *::before, *::after {
  box-sizing: border-box;
  max-width: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: radial-gradient(circle at 20% 0%, #0d2229 0%, var(--bg-dark) 65%);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* Mobile-first rule: minimum 16px font on all form controls to prevent iOS zoom */
input, select, textarea, button {
  font-family: inherit;
  font-size: 16px !important;
  line-height: 1.4;
}

input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 13, 18, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  padding: 4px 6px;
  border-radius: 12px;
  object-fit: contain;
  background: #ffffff;
  border: 1.5px solid #10b981;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.mistakes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mistake-card {
  background: rgba(15, 29, 39, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 11px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mistake-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #15803d;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
  margin-right: 7px;
  flex-shrink: 0;
}

.brand-titles {
  min-width: 0;
}

.brand-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.brand-sub {
  margin: 0;
  font-size: 0.76rem;
  color: var(--emerald);
  font-weight: 600;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quota-pill {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid var(--emerald);
  color: #a7f3d0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.quota-pill.quota-warn {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--amber);
  color: #fde68a;
}

.quota-pill.quota-empty {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #fecaca;
}

.lang-select {
  width: auto !important;
  min-width: 82px;
  padding: 6px 10px !important;
  border-radius: 8px;
  background: var(--bg-panel);
}

.main-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 12px 60px;
  width: 100%;
}

/* Navigation Tabs */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .nav-tabs {
    grid-template-columns: repeat(5, 1fr);
  }
}

.nav-tab-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 11px;
  padding: 10px 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  word-break: break-word;
}

.nav-tab-btn.active,
.nav-tab-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(5, 150, 105, 0.18));
  border-color: var(--emerald);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

/* Wizard Stepper */
.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .wizard-stepper {
    grid-template-columns: repeat(2, 1fr);
  }
}

.step-pill {
  background: rgba(15, 29, 39, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 8px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
}

.step-pill.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--emerald);
  color: #fff;
  font-weight: 700;
}

.step-pill.done {
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

/* Cards & Grids */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card-title {
  margin: 0 0 10px 0;
  font-size: 1.18rem;
  font-weight: 800;
  color: #fff;
}

.card-sub {
  margin: 0 0 14px 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

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

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 680px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Preset chips */
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-chip {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #d1fae5;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.preset-chip.active,
.preset-chip:hover {
  background: var(--emerald);
  color: #04130e;
  font-weight: 800;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  font-weight: 800;
  border: none;
  border-radius: 11px;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  text-decoration: none;
  width: 100%;
}

@media (min-width: 640px) {
  .btn-primary.btn-auto {
    width: auto;
  }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 11px;
  padding: 10px 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.chat-cart-cta {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff !important;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  margin: 6px 0;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  text-align: center;
}

/* Style cards */
.style-card {
  background: rgba(10, 20, 28, 0.85);
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.style-card.selected {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}

.style-card h4 {
  margin: 0 0 6px 0;
  color: #fff;
}

.style-card p {
  margin: 0 0 6px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.style-card .style-example {
  font-size: 0.8rem;
  color: #6ee7b7;
}

/* Uploaded material items */
.materials-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.material-thumb-card {
  background: #081219;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  position: relative;
}

.material-thumb-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 7px;
  display: block;
}

/* Canvas & Visualizations */
.render-canvas-wrap {
  width: 100%;
  background: #050b0f;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.render-canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Full-width Chat */
.chat-section {
  width: 100%;
  max-width: 100%;
}

.chat-messages {
  max-height: 420px;
  overflow-y: auto;
  background: #071118;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  word-wrap: break-word;
}

.chat-bubble.user {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--emerald);
  margin-left: 10%;
}

.chat-bubble.assistant {
  background: rgba(15, 29, 39, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-right: 4%;
}

.chat-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

@media (min-width: 640px) {
  .chat-input-row {
    flex-direction: row;
  }
}

/* Score progress bars */
.score-bar-track {
  width: 100%;
  height: 10px;
  background: #09141c;
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 10px;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), #34d399);
  border-radius: 999px;
}

/* PWA Banner */
.pwa-banner {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 200;
  background: #0d1f29;
  border: 1px solid var(--emerald);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.hidden {
  display: none !important;
}

/* Print / PDF Export Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
  }
  .app-header,
  .nav-tabs,
  .wizard-stepper,
  .no-print,
  .pwa-banner,
  .chat-section {
    display: none !important;
  }
  .card {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .card-title, h1, h2, h3, h4, strong {
    color: #064e3b !important;
  }
}
