/* ─────────────────────────────────────────────
   Build My Business App — styles.css
   ───────────────────────────────────────────── */

:root {
  --bg:            #0F0F0F;
  --surface:       #181818;
  --border:        #2E2E2E;
  --primary:       #5B8FB9;
  --primary-hover: #4A7EA8;
  --recording:     #C0392B;
  --text:          #EBEBEB;
  --text-muted:    #8A8A8A;
  --text-light:    #4A4A4A;
  --highlight-bg:  #1A2535;
  --highlight-text:#A8CCDF;
  --radius-sm:     10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { height: 100%; }

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

/* ─── App Shell ─────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top:    env(safe-area-inset-top,    0px);
  padding-left:   env(safe-area-inset-left,   0px);
  padding-right:  env(safe-area-inset-right,  0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── State Visibility ──────────────────────── */

/* Header: hidden in loading and result (full-screen states) */
[data-state="loading"] .app-header,
[data-state="result"]  .app-header { display: none; }

/* Capture area: idle + listening only */
#capture-area { display: none; }
[data-state="idle"]      #capture-area,
[data-state="listening"] #capture-area { display: flex; }

/* Helper text: hide during active recording */
[data-state="listening"] .helper-text { display: none; }

/* Loading screen */
#loading-screen { display: none; }
[data-state="loading"] #loading-screen { display: flex; }

/* Result screen */
#result-screen { display: none; }
[data-state="result"]  #result-screen { display: flex; }

/* Generate button: only in idle with content */
#generate-btn { display: none; }
[data-state="idle"] #generate-btn.has-content { display: flex; }

/* Action bar: result only */
#action-bar { display: none; }
[data-state="result"] #action-bar { display: flex; }

/* ─── Header ───────────────────────────────── */

.app-header {
  padding: 40px 24px 0;
  flex-shrink: 0;
}

.app-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 400;
}

/* ─── Capture Area ──────────────────────────── */

#capture-area {
  flex: 1;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 24px;
}

.helper-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
  margin: 28px 0 36px;
  max-width: 300px;
}

/* ─── Microphone Button ─────────────────────── */

.mic-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.mic-btn {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s ease, transform 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}

.mic-btn:active { transform: scale(0.93); }

.mic-btn svg {
  width: 30px;
  height: 30px;
  pointer-events: none;
}

/* Pulse ring during recording */
[data-state="listening"] .mic-btn {
  background: var(--recording);
}

[data-state="listening"] .mic-btn::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid var(--recording);
  opacity: 0;
  animation: mic-pulse 1.5s ease-out infinite;
}

@keyframes mic-pulse {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.55); opacity: 0;   }
}

.mic-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.1px;
  text-align: center;
}

/* Hide mic in no-speech environments */
.no-speech .mic-wrapper { display: none; }

/* ─── Text Input ────────────────────────────── */

.input-group {
  width: 100%;
  max-width: 380px;
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}

.no-speech .input-label { color: var(--text-muted); }

#text-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.55;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 96px;
}

#text-input:focus {
  border-color: var(--primary);
}

#text-input::placeholder { color: var(--text-light); }

/* Live speech populates the textarea — show subtle indicator */
[data-state="listening"] #text-input {
  border-color: var(--recording);
  background: var(--surface);
  color: var(--text);
}

/* ─── Generate Button ───────────────────────── */

#generate-btn {
  width: 100%;
  max-width: 380px;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 18px 24px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: background 0.2s ease, transform 0.1s ease;
  margin-bottom: 8px;
}

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

/* ─── Error Message ─────────────────────────── */

#error-msg {
  display: none;
  width: 100%;
  max-width: 380px;
  text-align: center;
  font-size: 14px;
  color: var(--recording);
  line-height: 1.55;
  margin-top: 4px;
}

#error-msg.visible { display: block; }

/* ─── Loading Screen ────────────────────────── */

#loading-screen {
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 24px;
}

.loading-text {
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.3px;
  line-height: 1.4;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.25;
  animation: dot-fade 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-fade {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40%           { opacity: 1;    transform: scale(1);   }
}

/* ─── Result Screen ─────────────────────────── */

#result-screen {
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 148px; /* clear the taller action bar (two rows) */
}

/* One-line pitch hero */
.pitch-hero {
  padding: 32px 24px 24px;
  background: var(--highlight-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pitch-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 10px;
}

.pitch-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--highlight-text);
  letter-spacing: -0.5px;
  margin: 0;
}

/* Cards */
.result-cards {
  display: flex;
  flex-direction: column;
  background: var(--border);
  gap: 1px;
}

.result-card {
  background: var(--surface);
  padding: 20px 24px;
}

.result-card--highlight {
  background: var(--highlight-bg);
}

.card-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-card--highlight .card-label {
  color: var(--primary);
}

.card-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  margin: 0;
}

.result-card--highlight .card-body {
  font-size: 16px;
  font-weight: 600;
  color: var(--highlight-text);
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.card-list li {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  padding-left: 18px;
  position: relative;
}

.card-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-light);
}

/* ─── Action Bar ───────────────────────────── */

#action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  background: rgba(13, 13, 13, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.action-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn-secondary {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease;
}

.btn-secondary:active { transform: scale(0.96); }

.btn-primary {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, transform 0.1s ease;
}

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

/* ─── Fade-in animation ─────────────────────── */

.fade-in {
  animation: fadeIn 0.35s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ─── Brand Hero ────────────────────────────── */

.brand-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 24px;
  background: var(--brand-accent, var(--primary));
  flex-shrink: 0;
}

.brand-icon-img {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  flex-shrink: 0;
  display: block;
}

.brand-hero-text {
  min-width: 0;
}

.brand-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: #FFFFFF;
  margin: 0 0 4px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tagline {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  line-height: 1.5;
}

/* Brand identity card */
.result-card--brand {
  background: var(--highlight-bg, #EBF4F8);
}

.result-card--brand .card-label {
  color: var(--brand-accent, var(--primary));
}

/* ─── Home Screen Button ────────────────────── */

.btn-homescreen {
  width: 100%;
  background: transparent;
  color: var(--brand-accent, var(--primary));
  border: 1.5px solid var(--brand-accent, var(--border));
  border-radius: 50px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  letter-spacing: -0.1px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-homescreen:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.07);
}

/* ─── Home Screen Sheet ─────────────────────── */

.homescreen-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.25s ease;
}

.homescreen-sheet.open {
  background: rgba(0, 0, 0, 0.45);
  pointer-events: all;
}

.homescreen-inner {
  width: 100%;
  background: #222222;
  border-radius: 22px 22px 0 0;
  padding: 32px 28px;
  padding-bottom: max(32px, env(safe-area-inset-bottom, 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.homescreen-sheet.open .homescreen-inner {
  transform: translateY(0);
}

.homescreen-icon-img {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.homescreen-app-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.homescreen-step {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0;
}

.homescreen-step strong {
  color: var(--text);
  font-weight: 600;
}

.homescreen-inner .btn-secondary {
  width: 100%;
  margin-top: 4px;
}

/* ─── Reduced motion ────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
