/* Custom CSS for Registered Flats Page Layout Reorganization */
/* Using existing design system variables and styling patterns */

/* Info sections moved to form-body area - matching existing form styling */
.flats-units-search .form-body .flats-units-search-info {
  background-color: var(--background-color);
  padding: calc(1rem * var(--spacing-row) / 16) calc(1rem * var(--spacing-inline) / 16);
  margin-bottom: calc(1rem * var(--spacing-row) / 16);
}

.flats-units-search .form-body .flats-units-search-info p {
  margin-bottom: 0;
  color: inherit;
}

.flats-units-search .form-body .flats-units-search-info a {
  color: var(--color--blue);
  text-decoration: underline;
}

.flats-units-search .form-body .flats-units-search-info a:hover {
  color: var(--color--blue-dark);
}

/* Warning section styling - matching existing design system */
.flats-units-search .form-body .flats-units-search-warning {
  display: flex;
  align-items: flex-start;
  gap: calc(1rem * 0.75 / 16);
  margin: calc(1rem * var(--spacing-row) / 16) 0;
  padding: calc(1rem * var(--spacing-row) / 16) calc(1rem * var(--spacing-inline) / 16);
  background-color: #f6faf3;
  border-radius: calc(1rem * var(--border-radius) / 16);
}

.flats-units-search-warning-icon {
  width: calc(1rem * 1.25 / 16);
  height: calc(1rem * 1.125 / 16);
  flex-shrink: 0;
  margin-top: calc(1rem * -0.125 / 16);
}

.flats-units-search-warning-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.flats-units-search-warning-content {
  flex: 1;
  width: auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.flats-units-search-warning-title {
  margin: 0 0 calc(1rem * 0.5 / 16) 0;
  font-weight: var(--font-weight-bold);
  color: inherit;
}

.flats-units-search-warning-text {
  margin-bottom: 0;
  color: inherit;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Override mobile hiding of form header and intro - show and add padding (same as recognised-units) */
@media screen and (max-width: 991.98px) {
  .flats-units-search .form-header {
    display: block !important;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .flats-units-search-intro {
    display: block !important;
    padding: calc(1rem * var(--spacing-row, 18) / 16) 1.25rem;
    margin-bottom: calc(1rem * var(--spacing-row, 18) / 32);
    background-color: var(--background-color);
  }
  
  .flats-units-search-intro p {
    margin-bottom: 0;
    color: inherit;
  }
  
  .flats-units-search-intro a {
    color: var(--color--blue);
    text-decoration: underline;
  }
  
  .flats-units-search-intro a:hover {
    color: var(--color--blue-dark);
  }
  /* No word breaks on mobile – keep words intact (override style.css break-word) */
  .flats-units-search,
  .flats-units-search .form-header,
  .flats-units-search .form-title,
  .flats-units-search .form-body,
  .flats-units-search-intro,
  .flats-units-search-intro p,
  .flats-units-search-intro a {
    word-wrap: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }
}

/* Keep warning icon and content on same line on mobile (override style.css column layout) */
@media screen and (max-width: 767px) {
  .flats-units-search .warning-section {
    flex-direction: row !important;
  }
}

/* Responsive adjustments matching existing breakpoints */
@media screen and (max-width: 991.98px) {
  .flats-units-search .form-body .flats-units-search-info,
  .flats-units-search .form-body .flats-units-search-warning {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Mobile-only CSS for warning sections - does not affect PC view */
@media screen and (max-width: 767px) {
  /* Warning section with inline styles - mobile responsive */
  div[style*="display: flex"][style*="background: #F6FAF3"] {
    flex-direction: column !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  
  div[style*="display: flex"][style*="background: #F6FAF3"] span[style*="width: 20px"] {
    margin-top: 0 !important;
    align-self: flex-start !important;
  }
  
  div[style*="display: flex"][style*="background: #F6FAF3"] h3[style*="clamp(16px, 4vw, 20px)"] {
    font-size: clamp(14px, 4.5vw, 18px) !important;
    margin-bottom: 6px !important;
  }
  
  div[style*="display: flex"][style*="background: #F6FAF3"] p[style*="clamp(14px, 3.5vw, 18px)"] {
    font-size: clamp(12px, 4vw, 16px) !important;
    line-height: 1.5 !important;
  }
}

/* Tablet-specific adjustments */
@media screen and (min-width: 768px) and (max-width: 991px) {
  div[style*="display: flex"][style*="background: #F6FAF3"] {
    padding: 14px !important;
  }
  
  div[style*="display: flex"][style*="background: #F6FAF3"] h3[style*="clamp(16px, 4vw, 20px)"] {
    font-size: clamp(15px, 3.5vw, 19px) !important;
  }
  
  div[style*="display: flex"][style*="background: #F6FAF3"] p[style*="clamp(14px, 3.5vw, 18px)"] {
    font-size: clamp(13px, 3.2vw, 17px) !important;
  }
}



/* Remark text styles - copied from style.css */
.remark {
  --font-size: 14;
  font-size: calc(1rem * var(--font-size) / 16);
  --line-height: 18;
  line-height: calc(var(--line-height) / var(--font-size));
  --color: #666666;
  color: var(--color);
}

/* Mobile color change only */
@media screen and (max-width: 767px) {
  .remark {
    color: var(--color) !important;
  }
}

@media screen and (min-width: 992px) {
  .remark {
    --font-size: 16;
    font-size: calc(1rem * var(--font-size) / 16);
    --line-height: 20;
    --color: #666666;
    color: var(--color) !important;
    line-height: calc(var(--line-height) / var(--font-size));
  }
}

/* ========================================
   SEARCH RESULTS MOBILE CSS
   ======================================== */

/* Search Results Table - Mobile Responsive */
@media screen and (max-width: 767px) {
  /* Results table container */
  .table-responsive {
    border: none !important;
    border-radius: 8px !important;
    overflow: visible !important;
  }
  
  /* Table styling for mobile */
  .table {
    border: none !important;
  }
  
  .table thead {
    display: none !important; /* Hide table headers on mobile */
  }
  
  .table tbody tr {
    display: block !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  }
  
  .table tbody td {
    display: block !important;
    border: none !important;
    padding: 6px 0 !important;
    text-align: left !important;
    position: relative !important;
    padding-left: 45% !important;
  }
  
  .table tbody td:before {
    content: attr(data-label) !important;
    position: absolute !important;
    left: 0 !important;
    width: 40% !important;
    font-weight: bold !important;
    color: #333 !important;
    font-size: 14px !important;
  }
  
  /* Action buttons in mobile */
  .table tbody td .btn {
    width: 100% !important;
    margin: 4px 0 !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
  }
}

/* Search Results Pagination - Mobile */
@media screen and (max-width: 767px) {
  .pagination-container {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    margin: 15px 0 !important;
  }
  
  .pagination-info {
    text-align: center !important;
    font-size: 14px !important;
    order: 2 !important;
  }
  
  .pagination-controls {
    justify-content: center !important;
    order: 1 !important;
  }
  
  .pagination-arrow {
    padding: 10px 15px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
  }
  
  .pagination-numbers {
    font-size: 14px !important;
  }
  
  .page-input {
    width: 50px !important;
    padding: 6px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
  }
}

/* Search Form Filters - Mobile */
@media screen and (max-width: 767px) {
  .search-filters {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .filter-group {
    width: 100% !important;
  }
  
  .filter-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-weight: bold !important;
    font-size: 14px !important;
  }
  
  .filter-group select,
  .filter-group input {
    width: 100% !important;
    padding: 10px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    border-radius: 6px !important;
  }
  
  .search-buttons {
    flex-direction: column !important;
    gap: 8px !important;
  }
  
  .search-buttons .btn {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
  }
}

/* Results Summary - Mobile */
@media screen and (max-width: 767px) {
  .results-summary {
    padding: 12px !important;
    background: #e8f5e8 !important;
    border-radius: 6px !important;
    margin: 10px 0 !important;
    font-size: 14px !important;
    text-align: center !important;
  }
  
  .results-count {
    font-weight: bold !important;
    color: #2d5a2d !important;
  }
}

/* Details Page - Mobile Responsive */
@media screen and (max-width: 767px) {
  .building-details {
    padding: 15px !important;
  }
  
  .detail-section {
    margin-bottom: 20px !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 15px !important;
  }
  
  .detail-section h3 {
    font-size: 18px !important;
    margin-bottom: 10px !important;
    color: #333 !important;
    border-bottom: 2px solid #e0e0e0 !important;
    padding-bottom: 8px !important;
  }
  
  .detail-row {
    display: block !important;
    margin-bottom: 10px !important;
  }
  
  .detail-label {
    display: block !important;
    font-weight: bold !important;
    margin-bottom: 3px !important;
    font-size: 14px !important;
    color: #555 !important;
  }
  
  .detail-value {
    display: block !important;
    font-size: 16px !important;
    color: #333 !important;
  }
  
  /* Map container mobile */
  .map-container {
    height: 250px !important;
    margin: 15px 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }
  
  /* Back button mobile */
  .back-button {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
    margin: 15px 0 !important;
  }
}

/* Print styles matching existing form print styles */
@media print {
  .flats-units-search .form-body .flats-units-search-info,
  .flats-units-search .form-body .flats-units-search-warning {
    background: transparent !important;
    border: 1px solid #ddd;
  }
  
  .flats-units-search .form-body .flats-units-search-info a {
    color: #000 !important;
  }
  
  
  /* Print styles for search results */
  .table tbody tr {
    page-break-inside: avoid !important;
  }
  
  .pagination-container,
  .search-buttons {
    display: none !important;
  }
  
  /* Form footer layout - search input and buttons on same row */
  .flats-units-search {
    width: 100% !important;
    max-width: none !important;
  }
  
  .form-footer {
    display: grid !important;
    grid-template-columns: 40% 30% 30% !important;
    grid-template-rows: auto auto !important;
    gap: 0.5rem 0.5rem !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: center !important;
  }
  
  /* Search tip - full width on row 1 */
  .flats-units-search-tip {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem 0 !important;
    display: block !important;
  }
  
  /* Search input - 40% width on row 2, column 1 */
  .flats-units-search-keywords {
    grid-column: 1 !important;
    grid-row: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
  }
  
  .flats-units-search-keywords .flats-units-search-field {
    width: 100% !important;
    display: block !important;
  }
  
  /* Buttons container - spans columns 2 and 3 */
  .flats-units-search-controls {
    grid-column: 2 / 4 !important;
    grid-row: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .flats-units-search-controls .btn {
    flex: 1 !important;
    display: block !important;
    white-space: nowrap !important;
    margin: 0 !important;
  }
}
