/* ====== GLOBAL THEME ====== */

:root {
  /* Soft gradient theme - light and modern */
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --bg-soft-alt: #f1f5f9;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  --accent: #0ea5e9;
  --accent-2: #8b5cf6;
  --accent-dark: #0284c7;

  --danger: #ef4444;

  --shadow-main: 0 4px 16px rgba(14, 165, 233, 0.08);
  --shadow-soft: 0 2px 4px rgba(14, 165, 233, 0.06);

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

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

/* ====== PAGE LAYOUT ====== */

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    sans-serif;
  background: linear-gradient(135deg, #e0f2fe 0%, #f1f5f9 50%, #fae8ff 100%);
  color: var(--text-main);
}

/* Overall shell */
.app-shell {
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ====== HEADER ====== */

.app-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

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

.app-logo {
  height: 4.66rem;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-header h1 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-main);
}

.subtitle {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .header-content {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .app-logo {
    height: 3.33rem;
  }
  
  .app-header h1 {
    font-size: 1.8rem;
  }
}

/* ====== MAIN LAYOUT (FORM + RESULT) ====== */

.app-main {
  display: grid;
  gap: 18px;
}

@media (min-width: 960px) {
  .app-main {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr);
    align-items: stretch;
  }
}

.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-main);
  position: relative;
}

/* Card headings */
.card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-main);
}

/* ====== FORM GRID ====== */

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 20px;
  margin-top: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

/* keep both columns aligned for desktop */
@media (max-width: 840px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ====== LABELS & INPUTS ====== */

label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

/* Inputs */

input,
select,
textarea {
  width: 100%;
  font-size: 0.95rem;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--bg-soft-alt);
  color: var(--text-main);
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    transform 0.08s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.5);
  background: rgba(14, 23, 43, 0.9);
  transform: translateY(-0.5px);
}

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

/* ====== CHECKBOX ROW ====== */

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.checkbox-row label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}

.checkbox-row input {
  margin-right: 6px;
}

/* ====== BUTTONS ====== */

.submit-row {
  margin-top: 10px;
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
}

.primary-button,
.secondary-button {
  border-radius: var(--radius-pill);
  border: none;
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease,
    opacity 0.12s ease;
}

/* main CTA */
.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: var(--shadow-main);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--accent-dark), #a855f7);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15);
}

.primary-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* secondary / copy button */
.secondary-button {
  background: var(--bg-soft);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}

.secondary-button:hover {
  background: var(--bg-soft-alt);
  color: var(--text-main);
}

/* Disabled-state styling for buttons */
.secondary-button[disabled],
.primary-button[disabled],
button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ====== RESULT CARD ====== */

.result-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

/* Header for the Startup Plan card */
.result-card .result-header {
  display: flex;
  flex-direction: column;     /* title on first line, buttons on second */
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 10px;
}

/* Make Startup Plan heading match STARTUP INPUTS heading */
.result-card .result-header h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-main);
}

/* Row of action buttons under the title */
.result-card .result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-card .result-actions .secondary-button {
  font-size: 0.86rem;
  padding: 7px 14px;
}
/* Scrollable markdown area */

/* Scrollable markdown area – visible card style for the plan */
.plan-output {
  margin-top: 16px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.6);    /* light subtle background */
  border: 1px solid rgba(148, 163, 184, 0.25);  /* soft border */
  border-radius: 14px;

  font-size: 0.94rem;
  line-height: 1.6;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

/* Basic markdown styling */

.plan-output h2,
.plan-output h3,
.plan-output h4 {
  margin-top: 1.1em;
  margin-bottom: 0.3em;
  color: var(--text-main);
}

.plan-output h2 {
  font-size: 1.02rem;
  text-transform: none;
  letter-spacing: 0.04em;
}

.plan-output h3 {
  font-size: 0.98rem;
}

.plan-output p {
  margin: 0.25em 0;
  color: var(--text-muted);
}

.plan-output ul,
.plan-output ol {
  padding-left: 1.3em;
  margin: 0.25em 0;
}

.plan-output li + li {
  margin-top: 0.1em;
}

.plan-output code {
  background: #0c1426;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.85em;
}

/* Placeholder text when plan is empty */
.placeholder {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ====== SPINNER ====== */

.spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.spinner-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(188, 205, 229, 0.6);
  border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none;
}

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

/* ====== MOBILE TWEAKS ====== */

@media (max-width: 600px) {
  .app-shell {
    padding: 18px 12px 28px;
  }

  .card {
    padding: 18px 16px 16px;
  }

  .submit-row {
    justify-content: stretch;
  }

  .submit-row button {
    width: 100%;
  }
}
/* ====== PRINT STYLES FOR PDF ====== */

@media print {
  /* Force white background and black text for readability */
  * {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  body {
    margin: 0;
    padding: 0;
  }

  .app-shell {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.5in 0.4in;
  }

  /* Hide header and the input form card */
  .app-header,
  .card:first-of-type,
  .primary-button,
  .secondary-button,
  #spinner,
  #errorMessage {
    display: none !important;
  }

  .app-main {
    display: block;
  }

  /* Show only the result card, full width, no chrome */
  .result-card {
    display: block !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .plan-output {
    max-height: none;
    overflow: visible;
  }

  /* Show our dynamic print title */
  .print-title {
    display: block !important;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
}

/* On screen, hide the print title element (content is implied already) */
.print-title {
  display: none;
}

/* ---------------------------------------------------
   Typography Helpers
--------------------------------------------------- */

.hint {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 4px;
}
.small-muted {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 2px;
  line-height: 1.3;

}
/* Light input fields, selects, and textareas with soft backgrounds */
input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
  background-color: var(--bg-soft-alt) !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  color: var(--text-main) !important;
  padding: 10px;
  border-radius: 6px;
}

/* Softer placeholder */
input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
}

/* Focus state for clean modern highlight */
input:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.3);
}
/* Bigger, more tappable Preferred Sales Channel buttons */
#salesChannelsGroup label,
#salesChannelsGroup button,
#salesChannelsGroup .chip {
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  border-radius: 999px;
  cursor: pointer;
  min-width: 140px;
  display: inline-block;
  text-align: center;
  margin: 0.35rem;
  border: 1px solid rgba(255,255,255,0.25); /* soft border */
}

/* When selected */
#salesChannelsGroup input[type="checkbox"]:checked + label,
#salesChannelsGroup input[type="radio"]:checked + label {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}
/* Make the actual checkbox box bigger */
#salesChannelsGroup input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 18px;
  height: 18px;
  transform: scale(1.25);
  transform-origin: left center;
}

/* ====== CLARIFICATION MODAL ====== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 24, 44, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: rgba(25, 32, 54, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-main);
}

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--accent);
}

.modal-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.5rem;
}

.clarification-question {
  margin-bottom: 1.5rem;
}

.clarification-question:last-child {
  margin-bottom: 0;
}

.clarification-question label {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.clarification-question textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-soft-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.clarification-question textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border-subtle);
}

.modal-footer button {
  padding: 0.75rem 1.5rem;
}

/* ====== AUTHENTICATION UI ====== */

.auth-section {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-section button {
  padding: 8px 18px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
}

.auth-modal-content {
  max-width: 450px;
}

.auth-modal-logo {
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem 1rem;
}

.auth-modal-logo img {
  height: 4rem;
  width: auto;
  object-fit: contain;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-switch {
  text-align: center;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.error-message {
  padding: 0.75rem;
  background: rgba(249, 115, 115, 0.1);
  border: 1px solid rgba(249, 115, 115, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.9rem;
}

.full-width {
  width: 100%;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--bg-soft-alt);
  color: var(--text-main);
}

@media (max-width: 640px) {
  .auth-section {
    margin-left: 0;
    margin-top: 12px;
    width: 100%;
    justify-content: center;
  }
  
  .header-content {
    flex-wrap: wrap;
  }
}

/* ====== SAVE PROMPT BANNER ====== */

.save-prompt-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(14, 165, 233, 0.15));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.save-prompt-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
}

.save-prompt-text {
  flex: 1;
}

.save-prompt-text strong {
  display: block;
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.save-prompt-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.save-prompt-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.save-prompt-actions button {
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .save-prompt-content {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .save-prompt-actions {
    justify-content: stretch;
  }
  
  .save-prompt-actions button {
    flex: 1;
  }
}
