/* =============================================
   ReadThisLease.com — Styles
   Design principles: clean, calm, trustworthy.
   One accent color. Color means something.
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =============================================
   Reset & Base
   ============================================= */

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

:root {
  --green:        #0f766e;
  --green-dark:   #0d6460;
  --green-light:  #f0fdf9;
  --green-border: #99d1cb;

  --bg:           #f8fafc;
  --card:         #ffffff;
  --border:       #e2e8f0;

  --text:         #0f172a;
  --text-mid:     #475569;
  --text-light:   #94a3b8;

  --red:          #dc2626;
  --red-bg:       #fef2f2;
  --red-border:   #fecaca;

  --amber:        #d97706;
  --amber-bg:     #fffbeb;
  --amber-border: #fde68a;

  --blue:         #2563eb;
  --blue-bg:      #eff6ff;
  --blue-border:  #bfdbfe;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* =============================================
   Header
   ============================================= */

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -0.4px;
}

.logo-dot-com {
  font-weight: 500;
  color: var(--text-light);
  font-size: 15px;
}

.logo-tagline {
  font-size: 13px;
  color: var(--text-light);
  padding-left: 16px;
  margin-left: 6px;
  border-left: 1px solid var(--border);
}

/* =============================================
   Main Layout
   ============================================= */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 40px 80px;
  gap: 0;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* =============================================
   Hero
   ============================================= */

.hero {
  text-align: center;
  max-width: 860px;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 50px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--green);
}

.hero-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  margin-top: 16px !important;
  letter-spacing: 0.01em;
}

.hero p {
  font-size: 18px;
  color: var(--text-mid);
  line-height: 1.7;
  max-width: 700px;
  margin: 0 auto;
}

/* =============================================
   Upload Section
   ============================================= */

.upload-section {
  width: 100%;
  max-width: 860px;
  margin-bottom: 72px;
}

.upload-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.06), 0 0 0 1px var(--border);
}

.upload-zone {
  border: 2px dashed var(--green-border);
  border-radius: 14px;
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--green-light);
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--green);
  background: #e6f7f5;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-icon {
  font-size: 44px;
  margin-bottom: 16px;
  display: block;
  line-height: 1;
}

.upload-zone h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.upload-zone-sub {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 24px;
}

/* Show different text on touch vs mouse devices */
.upload-touch-hint { display: none; }

@media (hover: none) {
  .upload-mouse-hint { display: none; }
  .upload-touch-hint { display: inline; }
}

.btn-upload {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 10px;
  pointer-events: none;
  transition: background 0.2s;
}

.upload-zone:hover .btn-upload {
  background: var(--green-dark);
}

.upload-privacy {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* =============================================
   Status (loading / error)
   ============================================= */

.status-area {
  margin-top: 16px;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
}

.status-loading {
  background: #f1f5f9;
  color: var(--text-mid);
}

.status-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* =============================================
   How It Works
   ============================================= */

.how-it-works {
  width: 100%;
  max-width: 860px;
  margin-bottom: 72px;
  text-align: center;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 32px;
}

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

.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: 14px;
}

.step h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.step p {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.5;
}

.step-connector {
  display: none;
}

/* =============================================
   Sample Preview
   ============================================= */

.sample-preview {
  width: 100%;
  max-width: 860px;
  margin-bottom: 40px;
}

.sample-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sample-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.sample-desc {
  font-size: 13px;
  color: var(--text-light);
}

.sample-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
}

/* =============================================
   Results Section
   ============================================= */

.results-section {
  width: 100%;
  margin-top: 48px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.results-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.btn-reset,
.btn-download {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-download {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 600;
}

.btn-download:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Download section — lives below the chat */
.download-section {
  width: 100%;
  max-width: 860px;
  margin-top: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.download-hint {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

.results-summary {
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: 12px;
  padding: 18px 22px;
  font-size: 15px;
  color: #0d5c56;
  line-height: 1.7;
  margin-bottom: 28px;
}

.red-flags-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 12px;
}

.no-flags {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.6;
}

.red-flags-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 900px) {
  .red-flags-list {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
}

/* =============================================
   Flag Cards (shared by results + sample)
   ============================================= */

.flag-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
}

.flag-card.flag-high   { border-left-color: var(--red);   background: var(--red-bg); }
.flag-card.flag-medium { border-left-color: var(--amber); background: var(--amber-bg); }
.flag-card.flag-low    { border-left-color: var(--blue);  background: var(--blue-bg); }

.flag-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.flag-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
}

.badge-high   { background: var(--red-border);   color: #991b1b; }
.badge-medium { background: var(--amber-border);  color: #92400e; }
.badge-low    { background: var(--blue-border);   color: #1d4ed8; }

.flag-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.flag-location {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  background: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.flag-explanation {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 12px;
}

.flag-quote {
  font-size: 13px;
  color: var(--text-light);
  border-left: 3px solid rgba(0,0,0,0.1);
  padding-left: 12px;
  margin: 0;
  font-style: italic;
  line-height: 1.5;
}

/* =============================================
   Lease Basics (collapsible, below red flags)
   ============================================= */

.basics-section {
  width: 100%;
  max-width: 860px;
  margin: 16px auto 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.basics-toggle {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  text-align: center;
  transition: background 0.15s;
}

.basics-chevron {
  position: absolute;
  right: 16px;
}

.basics-toggle:hover {
  background: var(--border);
}

.basics-chevron {
  color: var(--text-light);
  transition: transform 0.2s ease;
}

.basics-section.open .basics-chevron {
  transform: rotate(180deg);
}

.basics-content {
  display: none;
  border-top: 1px solid var(--border);
}

.basics-section.open .basics-content {
  display: block;
}

.basics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.basics-table td {
  padding: 8px 16px;
  line-height: 1.5;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.basics-table tr:last-child td {
  border-bottom: none;
}

.basics-table tr:nth-child(even) td {
  background: var(--surface);
}

.basics-label-cell {
  color: var(--text-light);
  font-weight: 600;
  width: 140px;
  white-space: nowrap;
}

.basics-value-cell {
  color: var(--text);
}

.basics-value-cell.not-specified {
  color: var(--amber);
  font-style: italic;
}

/* =============================================
   Chat Section
   ============================================= */

.chat-section {
  width: 100%;
  max-width: 860px;
  margin-top: 40px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}


.chat-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.chat-header p {
  font-size: 13px;
  color: var(--text-light);
}

.chat-messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 480px;
  overflow-y: auto;
}

.chat-bubble {
  display: flex;
  max-width: 88%;
}

.chat-bubble-user      { align-self: flex-end; }
.chat-bubble-assistant { align-self: flex-start; }

.bubble-body {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
}

.chat-bubble-user .bubble-body {
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble-assistant .bubble-body {
  background: #f1f5f9;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Markdown inside assistant bubbles */
.chat-bubble-assistant .bubble-body p      { margin-bottom: 10px; }
.chat-bubble-assistant .bubble-body p:last-child { margin-bottom: 0; }
.chat-bubble-assistant .bubble-body ul,
.chat-bubble-assistant .bubble-body ol     { padding-left: 20px; margin: 8px 0; }
.chat-bubble-assistant .bubble-body li     { margin-bottom: 5px; }
.chat-bubble-assistant .bubble-body strong { font-weight: 700; color: var(--text); }
.chat-bubble-assistant .bubble-body h1,
.chat-bubble-assistant .bubble-body h2,
.chat-bubble-assistant .bubble-body h3     { font-size: 14px; font-weight: 700; margin: 10px 0 4px; }

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s;
  background: var(--bg);
}

.chat-input:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
}

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

.chat-send-btn {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  height: 42px;
}

.chat-send-btn:hover    { background: var(--green-dark); }
.chat-send-btn:disabled { background: var(--text-light); cursor: not-allowed; }

/* =============================================
   Footer
   ============================================= */

footer {
  text-align: center;
  padding: 28px 20px;
  font-size: 13px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: auto;
  line-height: 1.6;
}

footer strong { color: var(--green); }

footer p { margin: 0; }
footer p + p { margin-top: 8px; }

/* =============================================
   Responsive — Mobile First
   ============================================= */

@media (max-width: 600px) {
  main {
    padding: 40px 16px 60px;
  }

  header {
    padding: 14px 20px;
  }

  .logo-tagline {
    display: none;
  }

  .hero h1 {
    font-size: 34px;
    letter-spacing: -0.8px;
  }

  .hero p {
    font-size: 16px;
  }

  .upload-card {
    padding: 24px 18px;
  }

  .upload-zone {
    padding: 36px 20px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .results-section,
  .chat-section {
    margin-top: 32px;
  }

  .flag-header {
    flex-wrap: wrap;
  }

  .flag-location {
    order: 3;
    width: 100%;
    background: transparent;
    padding: 0;
    margin-top: 2px;
  }

  .chat-messages {
    max-height: 360px;
  }
}
