/* ============================================================
   PAGE VIEWS
   ============================================================ */
body,
.map-view,
.leaflet-container {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.map-view {
    position: fixed;
    inset: 0;
    z-index: 1040;
    overflow: hidden;
    background: #ffffff;
}

.map-view[hidden] {
    display: none !important;
}

.map-body {
    background-color: #ECF0FF;
}

.map-controls {
    z-index: 100010;
}

#indoorView {
    --map-bottom-offset: 0px;
}

/* If this page has a fixed bottom nav bar on phones, set its height here (e.g. 68px) */
@media (max-width: 575.98px) {
    #indoorView {
        --map-bottom-offset: 0px;
    }

    #indoorView .location-breadcrumb {
        top: 32px;
        left: 50%;
        max-width: calc(100vw - 112px);
        white-space: nowrap;
        transform: translate(-50%, -50%);
    }

    #indoorView .map-back-btn {
        left: 8px;
        right: auto;
    }

    #indoorView .map-close-btn {
        left: auto;
        right: 8px;
    }

    #indoorView .map-zoom-in-btn {
        right: 8px;
        bottom: calc(196px + var(--map-bottom-offset));
    }

    #indoorView .map-zoom-out-btn {
        right: 8px;
        bottom: calc(140px + var(--map-bottom-offset));
    }

    #indoorView .map-search-btn {
        left: 8px;
        right: 8px;
        bottom: calc(8px + var(--map-bottom-offset));
    }
}

/* ============================================================
   INDOOR MAP CONTROLS
   ============================================================ */

#indoorView .map-close-btn,
#indoorView .map-back-btn,
#indoorView .map-maximize-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    z-index: 100010;
}

#indoorView .map-back-btn,
#indoorView .map-maximize-btn {
    left: 8px;
}

#indoorView .map-close-btn svg,
#indoorView .map-back-btn svg,
#indoorView .map-maximize-btn svg {
    display: block;
    width: 64px;
    height: 64px;
    margin: -4px 0 0 -12px;
}

#indoorView .map-zoom-in-btn,
#indoorView .map-zoom-out-btn {
    position: absolute;
    right: 8px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    z-index: 100010;
}

#indoorView .map-zoom-in-btn svg,
#indoorView .map-zoom-out-btn svg {
    display: block;
    width: 64px;
    height: 64px;
    margin: -4px 0 0 -12px;
}

#indoorView .map-zoom-out-btn {
    bottom: calc(140px + var(--map-bottom-offset));
}

#indoorView .map-zoom-in-btn {
    bottom: calc(196px + var(--map-bottom-offset));
}

#indoorView .map-search-btn {
    position: absolute;
    bottom: calc(8px + var(--map-bottom-offset));
    left: 8px;
    right: 8px;
    height: 68px;
    padding: 16px;
    border-radius: 36px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    box-sizing: border-box;
    cursor: pointer;
    z-index: 100010;
}

#indoorView .map-search-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    border-radius: 18px;
    background-color: #F1F2F6;
    padding: 10px;
    box-sizing: border-box;
}

#indoorView .map-search-placeholder {
    color: #8B8B8F;
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
}

#indoorView .map-search-placeholder.has-text {
    color: #000000;
}

#indoorView .map-search-clear {
    display: none;
    position: absolute;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 1;
}

#indoorView .map-search-clear.show {
    display: block;
}

#indoorView .map-search-badge {
    position: absolute;
    bottom: calc(84px + var(--map-bottom-offset));
    right: 8px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    z-index: 100010;
    pointer-events: none;
}

#indoorView .map-search-badge svg {
    display: block;
    width: 64px;
    height: 64px;
    margin: -4px 0 0 -12px;
}

#indoorView .location-breadcrumb {
    position: absolute;
    top: 32px;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

#indoorView .location-breadcrumb .breadcrumb-segment {
    color: #000000;
    font-weight: 400;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

/* ============================================================
   INDOOR SVG MAP
   ============================================================ */

#map-container {
    position: relative;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    user-select: none;
}

#map-container.dragging {
    cursor: grabbing;
}

#map-container svg {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

#map-container > svg {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

#map-container.map-loading > svg {
    visibility: hidden;
}

.map-status-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.room-label {
    font-family: inherit;
    fill: #212529;
    font-size: 14px;
    font-weight: 600;
}

.room-label-name {
    font-size: 9px;
    font-weight: 400;
    fill: #555;
}

/* ============================================================
   BOTTOM SHEET MODALS (building, floor, room detail, search)
   ============================================================ */

#buildingChoiceModal .modal-body,
#floorChoiceModal .modal-body {
    overflow-y: auto;
}

#buildingChoiceModal,
#floorChoiceModal,
#roomDetailModal,
#searchModal {
    z-index: 100020;
}

#roomDetailModal .modal-dialog,
#floorChoiceModal .modal-dialog,
#buildingChoiceModal .modal-dialog,
#searchModal .modal-dialog {
    position: fixed;
    bottom: 8px;
    left: 8px;
    right: 8px;
    margin: 0;
    max-width: calc(100% - 16px);
}

@media (min-width: 576px) {

    #roomDetailModal .modal-dialog,
    #floorChoiceModal .modal-dialog,
    #buildingChoiceModal .modal-dialog,
    #searchModal .modal-dialog {
        left: 50%;
        right: auto;
        width: 100%;
        max-width: 700px;
        margin-left: -350px;
    }

    #indoorView .map-search-btn {
        left: 50%;
        right: auto;
        width: calc(100% - 16px);
        max-width: 700px;
        margin-left: -350px;
    }

    #indoorView .location-breadcrumb {
        left: 50%;
        margin-left: 0;
        transform: translate(-50%, -50%);
    }
}

#roomDetailModal.modal.fade .modal-dialog,
#floorChoiceModal.modal.fade .modal-dialog,
#buildingChoiceModal.modal.fade .modal-dialog,
#searchModal.modal.fade .modal-dialog {
    transform: translateY(calc(100% + 16px));
    transition: transform 0.3s ease-in-out;
}

#roomDetailModal.modal.show .modal-dialog,
#floorChoiceModal.modal.show .modal-dialog,
#buildingChoiceModal.modal.show .modal-dialog,
#searchModal.modal.show .modal-dialog {
    transform: translateY(0);
}

#roomDetailModal .modal-content,
#floorChoiceModal .modal-content,
#buildingChoiceModal .modal-content,
#searchModal .modal-content {
    border-radius: 36px;
    border: 1px solid #FFFFFF;
    background-color: #F1F2F6;
    max-height: 70vh;
}

#roomDetailModal .room-detail-close-btn,
#floorChoiceModal .room-detail-close-btn,
#buildingChoiceModal .room-detail-close-btn,
#searchModal .room-detail-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    z-index: 1;
}

#roomDetailModal .room-detail-close-btn svg,
#floorChoiceModal .room-detail-close-btn svg,
#buildingChoiceModal .room-detail-close-btn svg,
#searchModal .room-detail-close-btn svg,
#campusSearchModal .room-detail-close-btn svg {
    display: block;
    width: 58px;
    height: 58px;
    margin: -4px 0 0 -12px;
}

#roomDetailModal .modal-title,
#floorChoiceModal .modal-title,
#buildingChoiceModal .modal-title {
    font-weight: 600;
    font-size: 20px;
    color: #000000;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-word;
}

#roomDetailModal .modal-body,
#floorChoiceModal .modal-body,
#buildingChoiceModal .modal-body,
#searchModal .modal-body {
    padding-top: 0;
}

#search-result-pin svg {
    display: block;
}
/* Room detail */

#roomDetailModal .modal-header {
    padding-top: 66px;
    padding-bottom: 0;
    justify-content: center;
}

#roomDetailModal .room-detail-name {
    text-align: center;
    color: #8B8B8F;
    font-weight: 500;
    font-size: 16px;
    padding: 0 16px;
    overflow-wrap: break-word;
    word-break: break-word;
}

#roomDetailModal .room-detail-location-card {
    background-color: #FFFFFF;
    border-radius: 24px;
    padding: 16px;
    margin-top: 32px;
    margin-bottom: 16px;
}

#roomDetailModal .room-detail-location-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

#roomDetailModal .room-detail-location-divider {
    height: 1px;
    background-color: #EBECF0;
    margin: 16px 0;
}

#roomDetailModal .room-detail-location-label {
    color: #8B8B8F;
    font-weight: 400;
    font-size: 16px;
    flex-shrink: 0;
}

#roomDetailModal .room-detail-location-value {
    color: #000000;
    font-weight: 400;
    font-size: 16px;
    text-align: right;
}

#roomDetailModal .room-detail-info-card:empty {
    display: none;
}

/* Building / floor choice */

#floorChoiceModal .modal-header,
#buildingChoiceModal .modal-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
}

#floorChoiceModal .modal-content,
#buildingChoiceModal .modal-content {
    max-height: 86.5vh;
}

#floorChoiceModal .choice-card,
#buildingChoiceModal .choice-card {
    background-color: #FFFFFF;
    border-radius: 24px;
    padding: 8px 16px;
    max-height: calc(86.5vh - 140px);
    overflow-y: auto;
    box-sizing: border-box;
    margin-top: 24px;
    margin-bottom: 16px;
}

#floorChoiceModal .choice-row,
#buildingChoiceModal .choice-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 400;
    color: #000000;
    cursor: pointer;
}

#floorChoiceModal .choice-row.active,
#buildingChoiceModal .choice-row.active {
    font-weight: 600;
}

#floorChoiceModal .choice-divider,
#buildingChoiceModal .choice-divider {
    height: 1px;
    background-color: #EBECF0;
}

/* Search */

#searchModal .modal-dialog {
    top: 8px;
}

#searchModal .modal-content {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#searchModal .modal-header {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
}

#searchModal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 16px;
}

#searchModal .search-modal-input {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    margin: 16px 74px 16px 16px;
    padding-left: 13px;
    height: 42px;
    border-radius: 21px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

#searchModal .search-modal-input-field {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #000000;
    flex: 1 1 auto;
    min-width: 0;
}

#searchModal .search-modal-input-field::placeholder {
    color: #8B8B8F;
    font-weight: 500;
}

#searchModal .search-modal-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px 16px 16px;
}

#searchModal .search-filter-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 13px;
    border-radius: 21px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    cursor: pointer;
}

#searchModal .search-filter-chip.has-selection {
    background-color: #ECF0FF;
}

#searchModal .search-filter-chip.has-selection .search-filter-placeholder {
    color: #000000;
}

#searchModal .search-filter-chip.has-selection svg path {
    stroke: #000000;
}

#searchModal .search-filter-placeholder {
    color: #8B8B8F;
    font-weight: 400;
    font-size: 12px;
    white-space: nowrap;
}

#searchModal .school-filter-popover {
    position: absolute;
    width: 210px;
    max-height: 400px;
    padding: 16px;
    background-color: #F6F7F9;
    border: 1px solid #FFFFFF;
    border-radius: 21px;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    z-index: 100025;
    flex-direction: column;
    gap: 12px;
    display: none;
    overflow: scroll;
}

#searchModal .school-filter-popover.show {
    display: flex;
}

#searchModal .school-filter-popover-title {
    font-size: 16px;
    font-weight: 500;
    color: #000000;
}

#searchModal .school-filter-divider {
    height: 1px;
    background-color: #EBECF0;
    width: 100%;
    flex-shrink: 0;
}

#searchModal .school-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#searchModal .school-filter-row-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    visibility: hidden;
}

#searchModal .school-filter-row.active .school-filter-row-check {
    visibility: visible;
}

#searchModal .school-filter-row-label {
    font-size: 16px;
    font-weight: 400;
    color: #000000;
}

#searchModal .search-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

#searchModal .search-result-card {
    background-color: #FEFFFF;
    border-radius: 24px;
    padding: 16px;
    box-sizing: border-box;
    cursor: pointer;
}

#searchModal .search-result-title {
    font-size: 16px;
    font-weight: 500;
    color: #000000;
}

#searchModal .search-result-name {
    font-size: 12px;
    font-weight: 400;
    color: #8B8B8F;
}

#searchModal .search-result-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

#searchModal .search-result-tag {
    border-radius: 21px;
    padding: 10px;
    font-size: 12px;
    font-weight: 400;
    color: #000000;
    box-sizing: border-box;
}

#searchModal .search-result-tag-school {
    background-color: #EEEEEF;
}

#searchModal .search-empty-text {
    text-align: center;
    color: #8B8B8F;
    font-weight: 400;
    font-size: 14px;
    padding: 32px 16px;
}

/* ============================================================
   OUTER CAMPUS MAP
   ============================================================ */

.campus-map-layout {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Хичээлийн байрны marker */

.campus-building-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.campus-building-icon {
    width: 42px;
    height: 42px;
    background: white;
    border-radius: 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #172b85;
    border: 2px solid white;
}

.campus-building-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid white;
    margin-top: -3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

/* Оюутны байрны marker - дугуй тоо + доор нь жижиг нэр */

.dorm-map-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 130px;
    cursor: pointer;
}

.dorm-map-marker-number {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
    box-sizing: border-box;
}

.dorm-map-marker-number::after {
    content: '';
    position: absolute;
    margin-top: 42px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid currentColor;
    filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .15));
}

.dorm-map-marker-label {
    margin-top: 6px;
    padding: 4px 10px;
    max-width: 125px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(255, 255, 255, .96);
    border-radius: 12px;
    color: #172b85;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    border: 1px solid rgba(23, 43, 133, .15);
}

/* Оюутны байрны popup: building/floor picker-тэй ижил загвар */

.dorm-map-popup {
    position: relative;
    width: 420px;
    max-width: min(420px, 80vw);
    background-color: #F1F2F6;
    border: 1px solid #FFFFFF;
    border-radius: 36px;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    overflow: hidden;
}

.dorm-map-popup-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 74px;    /* хаах товчтой давхцахгүй */
}

.dorm-map-popup-title {
    font-size: 16px;
    font-weight: 500;
    color: #000000;
    text-align: center;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.dorm-map-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    z-index: 1;
}

.dorm-map-popup-close svg {
    display: block;
    width: 58px;
    height: 58px;
    margin: -4px 0 0 -12px;
}

.dorm-map-popup-card {
    position: relative;
    margin: 0 16px 16px;
}

.dorm-map-popup-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    border-radius: 24px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Loading: зураг ачаалагдаж байх үед */
.dorm-map-popup-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 240px;
    border-radius: 24px;
    background-color: #E8E9EE;
    color: #8B8B8F;
    font-size: 14px;
    font-weight: 400;
}

.dorm-map-popup-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #D1D3D9;
    border-top-color: #8B8B8F;
    border-radius: 50%;
    animation: dorm-popup-spin 0.8s linear infinite;
}

@keyframes dorm-popup-spin {
    to { transform: rotate(360deg); }
}

.dorm-map-popup-card.is-loading .dorm-map-popup-loader {
    display: flex;
}

.dorm-map-popup-card.is-loading .dorm-map-popup-image {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

/* Error: зураг олдсонгүй */
.dorm-map-popup-fallback {
    display: none;
    padding: 24px 8px;
    text-align: center;
    color: #8B8B8F;
    font-size: 14px;
    font-weight: 400;
}

.dorm-map-popup-card.has-error .dorm-map-popup-image {
    display: none;
}

.dorm-map-popup-card.has-error .dorm-map-popup-fallback {
    display: block;
}

/* Remove Leaflet's default popup box, tip and spacing */
.dorm-map-popup-wrapper .leaflet-popup-content-wrapper {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}

.dorm-map-popup-wrapper .leaflet-popup-content {
    margin: 0;
    width: auto !important;
    line-height: normal;
}

.dorm-map-popup-wrapper .leaflet-popup-tip-container {
    display: none;
}

#map-container.map-loading svg {
    visibility: hidden;
}

/* ============================================================
   OUTER MAP — building panel (same style as pickers)
   ============================================================ */

#campusLocationMap {
    position: absolute;
    inset: 0;
    background: #e5e5e5;
    z-index: 1;
}

.campus-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 300px;
    display: flex;
    flex-direction: column;
    background-color: #FAFAFB;
    box-sizing: border-box;
    overflow: hidden;
    z-index: 1000;
}

.campus-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 32px 16px 16px;
}

.campus-sidebar-image {
    height: 70px;
    object-fit: contain;
    flex-shrink: 0;
}

.campus-panel-heading {
    color: #000000;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

.campus-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 16px 16px;
}

/* Sidebar scrollbar: thin, light gray */
.campus-panel-body::-webkit-scrollbar {
    width: 6px;
}

.campus-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.campus-panel-body::-webkit-scrollbar-thumb {
    background-color: #D1D3D9;
    border-radius: 3px;
}

.campus-panel-body::-webkit-scrollbar-thumb:hover {
    background-color: #B0B3BB;
}

/* Firefox */
@supports not selector(::-webkit-scrollbar) {
    .campus-panel-body {
        scrollbar-width: thin;
        scrollbar-color: #D1D3D9 transparent;
    }
}

.campus-panel-title {
    margin: 0 16px 8px;
    color: #8B8B8F;
    font-size: 16px;
    font-weight: 400;
}

.campus-panel-card {
    background: none;
    padding: 0 4px;
}

.campus-building-item,
.dormitory-building-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    font: inherit;
    font-size: 16px;
    font-weight: 400;
    color: #000000;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.campus-building-item:hover,
.dormitory-building-item:hover {
    background-color: #F1F1F2;
}

.campus-building-item.active,
.dormitory-building-item.active {
    font-weight: 500;
    background-color: #F1F1F2;
}

.campus-building-color,
.dormitory-building-color {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
}

/* ============================================================
   OUTER MAP — утсан дээр: sidebar-ын оронд хайлт
   ============================================================ */

#campusView .map-search-btn {
    display: none;
}

@media (max-width: 575.98px) {
    .campus-panel {
        display: none;
    }

    #campusView .map-search-btn {
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 8px;
        height: 68px;
        padding: 16px;
        border-radius: 36px;
        border: 1px solid #FFFFFF;
        background-color: #F6F7F9;
        box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
        display: flex;
        align-items: center;
        appearance: none;
        -webkit-appearance: none;
        font: inherit;
        color: inherit;
        box-sizing: border-box;
        cursor: pointer;
        z-index: 1000;
    }

    #campusView .map-search-inner {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        height: 36px;
        border-radius: 18px;
        background-color: #F1F2F6;
        padding: 10px;
        box-sizing: border-box;
    }

    #campusView .map-search-placeholder {
        color: #8B8B8F;
        font-weight: 500;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #campusView .map-search-placeholder.has-text {
        color: #000000;
    }

    /* OSM attribution хайлтын товчны ард нуугдахгүй */
    #campusLocationMap .leaflet-bottom {
        bottom: 84px;
    }
}

/* Campus search modal (indoor хайлттай ижил загвар) */

#campusSearchModal {
    z-index: 100020;
}

#campusSearchModal .modal-dialog {
    position: fixed;
    top: 8px;
    bottom: 8px;
    left: 8px;
    right: 8px;
    margin: 0;
    max-width: calc(100% - 16px);
}

#campusSearchModal.modal.fade .modal-dialog {
    transform: translateY(calc(100% + 16px));
    transition: transform 0.3s ease-in-out;
}

#campusSearchModal.modal.show .modal-dialog {
    transform: translateY(0);
}

#campusSearchModal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 36px;
    border: 1px solid #FFFFFF;
    background-color: #F1F2F6;
}

#campusSearchModal .room-detail-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    z-index: 1;
}

#campusSearchModal .modal-header {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
}

#campusSearchModal .search-modal-input {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    margin: 16px 74px 16px 16px;
    padding-left: 13px;
    height: 42px;
    border-radius: 21px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

#campusSearchModal .search-modal-input-field {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #000000;
    flex: 1 1 auto;
    min-width: 0;
}

#campusSearchModal .search-modal-input-field::placeholder {
    color: #8B8B8F;
    font-weight: 500;
}

#campusSearchModal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 16px 16px;
}

.campus-search-section-title {
    margin: 8px 16px 8px;
    color: #8B8B8F;
    font-size: 14px;
    font-weight: 400;
}

.campus-search-card {
    background-color: #FFFFFF;
    border-radius: 24px;
    padding: 8px 16px;
    margin-bottom: 16px;
}

#campusSearchModal .campus-building-item,
#campusSearchModal .dormitory-building-item {
    padding: 12px 0;
    border-radius: 0;
    transition: none;
}

#campusSearchModal .campus-building-item + .campus-building-item,
#campusSearchModal .dormitory-building-item + .dormitory-building-item {
    border-top: 1px solid #EBECF0;
}

#campusSearchModal .campus-building-item:hover,
#campusSearchModal .dormitory-building-item:hover,
#campusSearchModal .campus-building-item.active,
#campusSearchModal .dormitory-building-item.active {
    background: none;
    font-weight: 400;
}

.campus-search-empty {
    text-align: center;
    color: #8B8B8F;
    font-size: 14px;
    padding: 32px 16px;
}

/* Хичээлийн байрны pin (indoor pin-тэй ижил) */
.school-pin-icon {
    background: none;
    border: none;
}

.school-pin {
    display: block;
    cursor: pointer;
    overflow: visible;
    filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.25));
    transform-origin: 50% 100%;
    transition: transform 0.15s ease;
}

.school-pin-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    cursor: pointer;
}

/* Breadcrumb-тэй ижил загвартай нэр */
.school-pin-chip {
    margin-top: 4px;
    max-width: 150px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    color: #000000;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover: зөвхөн pin томорно, нэр хөдлөхгүй */
.school-pin-wrap:hover .school-pin {
    transform: scale(1.15);
}

/* ============================================================
   FIRST-TIME TIPS
   ============================================================ */

.map-tip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 16px;
    border-radius: 16px;
    border: 1px solid #FFFFFF;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    color: #000000;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    animation: map-tip-in 0.25s ease;
}

.map-tip[hidden] {
    display: none;
}

@keyframes map-tip-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.map-tip-text {
    flex: 1 1 auto;
}

.map-tip-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.map-tip-close:hover {
    background-color: #EBECF0;
}

/* Outdoor: компьютер дээр sidebar-аас баруун талын хэсгийн голд */
#campus-tip {
    top: 16px;
    left: calc(300px + (100% - 300px) / 2);
    transform: translateX(-50%);
    width: max-content;
    max-width: min(420px, calc(100% - 300px - 32px));
    z-index: 1001;
}

/* Indoor: breadcrumb, буцах/хаах товчны доор голд */
#indoor-tip {
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(420px, calc(100% - 16px));
    z-index: 100010;
}

@media (max-width: 575.98px) {
    /* Утсан дээр sidebar байхгүй; баруун дээд zoom товчноос зай авна */
    #campus-tip {
        top: 8px;
        left: 8px;
        right: 56px;
        transform: none;
        width: auto;
        max-width: none;
    }
}

/* Нийтлэг spinner */
.map-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #D1D3D9;
    border-top-color: #8B8B8F;
    border-radius: 50%;
    animation: dorm-popup-spin 0.8s linear infinite;
}

#searchModal .search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    color: #8B8B8F;
    font-size: 14px;
}

/* Хуваариас нээсэн (iframe) горим */
body.embed-mode #map-back-btn { display: none; }

#search-result-pin {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -100%);
    transform-origin: center bottom;
    pointer-events: none;
    z-index: 5;
}
#search-result-pin.map-pin { width: 30px; height: 60px; }
#search-result-pin.map-pin-labeled {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
}

/* Pin дээрх "Даваа-3-р цаг" шошго */
.schedule-pin-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 8px;
    border-radius: 12px;
    border: 2px solid #FF2125;
    background-color: #F6F7F9;
    box-shadow: -4px 4px 8px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    color: #000000;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
}

#map-container #search-result-pin svg {
    position: static;
    display: block;
    flex: none;
    transform: none;
}

/* Өрөө олдоогүй үед: зөвхөн мессеж + хаах товч үлдэнэ */
body.room-not-found #indoorView .location-breadcrumb,
body.room-not-found #indoorView .map-zoom-in-btn,
body.room-not-found #indoorView .map-zoom-out-btn,
body.room-not-found #indoorView .map-search-badge,
body.room-not-found #indoorView .map-search-btn,
body.room-not-found #indoorView .map-maximize-btn {
    display: none !important;
}

/* student-web-ээс утсан дээр нээсэн үед: хайх товчны доор 68px зай */
@media (max-width: 575.98px) {
    body.embed-mode #indoorView {
        --map-bottom-offset: 60px;   /* 8px (үндсэн) + 60px = 68px */
    }
}