/* Print Styles for PropertyProfitFinder Dashboard
 * Used with window.print() to generate PDF via browser's Save as PDF
 * Created: 2026-02-22
 */

/* ============================================
   AGENT BRANDING (hidden by default, for future use)
   ============================================ */
.agent-branding-print {
  display: none;
}

/* ============================================
   PRINT HEADER & FOOTER
   ============================================ */
.print-header,
.print-footer {
  display: none;
}

/* ============================================
   SCREEN-ONLY: hide print elements on screen
   ============================================ */
@media screen {
  .print-only {
    display: none !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  /* --- Page Setup --- */
  @page {
    size: letter;
    margin: 0.6in 0.5in 1in 0.5in;
  }

  /* --- Reset & Base --- */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    background: white !important;
    overflow: visible !important;
  }

  /* --- Show print-only elements --- */
  .print-only {
    display: block !important;
  }

  /* --- Print Header --- */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid #1e40af;
    margin-bottom: 16px;
  }

  .print-header-brand {
    font-size: 16px;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: 1px;
  }

  .print-header-date {
    font-size: 10px;
    color: #6b7280;
  }

  /* --- Print Footer --- */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 0.5in 4px 0.5in;
    border-top: 1px solid #e5e7eb;
    font-size: 7px;
    line-height: 1.3 !important;
    color: #9ca3af;
    text-align: center;
    background: white;
    overflow: visible !important;
  }

  .print-footer-disclaimer {
    margin-bottom: 2px;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    max-width: 100% !important;
  }

  /* --- Agent Branding (hidden by default in print - placeholder data) --- */
  .agent-branding-print {
    display: none !important;
  }

  .agent-branding-print .agent-name {
    font-weight: 700;
    font-size: 12px;
  }

  .agent-branding-print .agent-details {
    color: #6b7280;
  }

  /* ============================================
     HIDE ELEMENTS
     ============================================ */

  /* Sidebar navigation - ALL sidebar elements */
  .ultimate-sidebar,
  .ultimate-sidebar-light,
  [class*="ultimate-sidebar"],
  aside,
  nav,
  .sidebar,
  .side-nav,
  .dashboard-sidebar,
  .sidebar-card,
  .sidebar-sticky,
  .sidebar-nav,
  .sidebar-nav-light,
  .sidebar-header-light {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
  }

  /* Mobile sidebar bar */
  .mobile-sidebar-bar {
    display: none !important;
  }

  /* Mobile nav elements */
  .mobile-nav-toggle,
  .mobile-nav-menu,
  .mobile-nav-backdrop {
    display: none !important;
  }

  /* Sidebar overlay */
  .sidebar-mobile-overlay {
    display: none !important;
  }

  /* Back to top button */
  .back-to-top,
  [class*="back-to-top"],
  button[aria-label="Back to top"] {
    display: none !important;
  }

  /* Sidebar action buttons (Generate PDF, Share, Print) */
  .sidebar-actions-section,
  .sidebar-button-group,
  .sidebar-btn,
  .sidebar-actions {
    display: none !important;
  }

  /* Hide entire Scenario Modeler section from PDF report */
  .scenario-modeler-section,
  .scenario-modeler-section * {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* Hide the dashboard-section that wraps the scenario modeler */
  .dashboard-section:has(.scenario-modeler-section) {
    display: none !important;
  }

  /* Hide spinbutton arrows */
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    display: none !important;
  }

  /* Hide expand/collapse toggle buttons in scenario modeler */
  .scenario-modeler-section button[style*="cursor: pointer"] {
    display: none !important;
  }

  /* View listing buttons (external links) */
  .view-listing-btn {
    display: none !important;
  }

  /* Share modal */
  div[style*="position: fixed"][style*="z-index: 99999"] {
    display: none !important;
  }

  /* Loading overlays */
  div[style*="position: fixed"][style*="z-index: 9999"] {
    display: none !important;
  }

  /* Hamburger menu */
  .hamburger-btn {
    display: none !important;
  }

  /* ============================================
     LAYOUT ADJUSTMENTS
     ============================================ */

  /* Remove sidebar margin on content - FULL WIDTH */
  .ultimate-content-light,
  .ultimate-content-light.sidebar-collapsed {
    margin-left: 0 !important;
    padding: 0 !important;
    padding-bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Main container - full width centered */
  main,
  .ultimate-dashboard,
  .ultimate-dashboard-light,
  .ppf-behance-dark,
  .main-content,
  .content-area {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    display: block !important;
  }

  /* Override the flex layout that creates sidebar + content */
  .ultimate-dashboard-light {
    display: block !important;
  }

  /* ============================================
     SECTION VISIBILITY - Expand all collapsed
     ============================================ */

  /* Hide collapsible toggle buttons/icons - but KEEP section headers visible */
  .collapse-toggle,
  .collapse-icon,
  .expand-collapse-all-container {
    display: none !important;
  }

  /* Style section headers for print - remove interactive styling */
  .section-header-collapsible {
    cursor: default !important;
    pointer-events: none !important;
  }

  /* Force all collapsible sections open and visible */
  .dashboard-section,
  .dashboard-section.collapsed {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin-bottom: 8px !important;
    padding: 4px 0 !important;
  }

  /* Force collapsible content wrappers visible */
  .section-content-collapsible,
  .collapsible-content,
  [class*="collapsible"] > div,
  .expand-content {
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Force inline style overrides for max-height: 0 */
  div[style*="max-height: 0"],
  div[style*="maxHeight: 0"],
  div[style*="max-height:0"],
  div[style*="max-height: 0px"],
  div[style*="maxHeight: 0px"],
  div[style*="overflow: hidden"],
  .dashboard-section.collapsed .section-content-collapsible {
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    height: auto !important;
    display: block !important;
    visibility: visible !important;
  }

  /* ============================================
     CONTENT FORMATTING
     ============================================ */

  /* Property hero image */
  .property-overview-hero {
    page-break-after: avoid;
    margin-bottom: 12px !important;
  }

  .property-hero-image-container {
    max-height: 200px !important;
    overflow: hidden;
  }

  .property-hero-image {
    max-height: 200px !important;
    object-fit: cover;
  }

  /* Section headers */
  .section-header,
  .analysis-card-header {
    page-break-after: avoid;
  }

  /* Hide duplicate inner section headers (the collapsible header already shows the title) */
  .section-content-collapsible > .section-header:first-child,
  .section-content-collapsible > div > .section-header:first-child {
    display: none !important;
  }

  /* Cards & sections - avoid splitting */
  .analysis-card,
  .executive-summary-section,
  .market-data-section,
  .scenario-modeler-section,
  .ai-insights-section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 12px !important;
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
  }

  /* Comparables grid */
  .comparables-grid {
    page-break-inside: auto;
  }

  .comparable-card {
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
  }

  /* Metrics grid */
  .metrics-grid {
    page-break-inside: avoid;
  }

  .metric-item {
    page-break-inside: avoid;
  }

  /* Analysis grid */
  .analysis-grid-container {
    page-break-inside: auto;
  }

  /* Strategy comparison table */
  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  /* Risk/opportunity cards */
  .risk-card-light,
  .opportunity-card-light {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ============================================
     TYPOGRAPHY & COLORS (ensure visibility)
     ============================================ */

  /* Ensure dark text on white background */
  h1, h2, h3, h4, h5, h6 {
    color: #1f2937 !important;
  }

  /* Ensure gradient text is readable in print */
  [style*="WebkitBackgroundClip: text"],
  [style*="-webkit-background-clip: text"] {
    -webkit-text-fill-color: #1e40af !important;
    color: #1e40af !important;
  }

  /* Property address bar */
  div[style*="linear-gradient(135deg, #1e293b"] {
    background: #1e293b !important;
    -webkit-print-color-adjust: exact;
  }

  /* Badges */
  .live-api-badge,
  .data-badge {
    border: 1px solid #e5e7eb !important;
  }

  /* ============================================
     IMAGES
     ============================================ */
  
  /* Comparable images */
  .comparable-image img {
    max-height: 100px !important;
  }

  /* Hide broken image placeholders */
  img[style*="display: none"] {
    display: none !important;
  }

  /* ============================================
     LINKS
     ============================================ */

  /* Don't show URLs after links */
  a::after {
    content: none !important;
  }

  a {
    text-decoration: none !important;
    color: inherit !important;
  }
}
