* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f5;
}

#svg-container {
    width: 100%;
    height: 100%;
    cursor: grab;
    /* allow pointer events so dragging SVG works */
    touch-action: none;
}

#svg-container:active {
    cursor: grabbing;
}

#svg-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Interactive Layers */
.plot-hit-area {
    fill: rgba(255, 165, 0, 0.4);
    stroke: #ff9900;
    stroke-width: 2px;
    cursor: pointer;
    vector-effect: non-scaling-stroke; /* Keep stroke width constant regardless of zoom */
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
    transform-box: fill-box;
}

.plot-hit-area:hover {
    stroke: #ffffff !important;
    stroke-width: 3px !important;
    opacity: 1 !important;
    filter: drop-shadow(0px 0px 12px rgba(255,255,255,0.8));
    transform: scale(1.02);
}

.plot-hit-area.selected {
    fill: rgba(0, 150, 255, 0.6);
    stroke: #0055ff;
    stroke-width: 3px;
}

.plot-needs-review {
    fill: rgba(255, 0, 0, 0.3);
    stroke: #ff0000;
    stroke-dasharray: 4;
    display: none; /* hidden by default */
}
.plot-needs-review.show {
    display: block;
}

.plot-label {
    fill: #000;
    font-size: 24px;
    font-weight: bold;
    text-anchor: middle;
    pointer-events: none; /* Do not block clicks */
    /* text shadow for readability */
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
}

/* UI Panels - Premium Dark Glassmorphism */
.ui-panel {
    position: absolute;
    background: rgba(4, 16, 11, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(197, 160, 89, 0.3);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 100;
    color: #ffffff;
}

.ui-panel.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

#summary-panel {
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-bottom: none;
    overflow-y: auto;
}

#summary-panel h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-family: 'Cinzel', serif;
    color: #c5a059;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    padding-bottom: 8px;
}

#summary-panel h4 {
    margin: 16px 0 12px 0;
    font-size: 14px;
    color: #c5a059;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#summary-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #9cb3a8;
}

#summary-list li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 6px 0;
}

#summary-list li strong {
    color: #ffffff;
}

.toggles {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.toggles label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    cursor: pointer;
    color: #9cb3a8;
    transition: color 0.2s;
}

.toggles label:last-child {
    margin-bottom: 0;
}

.toggles label:hover {
    color: #ffffff;
}

.toggles input[type="checkbox"] {
    margin-right: 10px;
    accent-color: #c5a059;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Inputs and Selects */
input[type="text"], select {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: #ffffff;
    border-radius: 6px;
    padding: 8px 12px !important;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus, select:focus {
    border-color: #c5a059;
}

input[type="text"]::placeholder {
    color: #6b7d75;
}

select option, select optgroup {
    background: #04100b;
    color: #ffffff;
}

#debug-list-container {
    min-height: 80px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 6px;
    background: rgba(0,0,0,0.4);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug-empty-state {
    text-align: center;
    color: #6b7d75;
    font-size: 12px;
    font-style: italic;
    padding: 20px 10px;
    margin: auto;
}

/* Custom Scrollbar */
#debug-list-container::-webkit-scrollbar {
    width: 6px;
}
#debug-list-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
#debug-list-container::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.4);
    border-radius: 3px;
}
#debug-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.8);
}

#details-panel {
    top: 20px;
    right: 20px;
    width: 320px;
}

#detail-plot-number {
    margin: 0 0 16px 0;
    color: #c5a059;
    font-family: 'Cinzel', serif;
    font-size: 24px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    padding-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: #9cb3a8;
}

.detail-row strong, .detail-row span:not(:first-child) {
    color: #ffffff;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-recommended {
    background: rgba(46, 125, 50, 0.2);
    color: #81c784;
    border: 1px solid rgba(129, 199, 132, 0.3);
}

.status-available {
    background: rgba(101, 161, 71, 0.2);
    color: #a5d6a7; /* keep text readable */
    border: 1px solid rgba(101, 161, 71, 0.4);
}

.status-sold {
    background: rgba(217, 67, 47, 0.2);
    color: #ef9a9a; /* keep text readable */
    border: 1px solid rgba(217, 67, 47, 0.4);
}

.status-missing {
    background: rgba(198, 40, 40, 0.2);
    color: #ef9a9a;
}

.status-needs-review {
    background: rgba(239, 108, 0, 0.2);
    color: #ffb74d;
    border: 1px solid rgba(255, 183, 77, 0.3);
}

.status-conflict {
    background: rgba(123, 31, 162, 0.2);
    color: #ce93d8;
    border: 1px solid rgba(206, 147, 216, 0.3);
}

/* Debug List Items */
.debug-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.debug-list-item:last-child {
    border-bottom: none;
}
.debug-list-item:hover {
    background-color: rgba(197, 160, 89, 0.15);
}
.debug-list-item .status-badge {
    font-size: 10px;
    padding: 3px 6px;
}

@keyframes mapBlink {
    0%, 100% { opacity: 1; filter: brightness(1.2); }
    50% { opacity: 0.3; filter: brightness(1); }
}

.plot-highlight-blink {
    animation: mapBlink 1.5s infinite ease-in-out;
}

.plot-dimmed {
    opacity: 0.15 !important;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Filter Buttons */
.filter-btn {
    border: 1px solid #ddd;
    background: #fff;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
}
.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Label Audit Markers */
.audit-marker {
    fill: none;
    stroke: rgba(255, 0, 0, 0.5);
    stroke-width: 1px;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

/* Number Square UI Labels */
.number-square {
    pointer-events: none;
}
.number-square rect {
    fill: rgba(255, 255, 255, 0.9);
    stroke: #333;
    stroke-width: 1px;
    rx: 4px; /* rounded corners */
    ry: 4px;
    vector-effect: non-scaling-stroke;
}
.number-square text {
    fill: #000;
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
}
.number-square.resolved rect {
    stroke: #4CAF50;
    stroke-width: 1.5px;
}
.number-square.unresolved rect {
    stroke: #FF9800;
    stroke-width: 1px;
    stroke-dasharray: 2 2;
}
.audit-marker.show {
    display: block;
}
.audit-plot { stroke: #0055ff; fill: rgba(0,85,255,0.1); }
.audit-dimension { stroke: #555; }
.audit-table { stroke: #8800ff; }
.audit-unknown { stroke: #ff0000; fill: rgba(255,0,0,0.2); }

/* Premium Action Buttons */
.btn {
    background: rgba(197, 160, 89, 0.1) !important;
    border: 1px solid rgba(197, 160, 89, 0.5) !important;
    color: #c5a059 !important;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}
.btn:hover {
    background: rgba(197, 160, 89, 0.3) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.2);
}
.mapping-actions .btn {
    width: 100%;
}

/* --------------------------------------
   Appointment Form (Right Center Panel)
   -------------------------------------- */
#appointment-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 15px 50px rgba(0,0,0,0.8);
}

.apt-header {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    padding-bottom: 12px;
}
.apt-back-btn {
    cursor: pointer; color: #c5a059; width: 30px; height: 30px; border: 1px solid rgba(197, 160, 89, 0.5); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 12px; transition: 0.2s; font-size: 16px; font-weight: bold;
}
.apt-back-btn:hover { background: rgba(197, 160, 89, 0.2); }
.apt-title { font-size: 18px; font-family: 'Cinzel', serif; color: #c5a059; font-weight: bold; flex: 1; }

.apt-section { display: none; }
.apt-section.active { display: block; }

.apt-cal-nav-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.apt-month-year { font-size: 15px; font-weight: bold; color: #fff; }
.apt-cal-nav { cursor: pointer; color: #c5a059; padding: 5px 10px; border-radius: 4px; background: rgba(197, 160, 89, 0.1); transition: 0.2s;}
.apt-cal-nav:hover { background: rgba(197, 160, 89, 0.3); }

.apt-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.apt-day-hdr { font-size: 11px; color: #9cb3a8; font-weight: 600; margin-bottom: 8px; }
.apt-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; transition: all 0.2s; font-size: 13px; font-weight: 500; color: #fff;
    background: rgba(255,255,255,0.05);
}
.apt-day:not(.disabled):not(.selected):not(.empty):hover { background: rgba(197, 160, 89, 0.3); color: #fff; }
.apt-day.today { border: 1px solid #c5a059; color: #c5a059; background: transparent; }
.apt-day.selected { background: #c5a059; color: #04100b; border-color: #c5a059; font-weight: bold;}
.apt-day.disabled { color: #555; cursor: not-allowed; background: transparent; }
.apt-day.empty { background: transparent; cursor: default; }

.apt-time-list { display: flex; flex-direction: column; gap: 10px; max-height: 350px; overflow-y: auto; padding-right: 5px; }
.apt-time-pill {
    border: 1px solid rgba(197, 160, 89, 0.5); color: #c5a059; background: rgba(0,0,0,0.3);
    padding: 10px; text-align: center; border-radius: 6px; font-size: 14px; cursor: pointer; transition: 0.2s; font-weight: 600;
}
.apt-time-pill:not(.disabled):hover { background: #c5a059; color: #04100b;}
.apt-time-pill.disabled { opacity: 0.5; cursor: not-allowed; border-color: #555; color: #888; background: transparent; }

.apt-form-group { margin-bottom: 15px; }
.apt-form-group label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #9cb3a8; }
.apt-input {
    width: 100%; padding: 10px; border: 1px solid rgba(197, 160, 89, 0.3); border-radius: 6px; font-family: inherit;
    background: rgba(0,0,0,0.3); color: #fff; font-size: 13px; outline: none; transition: 0.3s; box-sizing: border-box;
}
.apt-input:focus { border-color: #c5a059; background: rgba(0,0,0,0.5); }
.apt-error { color: #ef9a9a; font-size: 11px; margin-top: 4px; }

.apt-success { text-align: center; padding: 40px 10px; }
.apt-success h3 { font-family: 'Cinzel', serif; font-size: 24px; color: #c5a059; margin-bottom: 10px; }
.apt-success p { color: #9cb3a8; font-size: 14px; line-height: 1.5; margin-bottom: 25px; }

.apt-time-list::-webkit-scrollbar { width: 4px; }
.apt-time-list::-webkit-scrollbar-track { background: transparent; }
.apt-time-list::-webkit-scrollbar-thumb { background: rgba(197, 160, 89, 0.4); border-radius: 4px; }

