/* Website Design Blueprint - Notion-like UI */

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

:root {
  --font-sans: "Inter", sans-serif;
  --text-color: rgb(25, 25, 24);
  --bg-color: #fafafa;
  --border-color: rgba(55, 53, 47, 0.12);
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
}

body {
  font-family: var(--font-sans);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-32) var(--space-24);
}

/* ========== APP HEADER ========== */
.app-header {
  text-align: center;
  margin-bottom: var(--space-24);
  padding: var(--space-16) var(--space-24);
  margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-color);
  margin: 0;
  padding-bottom: var(--space-16);
}

.app-header__title::after {
  content: "";
  display: block;
  width: 40%;
  height: 1px;
  background: var(--border-color);
  margin: var(--space-16) auto 0;
}

/* Mobile */
@media (max-width: 768px) {
  .container {
    padding: var(--space-24) var(--space-16);
  }

  .app-header {
    padding: 12px var(--space-16);
    margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-24);
  }

  .app-header__title {
    font-size: 28px;
  }
}

/* Input Section */
.input-section {
  margin-bottom: 32px;
}

.input-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.input-wrapper {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.6);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 280px;
  padding: 16px;
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: rgb(25, 25, 24);
  background: rgba(55, 53, 47, 0.04);
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background 0.2s ease;
}

textarea:focus {
  border-color: #2383e2;
  background: white;
}

textarea::placeholder {
  color: rgba(25, 25, 24, 0.4);
}

/* Button Row */
.button-row {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 50px;
  background: #000000;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: #1a1a1a;
}

.btn-primary:active:not(:disabled) {
  background: #333333;
}

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

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.hint {
  margin-top: 14px;
  font-size: 14px;
  color: rgba(25, 25, 24, 0.6);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 64px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-top: 24px;
}

.spinner-container {
  margin-bottom: 24px;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 3px solid rgba(35, 131, 226, 0.2);
  border-top-color: #2383e2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.loading-subtext {
  font-size: 14px;
  color: rgba(25, 25, 24, 0.5);
}

/* Error State */
.error-state {
  text-align: center;
  padding: 32px 24px;
  background: #fef2f2;
  border: 0.5px solid #fecaca;
  border-radius: 12px;
  margin-top: 24px;
}

.error-icon {
  color: #dc2626;
  margin-bottom: 12px;
}

.error-icon svg {
  width: 40px;
  height: 40px;
}

.error-text {
  font-size: 16px;
  color: #991b1b;
  margin-bottom: 16px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  color: #2383e2;
  background: white;
  border: 0.5px solid #2383e2;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(35, 131, 226, 0.08);
}

/* Result Section */
.result-section {
  animation: fadeInUp 0.4s ease;
}

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

.result-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 0.5px solid rgba(55, 53, 47, 0.08);
}

.card-header.collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s ease;
}

.card-header.collapsible:hover {
  background: rgba(55, 53, 47, 0.04);
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: rgb(25, 25, 24);
}

.card-header .chevron {
  width: 20px;
  height: 20px;
  color: rgba(25, 25, 24, 0.4);
  transition: transform 0.2s ease;
}

.card-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.card-body {
  padding: 20px 24px;
}

.card-body.collapsed {
  display: none;
}

/* Summary Card */
.summary-card .card-header {
  background: linear-gradient(135deg, #2383e2 0%, #1b6dc1 100%);
  border: none;
}

.summary-card .card-header h2 {
  color: white;
}

.blueprint-content {
  font-size: 15px;
  line-height: 1.6;
  color: rgb(25, 25, 24);
  white-space: pre-wrap;
}

/* Pages List */
.pages-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.pages-list li {
  padding: 12px 16px;
  background: rgba(35, 131, 226, 0.08);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #2383e2;
}

.pages-list li.empty {
  grid-column: 1 / -1;
  background: rgba(55, 53, 47, 0.04);
  color: rgba(25, 25, 24, 0.5);
  font-weight: 400;
}

/* Page Components */
.page-components {
  margin-bottom: 24px;
}

.page-components:last-child {
  margin-bottom: 0;
}

.page-components h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgb(25, 25, 24);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(55, 53, 47, 0.08);
}

.page-components ul {
  list-style: none;
  padding-left: 0;
}

.page-components li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: rgb(25, 25, 24);
}

.page-components li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2383e2;
  font-weight: bold;
}

.page-components .empty {
  color: rgba(25, 25, 24, 0.5);
  font-style: italic;
}

/* Blueprint Text */
.blueprint-text {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgb(25, 25, 24);
  background: rgba(55, 53, 47, 0.04);
  padding: 20px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 600px;
  overflow-y: auto;
}

.copy-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.8);
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(55, 53, 47, 0.08);
  border-color: rgba(55, 53, 47, 0.24);
}

.btn-secondary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary.primary {
  background: #2383e2;
  border-color: #2383e2;
  color: white;
}

.btn-secondary.primary:hover {
  background: #1b6dc1;
  border-color: #1b6dc1;
}

/* Result Actions */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* Responsive Styles */
@media (max-width: 768px) {
  body {
    padding: 24px 16px;
  }

  .input-card {
    padding: 24px;
  }

  textarea {
    min-height: 200px;
    font-size: 16px;
  }

  .pages-list {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .card-header {
    padding: 16px 20px;
  }

  .card-body {
    padding: 16px 20px;
  }
}
