/*
 * PCLand indoor map.
 *   .plm-*  storefront map page (/map) and the product-page badge
 *   .pm-*   admin plan editor and unit picker
 */

/* ---------------------------------------------------------------- storefront */

.plm {
    margin: 28px auto 56px;
}

.plm__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e3e8ee;
}

.plm__title {
    font-size: 26px;
    font-weight: 700;
    color: #0f1b2d;
}

.plm__intro {
    margin-top: 6px;
    max-width: 640px;
    font-size: 14px;
    color: #5a6b80;
}

.plm__building {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #5a6b80;
    text-align: right;
}

.plm__building b {
    font-size: 15px;
    color: #0f1b2d;
}

.plm__empty,
.plm__loading {
    padding: 40px 0;
    color: #5a6b80;
}

.plm__grid {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

/* Sidebar */

.plm__side {
    min-width: 0;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    background: #fff;
    padding: 14px;
    max-height: 720px;
    overflow: auto;
}

.plm__search {
    position: relative;
    display: block;
}

.plm__search-icon {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    font-size: 18px;
    color: #8695a8;
}

.plm__search-input {
    width: 100%;
    border: 1px solid #d6dde6;
    border-radius: 8px;
    padding: 10px 12px 10px 34px;
    font-size: 14px;
    outline: none;
}

.plm__search-input:focus {
    border-color: #0f1b2d;
}

.plm__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.plm__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d6dde6;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    color: #43536a;
    background: #fff;
    cursor: pointer;
}

.plm__chip--active {
    border-color: #0f1b2d;
    background: #f2f5f9;
    color: #0f1b2d;
    font-weight: 600;
}

.plm__dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
    flex: 0 0 auto;
}

.plm__dot--vacant {
    background: repeating-linear-gradient(45deg, #dfe6ee, #dfe6ee 3px, #f4f7fa 3px, #f4f7fa 6px);
    border: 1px solid #d6dde6;
}

.plm__count {
    font-size: 12px;
    color: #8695a8;
    margin-bottom: 6px;
}

.plm__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plm__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 9px 8px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
}

.plm__item:hover {
    background: #f2f5f9;
}

.plm__item .plm__dot {
    margin-top: 4px;
}

.plm__item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.plm__item-body b {
    font-size: 14px;
    color: #0f1b2d;
}

.plm__item-body small {
    font-size: 12px;
    color: #6b7c92;
}

.plm__item-loc {
    color: #8695a8 !important;
}

.plm__none {
    padding: 10px 4px;
    font-size: 13px;
    color: #8695a8;
}

.plm__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #0f1b2d;
    cursor: pointer;
    margin-bottom: 10px;
}

.plm__store-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plm__store-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: contain;
    background: #f2f5f9;
    flex: 0 0 auto;
}

.plm__store-logo--blank {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.plm__store-name {
    font-size: 17px;
    font-weight: 700;
    color: #0f1b2d;
}

.plm__store-type {
    font-size: 12px;
    color: #6b7c92;
}

.plm__store-loc {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #0f1b2d;
}

.plm__store-desc {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
    color: #5a6b80;
}

.plm__meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 12px;
    margin-top: 12px;
    font-size: 13px;
}

.plm__meta dt {
    color: #8695a8;
}

.plm__meta dd {
    color: #23374f;
    word-break: break-word;
}

.plm__meta a {
    color: #0b6ea8;
}

.plm__directions {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f2f5f9;
    font-size: 13px;
    color: #43536a;
}

.plm__directions b {
    display: block;
    margin-bottom: 4px;
    color: #0f1b2d;
}

.plm__products {
    margin-top: 16px;
    font-size: 13px;
}

.plm__products > b {
    display: block;
    margin-bottom: 8px;
    color: #0f1b2d;
}

.plm__products-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plm__product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 8px;
}

.plm__product:hover {
    background: #f2f5f9;
}

.plm__product img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    flex: 0 0 auto;
}

.plm__product span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.plm__product b {
    font-size: 13px;
    font-weight: 500;
    color: #23374f;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.plm__product small {
    font-size: 13px;
    font-weight: 700;
    color: #0f1b2d;
}

/* Plan */

.plm__map {
    min-width: 0;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    background: #fff;
    padding: 14px;
}

.plm__tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.plm__tab {
    border: 1px solid #d6dde6;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 14px;
    color: #43536a;
    background: #fff;
    cursor: pointer;
}

.plm__tab--active {
    background: #0f1b2d;
    border-color: #0f1b2d;
    color: #fff;
    font-weight: 600;
}

.plm__zoom {
    margin-left: auto;
    display: inline-flex;
    border: 1px solid #d6dde6;
    border-radius: 8px;
    overflow: hidden;
}

.plm__zoom button {
    width: 34px;
    height: 32px;
    background: #fff;
    color: #43536a;
    font-size: 16px;
    cursor: pointer;
}

.plm__zoom button + button {
    border-left: 1px solid #d6dde6;
}

.plm__canvas {
    overflow: auto;
    border-radius: 8px;
    background: #f4f7fa;
}

.plm__svg {
    display: block;
    min-width: 100%;
    height: auto;
}

.plm__building-rect {
    fill: #fff;
    stroke: #c3cedb;
    stroke-width: 3;
}

.plm__area {
    fill: #eef2f7;
}

.plm__route {
    fill: none;
    stroke: #22c3e6;
    stroke-width: 5;
    stroke-dasharray: 10 8;
    stroke-linecap: round;
}

.plm__facility rect {
    fill: #dfe6ee;
    stroke: #c3cedb;
    stroke-width: 1.5;
}

.plm__facility text {
    font-size: 13px;
    fill: #5a6b80;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.plm__unit rect {
    fill: #cbd6e2;
    stroke: #fff;
    stroke-width: 2;
    transition: opacity .15s ease;
}

.plm__unit {
    cursor: pointer;
}

.plm__unit--vacant {
    cursor: default;
}

.plm__unit--vacant rect {
    fill: #e9eef4;
    stroke-dasharray: 5 4;
    stroke: #c3cedb;
}

.plm__unit-no {
    font-size: 13px;
    font-weight: 700;
    fill: #ffffff;
    text-anchor: middle;
    pointer-events: none;
}

.plm__unit-name {
    font-size: 12px;
    fill: #ffffff;
    text-anchor: middle;
    pointer-events: none;
}

.plm__unit--vacant .plm__unit-no,
.plm__unit--vacant .plm__unit-name {
    fill: #8695a8;
}

.plm__unit--dim rect {
    opacity: .3;
}

.plm__unit--match rect,
.plm__unit--active rect {
    stroke: #0f1b2d;
    stroke-width: 4;
}

.plm__unit--active rect {
    stroke: #22c3e6;
}

.plm__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-top: 12px;
    font-size: 12px;
    color: #5a6b80;
}

.plm__legend-title {
    font-weight: 700;
    color: #0f1b2d;
}

.plm__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 767px) {
    /* Keep the plan readable on phones: scroll it sideways instead of shrinking it. */
    .plm__svg {
        min-width: 720px;
    }

    .plm__canvas {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1023px) {
    .plm__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .plm__side {
        max-height: 520px;
        order: 2;
    }

    .plm__map {
        order: 1;
    }

    .plm__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .plm__building {
        text-align: left;
    }
}

/* Product page badge */

.plm-badge {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    background: #f7f9fc;
    font-size: 14px;
    color: #23374f;
}

.plm-badge__icon {
    font-size: 18px;
    color: #0f1b2d;
    line-height: 1.2;
}

.plm-badge__link {
    display: inline-block;
    margin-left: 6px;
    color: #0b6ea8;
    text-decoration: underline;
}

/* ---------------------------------------------------------------- admin */

.pm-canvas {
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.pm-svg {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

.pm-building {
    fill: #fff;
    stroke: #cbd5e1;
    stroke-width: 3;
}

.pm-area {
    fill: #eef2f7;
}

.pm-facility rect,
.pm-facility {
    fill: #e2e8f0;
    stroke: #cbd5e1;
    stroke-width: 1.5;
}

.pm-facility-text {
    font-size: 13px;
    fill: #64748b;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.pm-unit rect {
    fill: #cbd5e1;
    stroke: #fff;
    stroke-width: 2;
}

.pm-unit {
    cursor: pointer;
}

.pm-unit--free rect {
    fill: #dbeafe;
    stroke: #93c5fd;
}

.pm-unit--taken rect {
    fill: #cbd5e1;
    stroke: #94a3b8;
}

.pm-unit--selected rect {
    fill: #2563eb;
    stroke: #1d4ed8;
}

.pm-unit-no {
    font-size: 13px;
    font-weight: 700;
    fill: #1e293b;
    text-anchor: middle;
    pointer-events: none;
}

.pm-unit-name {
    font-size: 11px;
    fill: #475569;
    text-anchor: middle;
    pointer-events: none;
}

.pm-unit--selected .pm-unit-no,
.pm-unit--selected .pm-unit-name {
    fill: #fff;
}

.pm-draggable {
    cursor: move;
}

.pm-selected rect,
rect.pm-selected {
    stroke: #2563eb;
    stroke-width: 4;
}

.pm-handle {
    fill: #2563eb;
    cursor: nwse-resize;
}

.pm-tab,
.pm-btn {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    background: #fff;
    color: #374151;
    cursor: pointer;
}

.pm-tab--active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.pm-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.pm-btn--danger {
    color: #b91c1c;
    border-color: #fecaca;
}

.pm-input {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    width: 100%;
    background: #fff;
    color: #374151;
}

.pm-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pm-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.pm-swatch--free {
    background: #dbeafe;
    border: 1px solid #93c5fd;
}

.pm-swatch--taken {
    background: #cbd5e1;
    border: 1px solid #94a3b8;
}

.pm-swatch--selected {
    background: #2563eb;
}

.dark .pm-canvas {
    background: #0f172a;
    border-color: #1f2937;
}

.dark .pm-building {
    fill: #111827;
    stroke: #334155;
}

.dark .pm-area {
    fill: #1e293b;
}

.dark .pm-facility rect,
.dark .pm-facility {
    fill: #1f2937;
    stroke: #334155;
}

.dark .pm-unit-no {
    fill: #e2e8f0;
}

.dark .pm-unit-name {
    fill: #94a3b8;
}

.dark .pm-unit--free rect {
    fill: #1e3a5f;
    stroke: #2563eb;
}

.dark .pm-unit--taken rect {
    fill: #334155;
    stroke: #475569;
}

.dark .pm-tab,
.dark .pm-btn,
.dark .pm-input {
    background: #111827;
    border-color: #1f2937;
    color: #e5e7eb;
}
