/* ========================================
   LotPoint Public View Styles
   ======================================== */

:root {
    --primary: #57b5e2;
    --primary-dark: #00365d;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.public-app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.project-logo {
    height: 70px;
    width: auto;
    max-width: min(300px, 42vw);
    object-fit: contain;
    object-position: left center;
    display: block;
}

.header-text {
    min-width: 0;
}

.project-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-location {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.3;
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Content layout */
.public-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Map area */
.map-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
}

.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

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

.map-inner {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform, width, height;
}

.plan-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.lot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.lot-overlay polygon {
    pointer-events: all;
    cursor: pointer;
    transition: opacity 0.15s, stroke-width 0.15s;
}

.lot-overlay polygon:hover {
    stroke-width: 2;
}

.lot-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.lot-label {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: #1e293b;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.9), 0 0 6px rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1.2;
    text-align: center;
}

.lot-label .label-line {
    display: block;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.85;
}

/* Tooltip */
.lot-tooltip {
    position: absolute;
    z-index: 30;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    min-width: 220px;
    max-width: 280px;
    pointer-events: auto;
    border: 1px solid var(--border);
}

.tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tooltip-lot-number {
    font-size: 18px;
    font-weight: 700;
}

.tooltip-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.tooltip-status.available {
    background: rgba(46, 143, 10, 0.15);
    color: #2e8f0a;
}

.tooltip-status.under_offer {
    background: rgba(87, 181, 226, 0.15);
    color: #57b5e2;
}

.tooltip-status.sold {
    background: rgba(0, 54, 93, 0.15);
    color: #00365d;
}

.tooltip-status.not_released {
    background: #f3f4f6;
    color: #374151;
}

.tooltip-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.tooltip-detail {
    font-size: 13px;
}

.tooltip-detail-label {
    color: var(--text-light);
    font-size: 11px;
    display: block;
}

.tooltip-detail-value {
    font-weight: 600;
}

/* Overlay toggle bar */
.overlay-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 6px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 20;
}

.overlay-bar-compact {
    bottom: 10px;
    padding: 4px;
}

.overlay-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.overlay-toggle:hover {
    background: #f1f5f9;
}

.overlay-toggle.active {
    background: var(--primary);
    color: #fff;
}

/* Legend */
.map-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    padding: 10px 14px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 20;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map-legend-compact {
    padding: 6px 10px;
    font-size: 11px;
    flex-direction: row;
    gap: 8px;
    top: 8px;
    right: 8px;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
}

.btn-zoom {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 20px;
    font-weight: 500;
}

.btn-zoom:hover {
    background: #fff;
}

/* Lot list panel */
.lot-list-panel {
    width: 340px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lot-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.lot-list-header h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.lot-list-filters {
    display: flex;
    gap: 8px;
}

.filter-select,
.filter-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lot-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.lot-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    border-radius: var(--radius);
    transition: background 0.15s;
    border: 1px solid transparent;
}

.lot-list-item:hover {
    background: #f1f5f9;
}

.lot-list-item.active {
    background: #eff6ff;
    border-color: var(--primary);
}

.lot-list-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}

.lot-list-enquiry {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
}

.lot-list-item-info {
    min-width: 0;
}

.lot-list-item-number {
    font-weight: 600;
    font-size: 14px;
}

.lot-list-item-detail {
    font-size: 12px;
    color: var(--text-light);
}

.lot-list-item-status {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.lot-list-item-status.available {
    background: rgba(46, 143, 10, 0.15);
    color: #2e8f0a;
}

.lot-list-item-status.under_offer {
    background: rgba(87, 181, 226, 0.15);
    color: #57b5e2;
}

.lot-list-item-status.sold {
    background: rgba(0, 54, 93, 0.15);
    color: #00365d;
}

.lot-list-item-status.not_released {
    background: #f3f4f6;
    color: #374151;
}

/* Mobile drawer toggle */
.lot-drawer-toggle {
    display: none;
    position: fixed;
    bottom: 72px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.lot-count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #57b5e2;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-card-sm {
    max-width: 360px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.modal-close:hover {
    background: #e2e8f0;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.enquiry-success {
    text-align: center;
    padding: 20px 0;
}

.enquiry-success h3 {
    margin: 12px 0 6px;
    font-size: 20px;
}

.enquiry-success p {
    color: var(--text-light);
    margin-bottom: 16px;
}

/* Contact info */
.contact-info {
    font-size: 14px;
    line-height: 1.65;
}

.contact-info>div {
    margin-bottom: 0.35em;
}

.contact-info-fallback {
    color: var(--text-light);
    margin-bottom: 12px;
}

.contact-info-hint {
    font-size: 13px;
    color: var(--text);
}

.contact-info a {
    color: var(--primary);
    text-decoration: none;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* Coming soon */
.coming-soon {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 200;
}

.coming-soon-card {
    text-align: center;
    padding: 40px;
}

.coming-soon-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.coming-soon-card p {
    font-size: 18px;
    color: var(--text-light);
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 200;
    transition: opacity 0.3s;
}

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

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Mobile bottom sheet tooltip */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    padding: 20px;
    z-index: 40;
    max-height: 60vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
}

.bottom-sheet.visible {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .public-header {
        padding: 5px 10px;
    }

    .header-left {
        gap: 8px;
    }

    .project-logo {
        height: 40px;
        max-width: min(200px, 46vw);
    }

    .project-name {
        font-size: 14px;
    }

    .project-location {
        font-size: 11px;
    }

    .btn-contact span {
        display: none;
    }

    #btn-zoom-in,
    #btn-zoom-out {
        display: none;
    }

    .public-content {
        flex-direction: column;
    }

    .lot-list-panel {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        z-index: 45;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    }

    .lot-list-panel.open {
        display: flex;
    }

    .lot-drawer-toggle {
        display: flex;
    }

    .map-wrapper {
        height: 100%;
    }

    .overlay-bar {
        bottom: 10px;
        padding: 4px;
        gap: 2px;
    }

    .overlay-toggle {
        padding: 6px 8px;
        font-size: 11px;
    }

    .overlay-toggle span {
        display: none;
    }

    .map-legend {
        font-size: 11px;
        padding: 6px 10px;
    }

    .lot-tooltip {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .overlay-bar {
        gap: 1px;
    }

    .overlay-toggle {
        padding: 5px 6px;
    }
}