/* ===========================================
   Free Family Tree Builder Tool
   Public SEO landing page with interactive tool
   =========================================== */

/* Page Container */
.free-tree-page {
  --font-display: 'Lora', Georgia, serif;
  --tool-cream: #FFFBF7;
  --tool-warm-gray: #F5F0EB;
  --tool-peach: #FFF5EB;
  min-height: 100vh;
}

/* ===========================================
   Hero Section
   =========================================== */
.free-tree-page .tool-hero {
  background: linear-gradient(160deg, #FFFCFA 0%, #FFF8F2 100%);
  text-align: center;
  padding: 80px 24px 60px;
}

.free-tree-page .tool-hero-inner {
  max-width: 700px;
  margin: 0 auto;
}

.free-tree-page .tool-hero-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.free-tree-page .tool-hero-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 42px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 20px;
}

.free-tree-page .tool-hero-subtitle {
  font-size: 19px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
}

/* ===========================================
   Main Tool Section
   =========================================== */
.free-tree-page .tool-main {
  background: var(--tool-warm-gray);
  padding: 60px 24px 80px;
}

.free-tree-page .tool-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .free-tree-page .tool-container {
    grid-template-columns: 1fr;
  }
}

/* ===========================================
   Sidebar
   =========================================== */
.tree-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
}

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

.sidebar-card-header .mdi {
  font-size: 22px;
  color: var(--primary);
}

.sidebar-card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* Start Form */
.start-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.start-form .form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.start-form .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(219, 104, 14, 0.1);
}

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

.btn-start-tree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-start-tree:hover {
  background: var(--primary-dark);
}

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

.btn-start-tree .mdi {
  font-size: 20px;
}

/* Member List */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.member-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.member-list-item:hover {
  background: var(--primary-soft);
}

.member-list-item.selected {
  background: var(--primary-soft);
  border: 2px solid var(--primary);
}

.member-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.member-list-info {
  flex: 1;
  min-width: 0;
}

.member-list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-list-relation {
  font-size: 12px;
  color: var(--text-secondary);
}

.member-list-actions {
  display: flex;
  gap: 4px;
}

.btn-member-action {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-member-action:hover {
  background: var(--border);
  color: var(--text);
}

.btn-member-action.delete:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.btn-member-action .mdi {
  font-size: 16px;
}

/* Add Member Button */
.btn-add-member {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: white;
  color: var(--primary);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
}

.btn-add-member:hover {
  background: var(--primary-soft);
}

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

.btn-add-member .mdi {
  font-size: 20px;
}

/* Start Over Button */
.btn-start-over {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-start-over:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.btn-start-over .mdi {
  font-size: 16px;
}

/* Empty State */
.member-list-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-secondary);
}

.member-list-empty .mdi {
  font-size: 40px;
  color: var(--text-light);
  margin-bottom: 8px;
  display: block;
}

.member-list-empty p {
  font-size: 14px;
  margin: 0;
}

/* ===========================================
   Main Tree Area
   =========================================== */
.tree-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tree-canvas-container {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  min-height: 500px;
}

.free-tree-canvas {
  width: 100%;
  height: 500px;
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

/* Tree Controls */
.free-tree-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

/* Tree Empty State */
.tree-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  padding: 40px;
  text-align: center;
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.tree-empty-state .mdi {
  font-size: 80px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.tree-empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.tree-empty-state p {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 300px;
}

/* ===========================================
   CTA Section
   =========================================== */
.tree-cta-section {
  background: white;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.tree-cta-section .mdi {
  font-size: 28px;
  color: var(--primary);
}

.tree-cta-text {
  flex: 1;
}

.tree-cta-text p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.tree-cta-text strong {
  color: var(--text);
}

.tree-btn-cta {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.tree-btn-cta:hover {
  background: var(--primary-dark);
  color: white;
}

/* ===========================================
   Confirm Modal
   =========================================== */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-modal.show {
  display: flex;
}

.confirm-modal-content {
  text-align: center;
  max-width: 360px;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  background: #FEE2E2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.confirm-icon .mdi {
  font-size: 32px;
  color: #DC2626;
}

.confirm-modal-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.confirm-modal-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.btn-confirm-cancel {
  flex: 1;
  padding: 14px 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-confirm-cancel:hover {
  background: var(--border);
}

.btn-confirm-delete {
  flex: 1;
  padding: 14px 20px;
  background: #DC2626;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-confirm-delete:hover {
  background: #B91C1C;
}

/* ===========================================
   Add Member Modal
   =========================================== */
.add-member-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.add-member-modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  z-index: 1001;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--surface);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background: var(--border);
}

.modal-close .mdi {
  font-size: 20px;
  color: var(--text-secondary);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(219, 104, 14, 0.1);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.btn-add-member-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 8px;
}

.btn-add-member-submit:hover {
  background: var(--primary-dark);
}

.btn-add-member-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===========================================
   How It Works Section
   =========================================== */
.free-tree-page .tool-how-it-works {
  background: white;
  padding: 80px 24px;
}

.free-tree-page .tool-how-it-works-inner {
  max-width: 800px;
  margin: 0 auto;
}

.free-tree-page .tool-section-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 48px;
}

.how-to-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.how-to-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.step-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ===========================================
   FAQ Section
   =========================================== */
.free-tree-page .tool-faq {
  background: var(--tool-cream);
  padding: 80px 24px;
}

.free-tree-page .tool-faq-inner {
  max-width: 800px;
  margin: 0 auto;
}

.free-tree-page .faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.free-tree-page .faq-item {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.free-tree-page .faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.2s ease;
}

.free-tree-page .faq-question:hover {
  background: rgba(0, 0, 0, 0.02);
}

.free-tree-page .faq-question .mdi {
  font-size: 24px;
  color: var(--primary);
  transition: transform 0.3s ease;
}

.free-tree-page .faq-item.active .faq-question .mdi {
  transform: rotate(180deg);
}

.free-tree-page .faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.free-tree-page .faq-item.active .faq-answer {
  max-height: 300px;
}

.free-tree-page .faq-answer-content {
  padding: 0 24px 24px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===========================================
   Final CTA Section
   =========================================== */
.free-tree-page .tool-cta {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--tool-peach) 50%, var(--tool-cream) 100%);
  padding: 80px 24px;
  text-align: center;
}

.free-tree-page .tool-cta-inner {
  max-width: 600px;
  margin: 0 auto;
}

.free-tree-page .tool-cta-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.2;
}

.free-tree-page .tool-cta-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.free-tree-page .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.free-tree-page .btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.free-tree-page .btn-large {
  padding: 18px 40px;
  font-size: 17px;
  border-radius: 30px;
}

.free-tree-page .tool-cta-note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
  .free-tree-page .tool-hero {
    padding: 60px 20px 40px;
  }

  .free-tree-page .tool-hero-title {
    font-size: 32px;
  }

  .free-tree-page .tool-hero-subtitle {
    font-size: 17px;
  }

  .free-tree-page .tool-main {
    padding: 40px 20px 60px;
  }

  .free-tree-canvas {
    height: 400px;
  }

  .tree-cta-section {
    flex-direction: column;
    text-align: center;
  }

  .free-tree-page .tool-how-it-works {
    padding: 60px 20px;
  }

  .free-tree-page .tool-section-title {
    font-size: 26px;
    margin-bottom: 32px;
  }

  .free-tree-page .tool-faq {
    padding: 60px 20px;
  }

  .free-tree-page .tool-cta {
    padding: 60px 20px;
  }

  .free-tree-page .tool-cta-title {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .free-tree-page .tool-hero {
    padding: 48px 16px 32px;
  }

  .free-tree-page .tool-hero-title {
    font-size: 28px;
  }

  .free-tree-canvas {
    height: 350px;
  }
}
