/* BBL GIS Immobilienportfolio - Component Styles */
/* Requires tokens.css to be loaded first */

/* ===== HEADER ===== */
#header {
  background: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.header-main {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-5);
  height: var(--header-main-height);
  border-bottom: 1px solid var(--grey-300);
  box-shadow: var(--shadow-md);
  z-index: 1; /* Shadow appears above header-detail */
}

#logo-area {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  cursor: pointer;
}

#logo-flag {
  width: 25px;
  height: auto;
}

#logo-text-img {
  height: 50px;
  width: auto;
}

.logo-divider {
  width: 1px;
  align-self: stretch;
  background: var(--grey-400);
  margin: 0 var(--space-4);
  flex-shrink: 0;
}

#logo-title {
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--grey-700);
  white-space: nowrap;
}

#logo-title strong {
  font-weight: var(--font-semibold);
  color: var(--grey-900);
}

#search-area {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  pointer-events: none;
}

#search-area > * {
  pointer-events: auto;
}

#search-wrapper {
  position: relative;
  width: 100%;
  max-width: 550px;
  z-index: 2000;
}

#search-container {
  display: flex;
  align-items: center;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  width: 100%;
  overflow: hidden;
  background: var(--white);
  height: 40px;
}

#search-icon-btn {
  background: var(--grey-100);
  border: none;
  border-right: 1px solid var(--grey-300);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#search-icon-btn:hover {
  background: var(--grey-200);
}

#search-icon-btn .material-symbols-outlined {
  font-size: var(--icon-lg);
  color: var(--grey-600);
}

#search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  outline: none;
}

/* Hide browser's default clear button on search inputs */
#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

#search-input::-ms-clear {
  display: none;
}

#search-input::placeholder {
  color: var(--grey-500);
}

/* NEW: Search Clear Button */
#search-clear-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 var(--space-3);
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  color: var(--grey-500);
  height: 100%;
}

#search-clear-btn:hover {
  color: var(--grey-900);
  background: var(--grey-50);
}

#search-clear-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

#search-clear-btn.visible {
  display: flex;
}

/* Spinner style */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--grey-100);
  border-top: 2px solid var(--grey-600);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  will-change: transform;
  margin-right: var(--space-3);
  display: none; /* Hidden by default */
}

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 500px;
  overflow-y: auto;
  display: none;
}

#search-results.active {
  display: block;
}

.search-section-header {
  background: var(--accent-panel);
  color: var(--white);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.search-item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  border-bottom: 1px solid var(--grey-100);
  transition: background var(--transition-fast);
}

.search-item:hover {
  background: var(--grey-100);
}

.search-item:last-child {
  border-bottom: none;
}

.search-item-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

.search-item-title b {
  color: var(--primary-red);
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search-history-icon {
  font-size: 18px;
  color: var(--grey-400);
  flex-shrink: 0;
}

.search-history-item .search-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-history-remove {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--grey-400);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.search-history-remove:hover {
  color: var(--grey-700);
  background: var(--grey-100);
}

.search-history-remove .material-symbols-outlined {
  font-size: 16px;
}

.search-item-subtitle {
  font-size: var(--text-xs);
  color: var(--grey-600);
  margin-top: var(--space-1);
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  height: 40px;
}

.view-toggle-btn {
  background: var(--white);
  border: none;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-right: 1px solid var(--grey-300);
  transition: background var(--transition-normal), padding var(--transition-normal);
}

.view-toggle-btn:last-child {
  border-right: none;
}

.view-toggle-btn:hover {
  background: var(--grey-100);
}

.view-toggle-btn.active {
  background: var(--accent-panel);
}

.view-toggle-btn .material-symbols-outlined {
  font-size: var(--icon-lg);
  color: var(--grey-600);
}

.view-toggle-btn.active .material-symbols-outlined {
  color: var(--white);
}

.view-toggle-btn .view-label {
  display: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

.view-toggle-btn.active .view-label {
  display: inline;
  color: var(--white);
}

#header-right {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-width: 250px;
  justify-content: flex-end;
}

.header-btn {
  background: var(--white);
  border: 1px solid var(--grey-300);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  height: 40px;
  gap: var(--space-2);
  transition: background var(--transition-normal);
}

.header-btn:hover {
  background: var(--grey-100);
}

.header-btn.panel-open {
  background: var(--accent-panel);
  border-color: var(--accent-panel);
  color: var(--white);
}

.header-btn.panel-open .material-symbols-outlined {
  color: var(--white);
}

.header-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* ===== LANGUAGE SELECTOR ===== */
#lang-selector {
  position: relative;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  min-width: 48px;
}

.lang-dropdown.open {
  display: flex;
  flex-direction: column;
}

.lang-option {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--grey-700);
  cursor: pointer;
  text-align: center;
}

.lang-option:hover {
  background: var(--grey-100);
}

.lang-option.active {
  color: var(--primary-red);
}

/* ===== MAIN CONTENT ===== */
#main {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ===== MAP VIEW ===== */
#map-view {
  flex: 1;
  position: relative;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#map-view.active {
  display: flex;
}

#map {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ===== TABLE PANEL (below map) ===== */
.table-panel {
  height: 40vh;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  transition: height 0.25s ease;
  position: relative;
  z-index: 7;
}

.table-panel.collapsed {
  height: 0;
  border-top: none;
}

.table-panel .list-table-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.table-panel .list-table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* ===== TABLE TOGGLE BUTTON ===== */
.tbl-toggle {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-700);
  transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

.tbl-toggle:hover {
  background: var(--grey-50);
  box-shadow: var(--shadow-lg);
}

.tbl-toggle .material-symbols-outlined {
  font-size: var(--icon-md);
  transition: transform 0.25s ease;
}

.tbl-toggle.collapsed .material-symbols-outlined {
  transform: rotate(180deg);
}

/* ===== TABLE RESIZE HANDLE ===== */
.tbl-resize-handle {
  flex-shrink: 0;
  height: 6px;
  cursor: ns-resize;
  background: var(--grey-200);
  position: relative;
  z-index: 10;
  transition: background var(--transition-normal);
}

.tbl-resize-handle:hover,
.tbl-resize-handle.dragging {
  background: var(--accent-panel);
}

/* ===== SHARED TOOLBAR STYLES ===== */
/* ===== TABLE TABS ===== */
.table-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.table-tab {
  padding: var(--space-1) var(--space-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--grey-500);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.table-tab:hover {
  color: var(--grey-700);
}

.table-tab.active {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
}

.table-tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.table-tab-content.active {
  display: flex;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--grey-200);
  background: var(--white);
  flex-shrink: 0;
  min-height: 44px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-width: 250px;
  min-height: 32px;
}

.toolbar-search .material-symbols-outlined {
  font-size: var(--icon-md);
  color: var(--grey-500);
}

.toolbar-search input {
  border: none;
  outline: none;
  font-size: var(--text-xs);
  width: 100%;
  background: transparent;
}

.toolbar-search input::placeholder {
  color: var(--grey-500);
}

.toolbar-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--grey-400);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.toolbar-search-clear[hidden] {
  display: none;
}

.toolbar-search-clear .material-symbols-outlined {
  font-size: var(--icon-sm);
}

.toolbar-search-clear:hover {
  color: var(--grey-700);
}

/* Filter pills in toolbar */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-pills:empty {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--grey-700);
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1;
}

.filter-pill-label {
  color: var(--grey-600);
  margin-right: var(--space-1);
}

.filter-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-sm);
  height: var(--icon-sm);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-full);
  color: var(--grey-400);
  font-family: 'Material Symbols Outlined';
  font-size: var(--icon-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.filter-pill-remove:hover {
  color: var(--grey-900);
  background: var(--grey-200);
}

.filter-pills-reset {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--primary-red);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

.filter-pills-reset:hover {
  text-decoration: underline;
}

/* List View Toolbar - extends .toolbar */
.list-toolbar-search {
  min-width: 280px;
}

/* Dropdown Button Styles */
.dropdown-container {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--grey-700);
  cursor: pointer;
  min-height: 32px;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.dropdown-btn:hover {
  background: var(--grey-50);
  border-color: var(--grey-500);
}

.dropdown-btn .material-symbols-outlined {
  font-size: var(--icon-sm);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 1000;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu-header {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--grey-100);
}

.dropdown-menu-header:not(:first-child) {
  border-top: 1px solid var(--grey-200);
  margin-top: var(--space-1);
}

.dropdown-menu-item,
.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--grey-700);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-menu-item:hover,
.context-menu-item:hover {
  background: var(--grey-50);
}

.dropdown-menu-item .material-symbols-outlined {
  font-size: var(--icon-md);
  color: var(--grey-500);
}

.dropdown-menu-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Columns dropdown — wide, scrollable */
.columns-dropdown {
  min-width: 280px;
  max-width: 320px;
}

.columns-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--grey-100);
}

.columns-search .material-symbols-outlined {
  font-size: var(--icon-sm);
  color: var(--grey-400);
}

.columns-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--text-sm);
  background: transparent;
}

.columns-list {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-1) 0;
}

.columns-group-label {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--grey-400);
}

.columns-list .dropdown-menu-item {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.dropdown-menu-divider {
  height: 1px;
  background: var(--grey-100);
  margin: var(--space-1) 0;
}

.dropdown-menu-toggle-row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
}

.dropdown-toggle-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--grey-700);
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.dropdown-toggle-btn:hover {
  background: var(--grey-200);
  border-color: var(--grey-300);
}

/* List Table Container */
.list-table-container {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  background: var(--white);
}

.list-table-wrapper {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-300) transparent;
}

.list-table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.list-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.list-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--grey-300);
  border-radius: var(--radius-full);
}

.list-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--grey-400);
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.list-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--grey-100);
}

.list-table th {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--grey-700);
  border-bottom: 1px solid var(--grey-300);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.list-table th:hover {
  color: var(--primary-red);
}

.list-table th .material-symbols-outlined {
  font-size: var(--icon-sm);
  color: var(--grey-500);
  vertical-align: middle;
  margin-left: 2px;
}

.list-table td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-800);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-table tbody tr {
  cursor: pointer;
}

.list-table tbody tr:hover td {
  background: var(--grey-50);
}

.list-table tbody tr.row-active td {
  background: var(--primary-red-tint);
}

.list-table tbody tr.row-active:hover td {
  background: rgba(204, 0, 0, 0.08);
}

/* .status-badge extends .badge from tokens.css — only color variants needed */
.status-badge.status-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}

.status-badge.status-renovation {
  background: var(--status-renovation-bg);
  color: var(--status-renovation-text);
}

.status-badge.status-planning {
  background: var(--status-planning-bg);
  color: var(--status-planning-text);
}

.status-badge.status-inactive,
.status-badge.status-expired {
  background: var(--status-inactive-bg);
  color: var(--status-inactive-text);
}

.status-badge.status-terminated {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

/* ===== PAGINATION ===== */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) var(--space-4);
  border-top: 1px solid var(--grey-200);
  background: var(--white);
  font-size: var(--text-xs);
  color: var(--grey-600);
  flex-shrink: 0;
}

.pagination-rows {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.pagination-rows select {
  padding: var(--space-1) var(--space-1);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--text-xs);
  color: var(--grey-700);
  cursor: pointer;
}

.pagination-rows select:hover {
  border-color: var(--grey-500);
}

.pagination-info {
  flex: 1;
  font-weight: var(--font-medium);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-page-info {
  font-weight: var(--font-medium);
  white-space: nowrap;
  padding: 0 var(--space-2);
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--grey-700);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--grey-100);
  border-color: var(--grey-500);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* ===== GALLERY VIEW ===== */
#gallery-view {
  flex: 1;
  display: none;
  background: var(--grey-50);
  overflow-y: auto;
  padding: var(--space-6);
}

#gallery-view.active {
  display: block;
}

.gallery-result-count {
  font-size: var(--text-xs);
  color: var(--grey-500);
  padding: 0 var(--space-6) var(--space-2);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
  max-width: 1500px;
  margin: 0 auto;
}

.gallery-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  cursor: pointer;
}

@media (hover: hover) {
  .gallery-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
  }
}

.gallery-image {
  height: 180px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gallery-image .material-symbols-outlined {
  font-size: var(--icon-hero);
  color: rgba(255, 255, 255, 0.3);
}

.gallery-image-label {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.gallery-content {
  padding: var(--space-4);
}

.gallery-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  margin-bottom: var(--space-1);
  line-height: var(--leading-snug);
}

.gallery-subtitle {
  font-size: var(--text-sm);
  color: var(--grey-600);
  margin-bottom: var(--space-3);
}

.gallery-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.gallery-tag {
  background: var(--grey-100);
  color: var(--grey-600);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

.gallery-pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  font-size: var(--text-sm);
  color: var(--grey-600);
}

/* ===== DETAIL VIEW ===== */
#detail-view {
  flex: 1;
  display: none;
  flex-direction: column;
  background: var(--grey-50);
  overflow: hidden;
}

#detail-view.active {
  display: flex;
}

/* ===== DETAIL VIEW PAGE SCROLL MODE ===== */
/* When detail view is active, unlock body scroll — no fixed elements */
body.detail-active {
  height: auto;
  overflow: auto;
  background: var(--grey-50);
}

body.detail-active #main {
  overflow: visible;
}

body.detail-active .main-content {
  overflow: visible;
}

body.detail-active #detail-view {
  overflow: visible;
  padding-bottom: var(--space-8);
}

.detail-header {
  padding: var(--space-3) 0;
}

.detail-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--grey-600);
}

.breadcrumb .material-symbols-outlined {
  font-size: var(--icon-md);
  color: var(--grey-500);
}

.breadcrumb a {
  color: var(--grey-700);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--grey-900);
  text-decoration: underline;
}

.breadcrumb span.current {
  color: var(--grey-900);
  font-weight: var(--font-medium);
}

.detail-header-actions {
  display: flex;
  gap: var(--space-4);
}

.btn-back {
  background: var(--white);
  color: var(--grey-900);
  border: 1px solid var(--grey-300);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-back:hover {
  background: var(--grey-100);
}

.btn-back .material-symbols-outlined {
  font-size: var(--icon-sm);
}

.detail-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--grey-300);
  padding: 0 var(--space-6);
}

.detail-tabs-inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}

.detail-tab {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--grey-600);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: color var(--transition-normal), border-color var(--transition-normal), background var(--transition-normal);
}

.detail-tab:hover {
  color: var(--grey-900);
  background: var(--grey-50);
}

.detail-tab.active {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
}

.detail-tab.disabled {
  color: var(--grey-500);
  cursor: not-allowed;
}

.detail-tab.disabled:hover {
  color: var(--grey-500);
  background: transparent;
}

.detail-content {
  overflow: visible;
  padding: var(--space-5) 0;
  transition: padding-right var(--transition-slow);
}

/* Detail view: drawer overlays content, no padding shift */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  max-width: 1500px;
  margin: 0 auto;
}


/* Single-column detail layout — fixed width independent of tab content */
.detail-single-col {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.detail-single-col .tab-content {
  display: none;
  width: 100%;
}

.detail-single-col .tab-content.active {
  display: block;
}

/* Carousel inside detail — match card radius */
.detail-single-col .carousel {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

/* Inline tabs (inside content, scrollable) */
.detail-tabs-inline {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--grey-300);
  margin-bottom: var(--space-5);
}

.detail-tabs-inline .detail-tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--transition-normal), border-color var(--transition-normal);
}

.detail-tabs-inline .detail-tab:hover {
  color: var(--grey-900);
}

.detail-tabs-inline .detail-tab.active {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
  font-weight: var(--font-semibold);
}

/* Section overline title (collapsible card header) */
.detail-overline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--grey-500);
  margin-top: var(--space-6);
  margin-bottom: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.detail-overline:hover {
  background: var(--grey-100);
}

.detail-overline .detail-overline-chevron {
  font-size: 18px;
  color: var(--grey-400);
  transition: transform 0.2s;
}

.detail-overline.collapsed .detail-overline-chevron {
  transform: rotate(90deg);
}

.detail-overline.collapsed {
  border-radius: var(--radius-sm);
  margin-bottom: 0;
}

.detail-overline.collapsed + .detail-card {
  display: none;
}

.detail-overline + .detail-card {
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.tab-content .detail-overline:first-child {
  margin-top: 0;
}

/* Detail card (white container) */
.detail-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  padding: var(--space-1) 0;
}

/* Grid row: label | value | info icon column */
/* Horizontal padding matches .detail-overline (space-3 = 12px) so icons align */
.detail-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr 24px;
  gap: var(--space-4) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--grey-100);
  align-items: baseline;
  cursor: default;
}

.detail-grid-row[data-desc] {
  cursor: pointer;
}

.detail-grid-row:hover {
  background: var(--grey-50);
}

.detail-grid-row:last-child,
.detail-grid-row:has(+ .detail-grid-spacer) {
  border-bottom: none;
}

.detail-grid-spacer {
  height: 6px;
}

.detail-label {
  font-size: var(--text-sm);
  color: var(--grey-600);
  line-height: var(--leading-normal);
}

.detail-label::after {
  content: ' :';
}

.detail-value {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-900);
  line-height: var(--leading-normal);
  word-break: break-word;
}

.detail-value a {
  color: var(--primary-red);
  text-decoration: none;
  font-weight: var(--font-normal);
}

.detail-value a:hover {
  text-decoration: underline;
}

/* Info icon — 3rd column in grid row */
.info-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Material Symbols Outlined';
  font-size: var(--icon-sm);
  font-weight: normal;
  color: var(--grey-300);
  transition: color var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.detail-grid-row[data-desc]:hover .info-icon {
  color: var(--grey-500);
}

/* Info popover — spans all 3 columns */
.info-popover {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--grey-500);
  background: var(--grey-50);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

/* ===== API DOCS VIEW ===== */
#api-docs-view {
  display: none;
  flex: 1;
}

#api-docs-view.active {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.api-docs-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: var(--space-3) var(--space-5);
}

.api-docs-nav .detail-header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.api-docs-content {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-5);
  box-sizing: border-box;
}

.api-docs-header h1 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  margin: 0 0 var(--space-2) 0;
}

.api-docs-subtitle {
  font-size: var(--text-sm);
  color: var(--grey-500);
  margin: 0 0 var(--space-6) 0;
}

.api-docs-section {
  margin-bottom: var(--space-8);
}

.api-docs-section h2 {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--grey-500);
  margin: 0 0 var(--space-3) var(--space-1);
}

.api-docs-section p {
  font-size: var(--text-sm);
  color: var(--grey-700);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-4) 0;
}

.api-docs-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.api-docs-overline {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--grey-400);
  margin-bottom: var(--space-2);
}

.api-docs-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--grey-100);
  font-size: var(--text-sm);
  align-items: baseline;
}

.api-docs-row:last-child {
  border-bottom: none;
}

.api-docs-row code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--grey-900);
  background: var(--grey-50);
  padding: var(--space-1) var(--space-1);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.api-docs-row span {
  color: var(--grey-600);
}

.api-docs-label {
  min-width: 160px;
  color: var(--grey-500);
  flex-shrink: 0;
}

.api-docs-endpoint {
  margin-bottom: var(--space-6);
}

.api-docs-method {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.method-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
}

.method-badge.get {
  background: var(--status-planning-bg);
  color: var(--status-planning-text);
}

.api-docs-card pre {
  margin: 0;
  overflow-x: auto;
}

.api-docs-card pre code {
  display: block;
  background: none;
  padding: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--grey-800);
  white-space: pre;
}

.api-docs-notice {
  font-style: italic;
  color: var(--grey-400);
  text-align: center;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--grey-200);
}

.api-docs-notice a {
  color: var(--primary-red);
}

/* ===== FULLSCREEN LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  z-index: 2;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.lightbox-counter {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: rgba(255, 255, 255, 0.9);
  min-width: 48px;
}

.lightbox-filename {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.lightbox-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

.lightbox-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.15s;
}

.lightbox-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.lightbox-image {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  user-select: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.15s;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.lightbox-prev { left: var(--space-5); }
.lightbox-next { right: var(--space-5); }

.lightbox-nav .material-symbols-outlined {
  font-size: 32px;
}

/* Carousel image click hint */
.carousel-image {
  cursor: zoom-in;
}

/* Image Carousel */
.carousel {
  position: relative;
  height: 340px;
  background: var(--grey-100);
}

.carousel-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-normal);
}

.carousel-btn:hover {
  background: var(--white);
}

.carousel-btn.prev {
  left: var(--space-4);
}

.carousel-btn.next {
  right: var(--space-4);
}

.carousel-btn .material-symbols-outlined {
  font-size: var(--icon-xl);
  color: var(--grey-900);
}

.carousel-dots {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-2);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background var(--transition-normal);
  position: relative;
}

.carousel-dot::after {
  content: '';
  position: absolute;
  inset: -17px;
}

.carousel-dot.active {
  background: var(--white);
}

/* Mini Map */
.mini-map-wrapper {
  margin: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--grey-200);
}

.mini-map-container {
  height: 300px;
}

.mini-map {
  width: 100%;
  height: 100%;
}

.mini-map-header {
  padding: var(--space-2) var(--space-3);
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
  font-size: var(--text-sm);
  color: var(--grey-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mini-map-header::before {
  content: 'location_on';
  font-family: 'Material Symbols Outlined';
  font-size: 16px;
  color: var(--grey-400);
}

/* Address Table */
.address-table {
  width: calc(100% - var(--space-3) * 2);
  margin: 0 var(--space-3);
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

.address-table th {
  background: var(--grey-50);
  padding: var(--space-1) var(--space-2);
  text-align: left;
  font-weight: var(--font-semibold);
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-size: 10px;
  border-bottom: 1px solid var(--grey-200);
}

.address-table td {
  padding: var(--space-2) var(--space-2);
  color: var(--grey-900);
  font-size: var(--text-sm);
}

.address-table tr:last-child td {
  border-bottom: none;
}

.address-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary-red);
  border-radius: var(--radius-full);
  margin-right: var(--space-2);
}

.address-marker .material-symbols-outlined {
  font-size: var(--text-sm);
  color: var(--white);
}

/* ===== ACCORDION WRAPPER (panel + toggle) ===== */
#accordion-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: var(--space-3);
  max-height: calc(100% - 60px);
  pointer-events: none;
}

#accordion-wrapper > * {
  pointer-events: auto;
}

#accordion-panel {
  width: 300px;
  background: var(--accent-panel);
  color: var(--white);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  box-shadow: var(--shadow-md);
}

#accordion-panel.collapsed {
  display: none;
}

.accordion-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.accordion-item:last-of-type {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
  font-family: inherit;
  padding: var(--space-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  transition: background var(--transition-normal);
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.1);
}

.accordion-header.active {
  background: var(--grey-100);
  color: var(--grey-900);
}

.accordion-arrow {
  transition: transform var(--transition-slow);
  display: flex;
  align-items: center;
}

.accordion-arrow .material-symbols-outlined {
  font-size: var(--icon-md);
}

.accordion-header.active .accordion-arrow {
  transform: rotate(90deg);
}

.accordion-header.active .accordion-arrow .material-symbols-outlined {
  color: var(--grey-900);
}

.accordion-content {
  display: none;
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  font-size: var(--text-sm);
  color: var(--grey-900);
}

.accordion-content.show {
  display: block;
}

/* ===== SHARE PANEL ===== */
.share-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.share-icons {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.share-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--grey-900);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-normal), transform var(--transition-fast);
}

.share-icon-btn:hover {
  background: var(--grey-600);
  transform: scale(1.05);
}

.share-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.share-link-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.share-link-label {
  font-size: var(--text-xs);
  color: var(--grey-600);
}

.share-link-row {
  display: flex;
  gap: var(--space-2);
}

.share-link-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--grey-900);
  background: var(--grey-50);
}

.share-link-input:focus {
  outline: none;
  border-color: var(--accent-panel);
}

.share-copy-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--grey-900);
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.share-copy-btn:hover {
  background: var(--grey-100);
  border-color: var(--grey-500);
}

.share-copy-btn.copied {
  background: var(--status-active);
  color: var(--white);
  border-color: var(--status-active);
}

/* Print panel styles are defined later */

/* ===== PRINT CROP PREVIEW ===== */
.print-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.print-preview-overlay.active {
  opacity: 1;
}

.print-preview-overlay svg {
  width: 100%;
  height: 100%;
}

.print-preview-crop {
  position: absolute;
  border: 2px dashed var(--primary-red);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.print-preview-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-red);
  color: var(--white);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

/* ===== EXPORT PANEL ===== */
.export-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.export-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.export-section-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* .export-select extends .custom-select from tokens.css — only width override needed */
.export-select {
  width: 100%;
}

.export-count {
  font-size: var(--text-xs);
  color: var(--grey-500);
  margin-top: var(--space-1);
}

.export-format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.export-format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition-normal), background var(--transition-normal);
}

.export-format-card:hover {
  border-color: var(--grey-500);
  background: var(--grey-50);
}

.export-format-card.active {
  border-color: var(--accent-panel);
  background: rgba(0, 60, 105, 0.05);
  box-shadow: 0 0 0 1px var(--accent-panel);
}

.export-format-icon {
  font-size: var(--text-lg);
  color: var(--grey-700);
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-format-card.active .export-format-icon {
  color: var(--accent-panel);
}

.export-format-icon .material-symbols-outlined {
  font-size: var(--icon-xl);
}

.export-format-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

.export-format-desc {
  font-size: var(--text-xs);
  color: var(--grey-500);
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.export-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--grey-900);
  cursor: pointer;
}

.export-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.export-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--grey-900);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background var(--transition-normal);
}

.export-btn:hover {
  background: var(--grey-700);
}

.export-btn:active {
  background: var(--grey-900);
}

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

.export-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* ===== GEOKATALOG TREE ===== */
.geokatalog-header .geokatalog-theme-switch {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.95);
  font-weight: var(--font-normal);
  margin-left: auto;
}

.geokatalog-header.active .geokatalog-theme-switch {
  color: var(--grey-600);
}

.geokatalog-content {
  padding: 0 !important;
}

/* Full height when Geokatalog is expanded */
#geokatalog-accordion.expanded {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#geokatalog-accordion.expanded .accordion-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#geokatalog-accordion.expanded .geokatalog-tree {
  flex: 1;
  max-height: none;
}

.geokatalog-tree {
  max-height: 450px;
  overflow-y: auto;
  padding: 0;
}

.geokatalog-tree::-webkit-scrollbar {
  width: 6px;
}

.geokatalog-tree::-webkit-scrollbar-track {
  background: var(--grey-100);
}

.geokatalog-tree::-webkit-scrollbar-thumb {
  background: var(--grey-300);
  border-radius: var(--radius-sm);
}

.catalog-item {
  user-select: none;
}

.catalog-node {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--grey-900);
  border-bottom: 1px solid var(--grey-300);
}

.catalog-node:hover {
  background: var(--grey-100);
}

.catalog-node .node-arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-2);
  color: var(--grey-500);
  position: relative;
}

.catalog-node .node-arrow::after {
  content: '';
  position: absolute;
  inset: -12px;
}

.catalog-node .node-arrow .material-symbols-outlined {
  font-size: var(--icon-sm);
  transition: transform var(--transition-fast);
}

.catalog-node.expanded .node-arrow .material-symbols-outlined {
  transform: rotate(90deg);
}

.catalog-node.leaf .node-arrow {
  display: none;
}

/* Leaf node with checkbox — accent-color inherited from tokens.css base rule */
.catalog-node .node-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  margin-right: var(--space-3);
  flex-shrink: 0;
  cursor: pointer;
}

.catalog-node .node-label {
  flex: 1;
}

.catalog-node .node-info {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-2);
  color: var(--grey-600);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.catalog-node .node-info .material-symbols-outlined {
  font-size: var(--icon-md);
}

.catalog-node .node-info::after {
  content: '';
  position: absolute;
  inset: -12px;
}

.catalog-node .node-info:hover {
  color: var(--grey-900);
}

.catalog-children {
  display: none;
  margin-left: var(--space-5);
}

.catalog-item.expanded > .catalog-children {
  display: block;
}

.geokatalog-loading {
  text-align: center;
  padding: var(--space-5);
  color: var(--grey-500);
}

.geokatalog-error {
  text-align: center;
  padding: var(--space-5);
  color: var(--primary-red);
  font-size: var(--text-xs);
}

/* ===== ACTIVE LAYERS ===== */
.layer-group {
  padding: 0;
}

.layer-group + .layer-group {
  margin-top: var(--space-2);
}

.layer-group-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.active-layers-list {
  padding: 0;
}

.active-layers-empty {
  text-align: center;
  padding: var(--space-4);
  color: var(--grey-500);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

.active-layer-item {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--grey-300);
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--grey-900);
}

.active-layer-item:last-child {
  border-bottom: none;
}

.active-layer-item:hover {
  background: var(--grey-100);
}

.active-layer-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  position: relative;
  border: none;
  background: var(--grey-600);
  cursor: pointer;
  border-radius: var(--radius-full);
  color: var(--white);
  flex-shrink: 0;
  padding: 0;
}

.active-layer-remove::after {
  content: '';
  position: absolute;
  inset: -12px;
}

.active-layer-remove:hover {
  background: var(--grey-800);
}

.active-layer-remove .material-symbols-outlined {
  font-size: var(--icon-xs);
  font-weight: var(--font-semibold);
}

/* accent-color inherited from tokens.css base rule */
.active-layer-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--grey-500);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
}

.active-layer-title {
  flex: 1;
  color: var(--grey-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.active-layer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--grey-500);
  flex-shrink: 0;
  padding: 0;
  transition: background var(--transition-normal), color var(--transition-normal);
}

.active-layer-info:hover {
  background: var(--grey-200);
  color: var(--grey-700);
}

.active-layer-info .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* ===== IDENTIFY POPUP ===== */
.identify-popup {
  font-family: inherit;
}

.identify-popup-header {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--grey-200);
}

.identify-popup-content {
  max-height: 200px;
  overflow-y: auto;
}

.identify-prop {
  font-size: var(--text-xs);
  padding: var(--space-1) 0;
  line-height: var(--leading-snug);
}

.identify-prop-key {
  color: var(--grey-500);
  font-weight: var(--font-medium);
}

.identify-prop-value {
  color: var(--grey-800);
}

/* MapLibre popup overrides */
.maplibregl-popup-content {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.maplibregl-popup-close-button {
  font-size: var(--icon-md);
  padding: var(--space-1) var(--space-2);
  color: var(--grey-500);
}

.maplibregl-popup-close-button:hover {
  background: var(--grey-100);
  color: var(--grey-700);
}

#menu-toggle {
  background: var(--grey-900);
  color: var(--white);
  padding: var(--space-2) var(--space-5) var(--space-2) var(--space-3);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-md);
}

#menu-toggle:hover {
  background: var(--grey-800);
}

#menu-toggle .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* ===== INFO PANEL ===== */
#info-panel {
  position: absolute;
  top: var(--space-3);
  right: 60px;
  width: 320px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 500;
  display: none;
}

#info-panel.show {
  display: block;
}

#info-preview-image {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: var(--grey-100);
}

#info-header {
  background: var(--grey-100);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--grey-300);
}

#info-header-title {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

#info-header-actions {
  display: flex;
  gap: var(--space-2);
}

#info-header-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-600);
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#info-header-actions button:hover {
  color: var(--grey-900);
}

#info-header-actions .material-symbols-outlined {
  font-size: var(--icon-lg);
}

#info-body {
  padding: var(--space-4);
}

.info-row {
  display: flex;
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}

.info-label {
  color: var(--grey-600);
  width: 120px;
  flex-shrink: 0;
}

.info-value {
  color: var(--grey-900);
}

.info-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--grey-100);
}

.info-detail-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--grey-900);
  color: var(--white);
  text-decoration: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: background var(--transition-normal);
  cursor: pointer;
  border: none;
  width: 100%;
}

.info-detail-link:hover {
  background: var(--grey-800);
}

.info-detail-link .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* Hide secondary info rows and preview image on short viewports
   to ensure the "Details anzeigen" button is always visible */
@media (max-height: 800px) {
  #info-preview-image {
    display: none;
  }

  .info-row-secondary {
    display: none;
  }
}

/* ===== FOOTER ===== */
#footer {
  background: var(--grey-100);
  padding: var(--space-1) var(--space-4);
  font-size: var(--text-xs);
  color: var(--grey-600);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#coordinates {
  font-family: monospace;
}

#footer-links a {
  color: var(--interactive-blue);
  text-decoration: none;
  margin-left: var(--space-4);
}

#footer-links a:hover {
  text-decoration: underline;
}

/* MapLibre Controls */
.maplibregl-ctrl-top-right {
  top: var(--space-3);
  right: var(--space-3);
}

/* Home Button Control - matches MapLibre default control size for visual consistency */
.map-home-btn {
  background: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  width: 29px;
  height: 29px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.map-home-btn:hover {
  background: var(--grey-100);
}

.map-home-btn .material-symbols-outlined {
  font-size: var(--icon-md);
  color: var(--grey-600);
}

.map-3d-btn {
  width: 29px;
  height: 29px;
  border: none;
  background: var(--white);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--grey-600);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.map-3d-btn:hover {
  background: var(--grey-100);
}

.map-3d-btn.active {
  color: var(--primary-red);
}

/* ===== STYLE SWITCHER (in #map-view, bottom-right) ===== */
.style-switcher {
  position: absolute;
  bottom: 40px;
  right: 20px;
  z-index: 500;
  display: none;
  transition: right var(--transition-slow);
}

.style-switcher.visible {
  display: block;
}

.style-switcher-btn {
  background: var(--white);
  border: 2px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.style-switcher-btn:hover {
  border-color: var(--grey-500);
  box-shadow: var(--shadow-lg);
}

.style-switcher-btn.active {
  border-color: var(--primary-red);
  background: var(--grey-100);
}

.style-switcher-btn img {
  width: 80px;
  height: 60px;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.style-switcher-btn span {
  font-size: var(--text-xs);
  color: var(--grey-600);
  font-weight: var(--font-medium);
}

.style-switcher-panel {
  position: absolute;
  bottom: 0;
  right: 100%;
  margin-right: var(--space-3);
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  display: flex;
  gap: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: opacity var(--transition-slow), transform var(--transition-slow), visibility var(--transition-slow);
}

.style-switcher-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.style-option {
  background: var(--white);
  border: 2px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  transition: border-color var(--transition-normal), transform var(--transition-fast);
}

@media (hover: hover) {
  .style-option:hover {
    border-color: var(--grey-500);
    transform: translateY(-2px);
  }
}

.style-option.active {
  border-color: var(--primary-red);
  border-width: 3px;
  padding: 3px;
}

.style-option img {
  width: 70px;
  height: 50px;
  aspect-ratio: 7/5;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.style-option span {
  font-size: var(--text-xs);
  color: var(--grey-600);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.style-option.active span {
  color: var(--primary-red);
  font-weight: var(--font-semibold);
}

/* ===== TAB CONTENT SWITCHING ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== DETAIL TABLE (shared styles for Bemessungen & Dokumente) ===== */
.detail-table-container {
  max-width: 1500px;
  margin: 0 auto;
}

/* Detail Table Toolbar - extends .toolbar */
.detail-table-actions {
  gap: var(--space-3);
}

.btn-action {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--grey-600);
  border-radius: var(--radius-sm);
  transition: background var(--transition-normal), color var(--transition-normal);
}

.btn-action:hover:not(:disabled) {
  background: var(--grey-100);
  color: var(--grey-900);
}

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

.btn-action .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* Detail Table Base */
.detail-table-wrapper {
  overflow-x: auto;
  padding: var(--space-5);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: var(--text-sm);
}

.detail-table th {
  background: var(--white);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-medium);
  color: var(--grey-600);
  border-bottom: 1px solid var(--grey-300);
  white-space: nowrap;
}

.detail-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.detail-table th.sortable:hover {
  background: var(--grey-50);
}

.detail-table th .sort-icon {
  font-size: var(--icon-sm);
  vertical-align: middle;
  margin-left: var(--space-1);
}

.detail-table td {
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-900);
}

.detail-table tbody tr:hover {
  background: var(--grey-50);
}

.detail-table tbody tr.selected {
  background: var(--status-planning-bg);
}

.detail-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ===== SHARED DETAIL TABLE COLUMN STYLES ===== */

/* Checkbox column: fixed width, centered */
.detail-table .col-checkbox {
  width: 48px;
  text-align: center;
}

/* ID columns: fixed width for all tables */
.detail-table .col-id,
.detail-table .col-parcel-id,
.detail-table .col-contact-id,
.detail-table .col-cost-id,
.detail-table .col-contract-id,
.detail-table .col-asset-id {
  width: 150px;
  min-width: 120px;
  max-width: 180px;
  word-break: break-all;
  font-size: var(--text-xs);
  color: var(--grey-600);
}

/* All other columns use auto width by default */

/* ===== CATEGORY BADGE ===== */
.kategorie-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: rgba(107, 116, 124, 0.1);
  color: var(--accent-panel);
}

/* ===== FILTER PANE ===== */
/* ===== SMART DRAWER ===== */
#filter-panel {
  position: relative;
  width: 0;
  min-width: 0;
  height: 100%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  flex-shrink: 0;
}

/* Disable transitions during resize for smooth dragging */
#filter-panel.resizing {
  transition: none;
}

#filter-panel.open {
  width: var(--drawer-width);
  min-width: var(--drawer-min-width);
  max-width: var(--drawer-max-width);
  border-left: 1px solid var(--grey-300);
}

.filter-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background var(--transition-fast);
}

.filter-panel-resize-handle:hover,
.filter-panel-resize-handle.dragging {
  background: var(--interactive-blue);
}

#filter-panel:not(.open) .filter-panel-resize-handle {
  display: none;
}

/* .filter-panel-header extends .panel-header from tokens.css — add class="panel-header" in HTML */
.filter-panel-header {
  flex-shrink: 0;
  gap: var(--space-3);
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
}

.filter-panel-title .material-symbols-outlined {
  font-size: var(--icon-sm);
  color: var(--grey-600);
}

.filter-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-panel-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-600);
  border-radius: var(--radius-sm);
  transition: background var(--transition-normal);
}

.filter-panel-btn:hover {
  background: var(--grey-200);
}

.filter-panel-btn .material-symbols-outlined {
  font-size: var(--icon-lg);
}

.filter-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--grey-200);
}

.filter-search .material-symbols-outlined {
  font-size: var(--icon-sm);
  color: var(--grey-400);
}

.filter-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--text-sm);
  background: transparent;
}

.filter-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Filter sections (accordion inside drawer) */
.filter-section {
  border-bottom: 1px solid var(--grey-200);
}

.filter-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  background: var(--white);
  transition: background var(--transition-normal);
}

.filter-section-header:hover {
  background: var(--grey-50);
}

.filter-section-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

.filter-section-arrow {
  display: flex;
  align-items: center;
  transition: transform var(--transition-normal);
}

.filter-section-arrow .material-symbols-outlined {
  font-size: var(--icon-lg);
  color: var(--grey-600);
}

.filter-section.open .filter-section-arrow {
  transform: rotate(180deg);
}

.filter-section-content {
  display: none;
  padding: 0 var(--space-5) var(--space-4) var(--space-5);
}

.filter-section.open .filter-section-content {
  display: block;
}

.filter-option {
  display: flex;
  align-items: center;
  padding: var(--space-2) 0;
}

.filter-option input[type="checkbox"] {
  margin-right: var(--space-3);
}

.filter-option label {
  font-size: var(--text-sm);
  color: var(--grey-900);
  cursor: pointer;
  flex: 1;
}

/* Filter button - active filters state */
#filter-panel-btn.has-active-filters {
  background: rgba(204, 0, 0, 0.1);
}

#filter-panel-btn.has-active-filters.panel-open {
  background: var(--accent-panel);
}

/* Filter count badge */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--primary-red);
  color: var(--white);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  margin-left: var(--space-2);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
  max-width: 400px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.toast-container .toast {
  pointer-events: auto;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--grey-400);
  animation: slideIn 0.3s ease-out;
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  will-change: transform, opacity;
}

.toast.hiding {
  opacity: 0;
  transform: translateY(20px);
}

.toast-error {
  border-left-color: var(--status-error);
}

.toast-error .toast-icon {
  color: var(--status-error);
}

.toast-warning {
  border-left-color: var(--status-warning);
}

.toast-warning .toast-icon {
  color: var(--status-warning);
}

.toast-success {
  border-left-color: var(--status-active);
}

.toast-success .toast-icon {
  color: var(--status-active);
}

.toast-info {
  border-left-color: var(--status-planning);
}

.toast-info .toast-icon {
  color: var(--status-planning);
}

.toast-icon {
  flex-shrink: 0;
}

.toast-icon .material-symbols-outlined {
  font-size: var(--icon-xl);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--grey-600);
  line-height: var(--leading-snug);
}

.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  color: var(--grey-400);
  border-radius: var(--radius-sm);
  transition: background var(--transition-normal), color var(--transition-normal);
}

.toast-close:hover {
  background: var(--grey-100);
  color: var(--grey-600);
}

.toast-close .material-symbols-outlined {
  font-size: var(--icon-md);
}

.toast-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.toast-action-btn {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-normal);
}

.toast-action-btn.primary {
  background: var(--grey-900);
  color: var(--white);
  border: none;
}

.toast-action-btn.primary:hover {
  background: var(--grey-700);
}

.toast-action-btn.secondary {
  background: transparent;
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
}

.toast-action-btn.secondary:hover {
  background: var(--grey-100);
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition-slow);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-overlay .loading-spinner {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.loading-overlay .loading-text {
  margin-top: var(--space-5);
  font-size: var(--text-base);
  color: var(--grey-700);
}

/* ===== LAYER INFO MODAL ===== */
.layer-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: var(--space-5);
}

.layer-info-modal.show {
  display: flex;
}

.layer-info-modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  max-height: 80vh;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.layer-info-modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--grey-100);
  border: none;
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--grey-600);
  transition: background var(--transition-normal), color var(--transition-normal);
  z-index: 1;
}

.layer-info-modal-close:hover {
  background: var(--grey-200);
  color: var(--grey-900);
}

.layer-info-modal-close .material-symbols-outlined {
  font-size: var(--icon-md);
}

.layer-info-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.layer-info-loading {
  text-align: center;
  padding: var(--space-8);
  color: var(--grey-500);
}

/* Swisstopo legend styles */
.layer-info-body .legend-container {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.layer-info-body .bod-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  margin: 0 0 var(--space-3) 0;
}

.layer-info-body .legend-abstract {
  color: var(--grey-600);
  margin: 0 0 var(--space-5) 0;
  padding: var(--space-3);
  background: var(--grey-50);
  border-radius: var(--radius-md);
}

.layer-info-body .legend-footer {
  margin-top: var(--space-4);
}

.layer-info-body .legend-footer > span {
  font-weight: var(--font-semibold);
  color: var(--grey-900);
  display: block;
  margin-bottom: var(--space-2);
}

.layer-info-body .img-container {
  background: var(--grey-50);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.layer-info-body .img-container img {
  max-width: 100%;
  height: auto;
}

.layer-info-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.layer-info-body table tr {
  border-bottom: 1px solid var(--grey-200);
}

.layer-info-body table tr:last-child {
  border-bottom: none;
}

.layer-info-body table td {
  padding: var(--space-2) var(--space-3);
  vertical-align: top;
}

.layer-info-body table td:first-child {
  font-weight: var(--font-medium);
  color: var(--grey-700);
  width: 40%;
  padding-left: 0;
}

.layer-info-body table td:last-child {
  color: var(--grey-600);
  padding-right: 0;
}

.layer-info-body table a {
  color: var(--primary-red);
  text-decoration: none;
}

.layer-info-body table a:hover {
  text-decoration: underline;
}

/* Internal layer legend */
.internal-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-3);
}

.internal-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--grey-700);
}

.internal-legend-circle {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.internal-legend-rect {
  width: 20px;
  height: 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ===== MAP CONTEXT MENU ===== */
.map-context-menu {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 1001;
  display: none;
  overflow: hidden;
}

.map-context-menu.show {
  display: block;
}

/* Edge detection classes for flipping menu position */
.map-context-menu.flip-horizontal {
  transform: translateX(-100%);
}

.map-context-menu.flip-vertical {
  transform: translateY(-100%);
}

.map-context-menu.flip-horizontal.flip-vertical {
  transform: translate(-100%, -100%);
}

.context-menu-coords.copied {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}

/* Base styles shared with .dropdown-menu-item */

.context-menu-item:hover {
  background: var(--grey-50);
}

.context-menu-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Measure mode active state */
.context-menu-item.measure-active {
  background: var(--status-planning-bg);
  color: var(--status-planning-text);
}

/* ===== MEASURE DISTANCE DISPLAY ===== */
.measure-distance-display {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  width: 280px;
  z-index: 1000;
  overflow: hidden;
}

.measure-distance-display.show {
  display: flex;
}

.measure-distance-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

.measure-distance-header .material-symbols-outlined {
  font-size: var(--icon-md);
  color: var(--grey-600);
}

.measure-distance-close {
  margin-left: auto;
  background: transparent;
  border: none;
  padding: var(--space-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.measure-distance-close:hover {
  background: var(--grey-200);
}

.measure-distance-close .material-symbols-outlined {
  font-size: var(--icon-sm);
  color: var(--grey-500);
}

.measure-distance-info {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--grey-600);
  border-bottom: 1px solid var(--grey-100);
}

.measure-distance-result {
  padding: var(--space-3) var(--space-4);
}

.measure-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) 0;
}

.measure-result-label {
  font-size: var(--text-sm);
  color: var(--grey-600);
}

.measure-result-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--grey-900);
}

/* Distance labels on map segments */
.measure-label {
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--grey-800);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  pointer-events: none;
}

/* Measure marker styles */
.measure-marker {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--white);
  border: 2px solid var(--grey-900);
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
}

.measure-marker::after {
  content: '';
  position: absolute;
  inset: -17px;
}

.measure-marker:hover {
  transform: scale(1.3);
}

.measure-marker.dragging {
  cursor: grabbing;
}

/* ===== PRINT PANEL ===== */
.print-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  padding: var(--space-3);
}

.print-form-row {
  display: contents;
}

.print-form-row label {
  font-size: var(--text-sm);
  color: var(--grey-700);
  white-space: nowrap;
}

.print-select {
  width: 100%;
}

.print-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--grey-700);
  cursor: pointer;
  grid-column: 1 / -1;
}

/* accent-color inherited from tokens.css base rule */
.print-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.print-btn {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--white);
  background: var(--primary-red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.print-btn:hover {
  background: var(--primary-red-dark);
}

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

.print-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

/* Print progress bar */
.print-progress {
  margin-top: 8px;
}

.print-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2, #e0e0e0);
  border-radius: 3px;
  overflow: hidden;
}

.print-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary, #1976d2);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.print-progress-text {
  font-size: 11px;
  color: var(--text-secondary, #666);
  margin-top: 4px;
}

/* Print preview overlay styles defined earlier */

/* ===== PRINT CONTAINER (injected for printing) ===== */
.print-container {
  display: none;
}

/* Print styles */
@media print {
  body * {
    visibility: hidden;
  }

  .print-container,
  .print-container * {
    visibility: visible !important;
    display: block !important;
  }

  .print-container {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: white;
  }

  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
    margin-bottom: 8px;
  }

  .print-header h1 {
    font-size: 16pt;
    margin: 0;
  }

  .print-header .print-date {
    font-size: 9pt;
    color: #666;
  }

  .print-map-container {
    position: relative;
    border: 1px solid #ccc;
  }

  .print-map-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
  }

  .print-scale-bar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.85);
    padding: 3px 8px;
    font-size: 8pt;
    border-radius: 3px;
    border: 1px solid #ccc;
  }

  .print-north-arrow {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.85);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 14pt;
    font-weight: bold;
    border: 1px solid #ccc;
  }

  .print-legend {
    display: flex !important;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid #ccc;
    margin-top: 8px;
  }

  .print-legend-item {
    display: flex !important;
    align-items: center;
    gap: 4px;
    font-size: 8pt;
  }

  .print-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block !important;
    border: 1px solid #ccc;
  }

  .print-footer {
    display: flex !important;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #ccc;
    margin-top: 8px;
    font-size: 7pt;
    color: #999;
  }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Hide logo title + divider first (keep Swiss coat of arms text) */
@media screen and (max-width: 1800px) {
  #logo-title,
  .logo-divider {
    display: none;
  }
}

/* Small laptop — also hide coat of arms text */
@media screen and (max-width: 1366px) {
  #logo-text-img {
    display: none;
  }

  .header-main {
    gap: var(--space-3);
  }

  #search-area {
    position: static;
    flex: 1;
    min-width: 0;
    pointer-events: auto;
  }

  #search-wrapper {
    max-width: 500px;
    min-width: 200px;
  }

  #header-right {
    min-width: auto;
    gap: var(--space-4);
  }

  .header-btn span:not(.material-symbols-outlined) {
    display: none;
  }

  #info-panel {
    width: 280px;
    right: 10px;
  }

  #info-panel .info-row .info-label {
    font-size: var(--text-xs);
  }

  #info-preview-image {
    height: 120px;
  }
}

@media screen and (max-width: 1200px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-single-col {
    max-width: 100%;
  }

  #accordion-panel {
    width: 260px;
  }


  #info-panel {
    width: 260px;
  }

  .accordion-header {
    font-size: var(--text-xs);
    padding: var(--space-3) var(--space-4);
  }
}

/* Short viewport: reduce table panel default height */
@media screen and (max-height: 900px) {
  .table-panel {
    height: 30vh;
  }
}

@media screen and (max-height: 700px) {
  .table-panel {
    height: 25vh;
  }

  .carousel {
    height: 240px;
  }
}

@media screen and (max-height: 600px) {
  .table-panel {
    height: 20vh;
  }
}

/* Tablet breakpoint (768px - 1024px) */
@media screen and (max-width: 1024px) {
  /* Override layout height variables for tablet */
  :root {
    --header-main-height: 70px;
    --header-detail-height: 100px;
    --footer-height: 30px;
  }

  .header-main {
    padding: 0 16px;
    height: var(--header-main-height);
  }

  #logo-text-img,
  .logo-divider,
  #logo-title {
    display: none;
  }

  #search-area {
    padding: 0 16px;
    gap: var(--space-3);
  }

  #search-wrapper {
    max-width: 320px;
  }

  #search-area {
    position: static;
    flex: 1;
    min-width: 0;
  }

  .header-main {
    gap: var(--space-3);
  }

  #header-right {
    min-width: auto;
    gap: var(--space-4);
  }

  #filter-panel.open {
    width: 340px;
    min-width: 340px;
  }

  #info-panel {
    width: 280px;
    right: 10px;
  }

  .detail-grid {
    gap: var(--space-4);
  }

  .toolbar-search,
  .list-toolbar-search {
    min-width: auto;
  }

  /* Smart-drawer fixed positioning for tablet - uses overridden CSS variables */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-4);
    padding: var(--space-4);
  }

  #gallery-view {
    padding: var(--space-4);
  }
}

/* Mobile breakpoint (< 768px) */
@media screen and (max-width: 767px) {
  /* === COMPACT SINGLE-ROW HEADER === */
  .header-main {
    flex-wrap: nowrap;
    height: 48px;
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }

  #logo-area {
    flex-shrink: 0;
  }

  /* Hide logo text, divider, title — keep only flag */
  #logo-text-img, .logo-divider, #logo-title {
    display: none;
  }

  /* Search fills available space between flag and buttons */
  #search-area {
    position: static;
    flex: 1;
    min-width: 0;
    padding: 0;
    pointer-events: auto;
    gap: var(--space-2);
  }

  #search-wrapper {
    max-width: 100%;
    flex: 1;
    min-width: 0;
  }

  #search-results {
    max-height: 60vh;
  }

  /* View toggle moves into the button row — compact icon-only */
  .view-toggle {
    flex-shrink: 0;
  }

  .view-toggle-btn {
    padding: var(--space-2);
    min-width: 36px;
    height: 36px;
    justify-content: center;
  }

  .view-toggle-btn .view-label {
    display: none !important;
  }

  /* Header-right: icon-only buttons */
  #header-right {
    order: unset;
    min-width: auto;
    gap: var(--space-2);
    margin-left: 0;
  }

  .header-btn span:not(.material-symbols-outlined) {
    display: none;
  }

  .header-btn {
    padding: var(--space-2);
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  /* === FOOTER: hide on mobile — map attribution is on the map itself === */
  #footer {
    display: none;
  }

  /* Hide resize handles on mobile — panels are fixed-size */
  .filter-panel-resize-handle,
  .tbl-resize-handle {
    display: none;
  }

  /* Smart drawer - full screen on mobile */
  #filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    min-width: 100% !important;
    z-index: 2000;
    border-left: none;
  }

  #filter-panel:not(.open) {
    display: none;
  }


  #info-preview-image {
    display: none !important;
  }

  /* Info panel - full width bottom sheet on mobile, above accordion */
  #info-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 50vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow-y: auto;
    z-index: 600;
  }

  /* Style switcher position on mobile */
  .style-switcher {
    bottom: 40px;
    right: var(--space-3);
  }

  .style-switcher-panel {
    right: 0;
    bottom: 100%;
    margin-bottom: var(--space-3);
    margin-right: 0;
    flex-direction: column;
  }

  /* Table tabs: allow horizontal scroll on mobile */
  .table-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-tab {
    white-space: nowrap;
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
  }

  /* List view adjustments */
  .toolbar {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .toolbar-search {
    width: 100%;
    min-width: auto;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .list-table {
    font-size: var(--text-xs);
  }

  .list-table th,
  .list-table td {
    padding: var(--space-3) var(--space-2);
  }

  /* Hide some columns on mobile */
  .list-table .col-adresse,
  .list-table .col-portfolio {
    display: none;
  }

  /* View toggle adjustments */
  .view-toggle {
    flex-shrink: 0;
  }

  .view-toggle-btn {
    padding: var(--space-2) var(--space-3);
  }

  .view-toggle-btn .view-label {
    display: none !important;
  }

  /* Gallery view adjustments */
  #gallery-view {
    padding: var(--space-3);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .gallery-card {
    display: flex;
    flex-direction: row;
  }

  .gallery-image {
    width: 120px;
    height: auto;
    min-height: 120px;
    flex-shrink: 0;
  }

  .gallery-content {
    flex: 1;
    padding: var(--space-3);
  }

  .gallery-title {
    font-size: var(--text-sm);
  }

  .gallery-subtitle {
    font-size: var(--text-xs);
    margin-bottom: var(--space-2);
  }

  .gallery-meta {
    margin-bottom: var(--space-2);
  }

  .gallery-tag {
    font-size: var(--text-xs);
    padding: 2px 6px;
  }

  /* Detail view adjustments */
  .detail-header {
    padding: var(--space-3) var(--space-4);
  }

  .detail-header-inner {
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }

  .breadcrumb {
    font-size: var(--text-xs);
    flex-wrap: wrap;
  }

  .detail-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .detail-tabs {
    padding: 0 16px;
    overflow-x: auto;
  }

  .detail-tabs-inner {
    min-width: max-content;
  }

  .detail-tabs::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, var(--white));
    pointer-events: none;
    z-index: 1;
  }

  .detail-tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    white-space: nowrap;
  }

  #detail-view {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .detail-content {
    padding: var(--space-3);
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Stack label above value on mobile instead of side-by-side */
  .detail-grid-row {
    grid-template-columns: 1fr 24px;
    gap: 0 var(--space-2);
  }

  .detail-label {
    font-size: var(--text-xs);
    grid-column: 1;
  }

  .detail-value {
    font-size: var(--text-sm);
    grid-column: 1;
    word-break: break-word;
  }

  .info-icon {
    grid-row: 1 / 3;
    grid-column: 2;
    align-self: center;
  }

  .detail-overline {
    font-size: 10px;
    padding: var(--space-2);
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .carousel {
    height: 200px;
  }

  .mini-map-container {
    height: 200px;
  }

  .address-table {
    font-size: var(--text-xs);
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .address-table th,
  .address-table td {
    padding: var(--space-2) var(--space-1);
    white-space: nowrap;
  }

  /* Pagination adjustments */
  .pagination-footer {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .pagination-info {
    flex-basis: 100%;
  }

  .pagination-rows {
    order: -1;
  }

}

/* Lightbox responsive */
@media screen and (max-width: 767px) {
  .lightbox-nav {
    width: 36px;
    height: 36px;
  }

  .lightbox-prev { left: var(--space-2); }
  .lightbox-next { right: var(--space-2); }

  .lightbox-nav .material-symbols-outlined {
    font-size: 24px;
  }

  .lightbox-toolbar {
    padding: var(--space-2) var(--space-3);
  }

  .lightbox-image {
    max-width: 95vw;
    max-height: 80vh;
  }
}

/* Small mobile (< 480px) */
@media screen and (max-width: 479px) {
  #info-preview-image {
    height: 80px;
  }

  /* Even more compact header buttons on tiny screens */
  .header-btn {
    width: 32px;
    height: 32px;
  }

  .view-toggle-btn {
    min-width: 32px;
    height: 32px;
  }

  .gallery-image {
    width: 100px;
    min-height: 100px;
  }

  .detail-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .dropdown-menu {
    min-width: 0;
    max-width: calc(100vw - 32px);
  }

  .columns-dropdown {
    min-width: 0;
    width: calc(100vw - 32px);
    max-width: 320px;
  }
}

/* ===== MOBILE HAMBURGER MENU ===== */
/* Hidden on desktop */
.hamburger-btn {
  display: none;
}

.mobile-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 3000;
}

.mobile-menu-backdrop.active {
  display: block;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--white);
  z-index: 3001;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--grey-200);
}

.mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--grey-600);
  border-radius: var(--radius-sm);
}

.mobile-menu-close:hover {
  background: var(--grey-100);
}

.mobile-menu-body {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--text-sm);
  color: var(--grey-800);
  cursor: pointer;
  margin-bottom: var(--space-2);
}

.mobile-menu-item:hover {
  background: var(--grey-50);
}

.mobile-menu-item .mobile-menu-arrow {
  margin-left: auto;
  color: var(--grey-400);
  font-size: var(--icon-sm);
}

.mobile-menu-lang {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}

.mobile-menu-lang > .material-symbols-outlined {
  color: var(--grey-500);
}

.mobile-lang-pills {
  display: flex;
  gap: var(--space-1);
}

.mobile-lang-pill {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--grey-600);
  cursor: pointer;
  min-width: 36px;
  text-align: center;
}

.mobile-lang-pill.active {
  background: var(--grey-900);
  color: var(--white);
  border-color: var(--grey-900);
}

/* View toggle in mobile menu */
.mobile-menu-view-toggle {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.mobile-view-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: var(--text-sm);
  color: var(--grey-600);
  cursor: pointer;
}

.mobile-view-btn.active {
  background: var(--grey-900);
  color: var(--white);
  border-color: var(--grey-900);
}

.mobile-view-btn .material-symbols-outlined {
  font-size: var(--icon-md);
}

.mobile-external-empty {
  font-size: var(--text-xs);
  color: var(--grey-500);
  padding: var(--space-2) var(--space-1);
  font-style: italic;
}

.mobile-external-layers-list .mobile-layer-item {
  padding: var(--space-2) var(--space-1);
}

.mobile-menu-divider {
  height: 1px;
  background: var(--grey-200);
  margin: var(--space-3) 0;
}

/* Layer section inside mobile menu */
.mobile-layers-group-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--grey-500);
  padding: var(--space-2) var(--space-1);
}

.mobile-layer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-1);
}

.mobile-layer-item input[type="checkbox"] {
  accent-color: var(--primary-red);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mobile-layer-item .mobile-layer-title {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--grey-800);
}

.mobile-layer-item .mobile-layer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--grey-400);
  border-radius: var(--radius-sm);
}

.mobile-layer-item .mobile-layer-info:hover {
  color: var(--grey-700);
}

/* Accordion items in mobile menu */
.mobile-accordion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-1);
  cursor: pointer;
  color: var(--grey-800);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.mobile-accordion-item:hover {
  background: var(--grey-50);
}

.mobile-accordion-item .material-symbols-outlined {
  color: var(--grey-500);
  font-size: var(--icon-md);
}

/* Footer links in mobile menu */
.mobile-menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-1);
}

.mobile-menu-links a {
  font-size: var(--text-xs);
  color: var(--interactive-blue);
  text-decoration: none;
}

.mobile-menu-links a:hover {
  text-decoration: underline;
}

@media screen and (max-width: 767px) {
  /* Show hamburger, hide desktop header-right */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--grey-700);
    flex-shrink: 0;
  }

  #header-right,
  #search-area .view-toggle {
    display: none !important;
  }

  /* Collapse map attribution by default on mobile — just show ⓘ toggle */
  .maplibregl-ctrl-attrib:not(.maplibregl-compact) {
    display: none;
  }

  .maplibregl-ctrl-attrib.maplibregl-compact {
    min-height: 24px;
  }

  .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {
    display: none;
  }

  .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-ctrl-attrib-open .maplibregl-ctrl-attrib-inner {
    display: block;
  }

  /* Table panel and toggle — not usable on mobile */
  .table-panel,
  .tbl-toggle {
    display: none !important;
  }

  /* Mobile menu becomes visible (but off-screen by default) */
  .mobile-menu {
    display: flex;
  }

  /* Hide accordion wrapper on mobile — replaced by hamburger menu */
  #accordion-wrapper {
    display: none !important;
  }
}

/* Responsive toast */
@media screen and (max-width: 767px) {
  .toast-container {
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: none;
  }
}

/* Responsive layer info modal */
@media screen and (max-width: 767px) {
  .layer-info-modal {
    padding: var(--space-3);
  }

  .layer-info-modal-content {
    max-height: 90vh;
  }

  .layer-info-body {
    padding: var(--space-4);
  }
}
