/* Book Explorer - 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-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --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;
}

/* 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: 24px;
}

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

textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-family: "Inter", sans-serif;
  line-height: 1.55;
  color: rgb(25, 25, 24);
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: #2383E2;
}

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

.button-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

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

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

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

.btn-primary:disabled {
  background: rgba(55, 53, 47, 0.2);
  color: rgba(25, 25, 24, 0.4);
  cursor: not-allowed;
}

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

.btn-outline {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  color: rgb(25, 25, 24);
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
}

.btn-outline:hover {
  background: rgba(55, 53, 47, 0.04);
  border-color: rgba(55, 53, 47, 0.3);
}

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

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

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

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

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

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

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 3px solid rgba(35, 131, 226, 0.1);
  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;
  color: rgb(25, 25, 24);
  margin-bottom: 8px;
}

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

/* Error State */
.error-state {
  text-align: center;
  padding: 48px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: #e74c3c;
}

.error-icon svg {
  width: 100%;
  height: 100%;
}

.error-text {
  font-size: 16px;
  color: rgb(25, 25, 24);
  margin-bottom: 24px;
}

/* Results Section */
.result-section {
  margin-top: 32px;
}

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

.summary-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.card-header {
  padding: 24px 32px;
  border-bottom: 0.5px solid rgba(55, 53, 47, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header.collapsible {
  cursor: pointer;
  transition: background 0.2s ease;
}

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

.card-header h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  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: 32px;
}

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

.anchor-text {
  font-size: 18px;
  line-height: 1.55;
  color: rgba(25, 25, 24, 0.9);
  margin: 0;
}

/* Book List */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.book-item {
  padding: 20px;
  background: rgba(55, 53, 47, 0.02);
  border-radius: 8px;
  border-left: 3px solid #2383E2;
}

.book-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: rgb(25, 25, 24);
  margin-bottom: 4px;
}

.book-author {
  font-size: 16px;
  color: rgba(25, 25, 24, 0.6);
  margin-bottom: 12px;
}

.book-explanation {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(25, 25, 24, 0.9);
}

/* Timeless vs Timely Grid */
.timeless-timely-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.timeless-column h3,
.timely-column h3 {
  font-size: 20px;
  font-weight: 600;
  color: rgb(25, 25, 24);
  margin-bottom: 16px;
}

/* Skill vs Perspective Grid */
.skill-perspective-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.skill-column h3,
.perspective-column h3 {
  font-size: 20px;
  font-weight: 600;
  color: rgb(25, 25, 24);
  margin-bottom: 16px;
}

/* Before You Read */
.book-item.prerequisite {
  border-left-color: #f59e0b;
}

.prerequisite-label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

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

.result-actions .btn-secondary.primary {
  background: #2383E2;
  color: white;
  border-color: #2383E2;
}

.result-actions .btn-secondary.primary:hover {
  background: #1B6DC1;
  border-color: #1B6DC1;
}

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

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

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

  .input-card {
    padding: 24px;
  }

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

  .card-body {
    padding: 24px;
  }

  .timeless-timely-grid,
  .skill-perspective-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}