/* Ideal Buyer Profile and Marketing Plan */

.main-buyer-profile {
  max-width: min(1600px, 100%);
}

/* Form + preview side by side when wide enough */
.main-buyer-profile .profile-layout {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .main-buyer-profile .profile-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .main-buyer-profile .profile-form-section,
  .main-buyer-profile .profile-view-section {
    min-width: 0;
  }
}

@media (min-width: 1280px) {
  .main-buyer-profile .profile-layout {
    grid-template-columns: minmax(0, 52%) minmax(0, 1fr);
    gap: 1.75rem;
  }
}

@media (min-width: 1100px) {
  .main-buyer-profile .profile-view-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 2rem;
    align-items: start;
  }

  .main-buyer-profile .profile-view-content > h3,
  .main-buyer-profile .profile-view-content > .buyer-preview-address {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1400px) {
  .main-buyer-profile .profile-view-content {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main-buyer-profile .profile-view-content > h3,
  .main-buyer-profile .profile-view-content > .buyer-preview-address {
    grid-column: 1 / -1;
  }
}

.main-buyer-profile .profile-view {
  padding: 1rem 1.25rem;
  min-height: 8rem;
}

.main-buyer-profile .profile-view-content {
  font-size: 0.9rem;
  line-height: 1.5;
}

.main-buyer-profile .profile-view-content .profile-block {
  margin-bottom: 0.85rem;
}

.main-buyer-profile .profile-view-content h4 {
  margin-top: 0.75rem;
}

/* Marketing plan: editor left, wide preview right */
.main-buyer-profile .marketing-plan-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .main-buyer-profile .marketing-plan-layout {
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  }
}

.main-buyer-profile .marketing-plan-preview-label {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ev-gray);
}

.main-buyer-profile .marketing-plan-preview-panel {
  min-width: 0;
}

.main-buyer-profile .marketing-plan-preview-panel .profile-view {
  margin-top: 0;
}

@media (min-width: 1100px) {
  .main-buyer-profile #marketingPlanPreviewContent {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 2rem;
    align-items: start;
  }
}

@media (min-width: 1400px) {
  .main-buyer-profile #marketingPlanPreviewContent {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* In-progress feedback while AI generates */
.main-buyer-profile .form-feedback.is-progress {
  color: var(--ev-charcoal);
  font-weight: 500;
  margin: 0.5rem 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #fff9f0;
  border: 1px solid #e8dcc8;
  border-radius: 8px;
}

.main-buyer-profile .workspace-customer-bar {
  margin-bottom: 1.5rem;
}

.main-buyer-profile #listingProfileSelect {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
  box-sizing: border-box;
}

.profile-form-actions-generate {
  flex-wrap: wrap;
  gap: 0.65rem;
}

.home-specs-preview {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--ev-light);
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.55;
}

.home-specs-preview h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ev-gray);
}

.home-specs-preview p {
  margin: 0.25rem 0;
}

.home-specs-empty {
  color: var(--ev-gray);
  font-style: italic;
  margin: 0;
}

.manual-specs-details {
  margin: 0 0 1.25rem;
  border: 1px solid var(--ev-border-subtle);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.manual-specs-details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ev-charcoal);
}

.manual-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.manual-specs-grid .field-span {
  grid-column: 1 / -1;
}

.manual-specs-grid .field {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Manual specs use same control sizing as agent-layout (avoid duplicate smaller padding) */
.manual-specs-grid .field {
  min-width: 0;
}

.buyer-fields-section-label {
  margin: 1.25rem 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ev-gray);
}

.buyer-fields-section-label:first-child {
  margin-top: 0;
}

.buyer-profile-fields {
  margin-top: 1.25rem;
  border-top: 1px solid var(--ev-border-subtle);
  padding-top: 1.25rem;
}

.buyer-profile-fields .field {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.buyer-profile-fields input,
.buyer-profile-fields textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ev-border);
  border-radius: 6px;
  font-size: 1rem;
  box-sizing: border-box;
}

.buyer-profile-fields textarea {
  resize: vertical;
  min-height: 60px;
}

.buyer-saved-list {
  margin-bottom: 2rem;
}

.buyer-saved-list h2 {
  font-size: 1.35rem;
  margin: 0 0 1rem;
}

.customer-table .summary-preview {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  color: var(--ev-gray);
}

@media (max-width: 768px) {
  .manual-specs-grid {
    grid-template-columns: 1fr;
  }

  .main-buyer-profile {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .main-buyer-profile .page-title {
    font-size: 28px;
    margin-top: 20px;
  }

  .buyer-saved-list .customer-table-wrap {
    border-top: 1px solid #E8E4DF;
    margin: 0 -1rem;
  }

  .profile-form-section.card,
  .buyer-saved-list.card {
    border-radius: 12px;
    border: 1px solid #E8E4DF;
    box-shadow: 0 2px 12px rgba(26, 22, 20, 0.08);
  }

  .btn-marketing-plan {
    max-width: none;
    min-height: 52px;
    border-radius: 6px;
    background: #8B1A2B;
    color: #fff;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .marketing-plan-section h2 {
    font-size: 18px;
  }

  .profile-view-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .profile-view-actions::-webkit-scrollbar {
    display: none;
  }

  .profile-view-actions .btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    border-radius: 999px;
    padding: 0 1.25rem;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

.marketing-plan-cta {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ev-border-subtle);
}

.btn-marketing-plan {
  width: 100%;
  max-width: 360px;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
}

.marketing-plan-hint {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  color: var(--ev-gray);
  line-height: 1.45;
}

.marketing-plan-section {
  margin-bottom: 2rem;
}

.marketing-plan-section h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.marketing-plan-fields {
  margin-bottom: 1rem;
}

#marketingPlanPreview {
  margin-top: 1rem;
}

@media print {
  .buyer-saved-list,
  .manual-specs-details,
  .profile-form-actions,
  .marketing-plan-cta,
  .top-nav,
  .profile-view-actions,
  .marketing-plan-fields {
    display: none !important;
  }

  .marketing-plan-section {
    display: block !important;
  }

  .main-buyer-profile .profile-layout,
  .main-buyer-profile .marketing-plan-layout {
    grid-template-columns: 1fr;
  }

  .main-buyer-profile .profile-view-content,
  .main-buyer-profile #marketingPlanPreviewContent {
    display: block;
  }
}
