/* ===== FORCE PC/DESKTOP TABLE VIEW FOR SEARCH RESULTS ===== */
@media print {
  /* Force print color preservation */
  * {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Override mobile card layout - force desktop table display */
  
  /* Force table container to behave as normal table */
    .table-responsive {
    display: block !important;
        width: 100% !important;
    overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

  /* Force table to display as standard table */
    .flats-units-search-results-table {
    display: table !important;
        width: 100% !important;
    border-collapse: collapse !important;
        border: none !important;
    }
    
  /* Remove all table borders */
  .flats-units-search-results-table,
  .flats-units-search-results-table thead,
  .flats-units-search-results-table tbody,
  .flats-units-search-results-table tr,
  .flats-units-search-results-table th,
  .flats-units-search-results-table td,
  .table-card-rows,
  .table-card-rows tr,
  .table-card-rows th,
  .table-card-rows td {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
  }

  /* Show table headers - match PC view green header */
  .flats-units-search-results-table thead {
    display: table-header-group !important;
    background-color: #4F832F !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Ensure header text is visible - white text on green background */
  .flats-units-search-results-table thead th {
    font-weight: bold !important;
    font-size: 14px !important;
    text-align: center !important;
    background-color: #4F832F !important;
    color: #ffffff !important;
  }
  
  /* Force tbody to display as table body */
    .flats-units-search-results-table tbody {
    display: table-row-group !important;
    width: auto !important;
    }

  /* Force rows to display as table rows, not cards */
    .table-card-rows tr {
    display: table-row !important;
    margin-bottom: 0 !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    page-break-inside: auto !important;
  }
  
  /* Remove card headers */
    .table-card-rows tr::before {
    display: none !important;
  }
  
  /* Force cells to display as table cells */
  .table-card-rows td,
  .table-card-rows th {
    display: table-cell !important;
    padding: 0.5rem !important;
    vertical-align: top !important;
    background: transparent !important;
  }
  
  /* Ensure table cell content is visible */
  .table-card-rows td span,
  .table-card-rows th,
  .flats-units-search-results-table td,
  .flats-units-search-results-table th {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  /* Remove cell labels */
    .table-card-rows td::before {
    display: none !important;
  }
  
  /* Style table headers - match PC view */
  .flats-units-search-results-table th {
    display: table-cell !important;
    padding: 0.75rem 0.5rem !important;
    font-weight: bold !important;
    font-size: 14px !important;
    background-color: #4F832F !important;
    color: #ffffff !important;
    text-align: left !important;
    vertical-align: top !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Keep specific hidden columns hidden in print view */
  .flats-units-search-results-table .d-none {
    display: none !important;
  }
  
  /* Hide View Details/Floor Plan column in print (last column) */
  .flats-units-search-results-table th:last-child,
  .flats-units-search-results-table td:last-child,
  .table-card-rows-view-details-footer {
    display: none !important;
  }

  /* Style the View Details button properly */
  .table-card-rows--has-card-footer .table-card-rows-card-footer {
    display: inline !important;
    margin-top: 0.5rem !important;
  }
  
  .table-card-rows--has-card-footer .table-card-rows-card-footer .d-grid {
    display: inline !important;
  }
  
  .table-card-rows--has-card-footer .btn {
    display: inline-block !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.875rem !important;
    background-color: #007bff !important;
    color: white !important;
    border: none !important;
    border-radius: 0.25rem !important;
        text-decoration: none !important;
    }
  
  /* Style Back button - white text on transparent/light background */
  .back-button .btn,
  .back-button .btn-outline-light {
    display: inline-block !important;
    color: #ffffff !important;
    background-color: transparent !important;
    border: 1px solid #ffffff !important;
    padding: 0.25rem 0.75rem !important;
    text-decoration: none !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Remove card spacing and styling */
    .table-card-rows tr + tr {
    margin-top: 0 !important;
    }

  /* Ensure cell content displays properly */
    .table-card-rows td > span,
    .table-card-rows td > a {
    flex: none !important;
    min-width: auto !important;
    }

  /* Force standard table layout */
    .table-card-rows {
        break-inside: auto !important;
    }

    .table-card-rows td {
    gap: 0 !important;
        align-items: flex-start !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
  }
  
  /* Optimized column widths for visible columns only */
  .flats-units-search-results-table th:nth-child(1),
  .flats-units-search-results-table td:nth-child(1) { width: 11%; } /* Flat/Unit */
  .flats-units-search-results-table th:nth-child(2),
  .flats-units-search-results-table td:nth-child(2) { width: 10%; } /* Floor */
  .flats-units-search-results-table th:nth-child(3),
  .flats-units-search-results-table td:nth-child(3) { width: 12%; } /* Block */
  .flats-units-search-results-table th:nth-child(4),
  .flats-units-search-results-table td:nth-child(4) { width: 16%; } /* Building Name */
  .flats-units-search-results-table th:nth-child(5),
  .flats-units-search-results-table td:nth-child(5) { width: 15%; } /* Name of Estate */
  .flats-units-search-results-table th:nth-child(6),
  .flats-units-search-results-table td:nth-child(6) { width: 12%; }  /* Street No */
  .flats-units-search-results-table th:nth-child(7),
  .flats-units-search-results-table td:nth-child(7) { width: 14%; } /* Name of Street */
  .flats-units-search-results-table th:nth-child(12),
  .flats-units-search-results-table td:nth-child(12) { width: 12%; } /* District */
  .flats-units-search-results-table th:nth-child(14),
  .flats-units-search-results-table td:nth-child(14) { width: 13%; } /* Registration Date */
  .flats-units-search-results-table th:nth-child(15),
  .flats-units-search-results-table td:nth-child(15) { width: 18%; } /* Remarks */
  
  /* Note: Recognised-units table has different column structure (includes BHU No.)
     Column widths for recognised-units are defined in recognised-units-search-results.css */

  /* ===== DETAILS PAGE DL-TABLE PRINT STYLES ===== */
  
  /* Show and style the map in print */
  .map-section {
    display: block !important;
    width: 100% !important;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
    page-break-inside: avoid !important;
  }
  
  .map-section h3 {
    display: block !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    margin-bottom: 0.5rem !important;
    text-align: left !important;
  }
  
  .map-container,
  #building-map {
    display: block !important;
    width: 100% !important;
    height: 400px !important;
    background-color: #f8f9fa !important;
    position: relative !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Center the map content within the container */
  .leaflet-container {
    background-color: #f8f9fa !important;
    margin: 0 auto !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Remove map container border */
  .map-container,
  #building-map {
    border: none !important;
  }
  
  /* Center map tiles */
  .leaflet-map-pane {
    left: -30% !important;
    top: -30% !important;
  }
  
  .leaflet-tile {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Hide interactive map controls in print */
  .leaflet-control-container,
  .leaflet-control-zoom,
  .leaflet-control-attribution {
    display: none !important;
  }
  
  /* Style the dl-table container */
  .dl-table {
    display: block !important;
    width: 100% !important;
    margin-bottom: 2rem !important;
    page-break-inside: avoid !important;
  }
  
  /* Style the table header - match PC view */
  .dl-table-xl-9 .dl-table-header {
    display: flex !important;
    align-items: center !important;
    background-color: #4F832F !important; /* Green header like PC view */
    color: #ffffff !important;
    min-height: 3rem !important;
    padding: 0.75rem 1rem !important;
    margin-bottom: 0 !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Style the table title - match PC view */
  .dl-table-xl-9 .dl-table-title {
    display: block !important;
    font-size: 1.25rem !important;
    font-weight: bold !important;
    color: #ffffff !important;
    margin: 0 !important;
    text-align: left !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Convert dl-table-body to match PC view (xl breakpoint) */
  .dl-table-xl-9 .dl-table-body {
    display: grid !important;
    grid-template-areas: "left-1-dt left-1-dd right-1-dt right-1-dd" 
                         "left-2-dt left-2-dd right-2-dt right-2-dd" 
                         "left-3-dt left-3-dd right-3-dt right-3-dd" 
                         "left-4-dt left-4-dd right-4-dt right-4-dd" 
                         "left-5-dt left-5-dd right-5-dt right-5-dd" 
                         "left-6-dt left-6-dd right-6-dt right-6-dd" 
                         "left-7-dt left-7-dd right-7-dt right-7-dd" 
                         "left-8-dt left-8-dd right-8-dt right-8-dd" 
                         "left-9-dt left-9-dd right-9-dt right-9-dd" !important;
    grid-template-columns: minmax(120px, auto) 1fr minmax(120px, auto) 1fr !important;
    gap: 0 !important;
    width: 100% !important;
  }
  
  /* Grid area assignments for each field - match PC view */
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-1 { grid-area: left-1-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-1 { grid-area: left-1-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-1 { grid-area: right-1-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-1 { grid-area: right-1-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-2 { grid-area: left-2-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-2 { grid-area: left-2-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-2 { grid-area: right-2-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-2 { grid-area: right-2-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-3 { grid-area: left-3-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-3 { grid-area: left-3-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-3 { grid-area: right-3-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-3 { grid-area: right-3-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-4 { grid-area: left-4-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-4 { grid-area: left-4-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-4 { grid-area: right-4-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-4 { grid-area: right-4-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-5 { grid-area: left-5-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-5 { grid-area: left-5-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-5 { grid-area: right-5-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-5 { grid-area: right-5-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-6 { grid-area: left-6-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-6 { grid-area: left-6-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-6 { grid-area: right-6-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-6 { grid-area: right-6-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-7 { grid-area: left-7-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-7 { grid-area: left-7-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-7 { grid-area: right-7-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-7 { grid-area: right-7-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-8 { grid-area: left-8-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-8 { grid-area: left-8-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-8 { grid-area: right-8-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-8 { grid-area: right-8-dd !important; }
  
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-9 { grid-area: left-9-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--left-9 { grid-area: left-9-dd !important; }
  .dl-table-xl-9 .dl-table-body dt.dl-table--right-9 { grid-area: right-9-dt !important; }
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-9 { grid-area: right-9-dd !important; }
  
  /* Alternating row background colors - match PC view */
  .dl-table-xl-9 .dl-table-body .dl-table--left-1,
  .dl-table-xl-9 .dl-table-body .dl-table--right-1,
  .dl-table-xl-9 .dl-table-body .dl-table--left-3,
  .dl-table-xl-9 .dl-table-body .dl-table--right-3,
  .dl-table-xl-9 .dl-table-body .dl-table--left-5,
  .dl-table-xl-9 .dl-table-body .dl-table--right-5,
  .dl-table-xl-9 .dl-table-body .dl-table--left-7,
  .dl-table-xl-9 .dl-table-body .dl-table--right-7,
  .dl-table-xl-9 .dl-table-body .dl-table--left-9,
  .dl-table-xl-9 .dl-table-body .dl-table--right-9 {
    background-color: #f6faf3 !important;
  }
  
  .dl-table-xl-9 .dl-table-body .dl-table--left-2,
  .dl-table-xl-9 .dl-table-body .dl-table--right-2,
  .dl-table-xl-9 .dl-table-body .dl-table--left-4,
  .dl-table-xl-9 .dl-table-body .dl-table--right-4,
  .dl-table-xl-9 .dl-table-body .dl-table--left-6,
  .dl-table-xl-9 .dl-table-body .dl-table--right-6,
  .dl-table-xl-9 .dl-table-body .dl-table--left-8,
  .dl-table-xl-9 .dl-table-body .dl-table--right-8 {
    background-color: #f8f9fa !important;
  }
  
  /* Style all dt elements (headers) - match PC view */
  .dl-table-xl-9 .dl-table-body dt {
    display: block !important;
    font-weight: bold !important;
    padding: 0.5rem !important;
    text-align: left !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Style all dd elements (data) - match PC view */
  .dl-table-xl-9 .dl-table-body dd {
    display: block !important;
    padding: 0.5rem !important;
    text-align: left !important;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Add left padding for left column dt elements */
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-1,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-2,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-3,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-4,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-5,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-6,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-7,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-8,
  .dl-table-xl-9 .dl-table-body dt.dl-table--left-9 {
    padding-left: 1rem !important;
  }
  
  /* Add right padding for right column dd elements */
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-1,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-2,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-3,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-4,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-5,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-6,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-7,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-8,
  .dl-table-xl-9 .dl-table-body dd.dl-table--right-9 {
    padding-right: 1rem !important;
  }
  
  /* Style links within the table */
  .dl-table-body a {
    color: #007bff !important;
    text-decoration: underline !important;
  }
}
