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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 12px;
}

.login-container h1 {
    font-size: 24px;
    color: #333;
}

.login-container p {
    color: #666;
    font-size: 14px;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 300px;
}

.login-container input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.login-container button {
    padding: 12px;
    background: #4a90d9;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.login-container button:hover {
    background: #357abd;
}

.error {
    color: #e74c3c;
    font-size: 14px;
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    display: none;
    pointer-events: none;
}

.toast.active {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-overlay.hidden {
    display: none;
}

.loading-box {
    background: white;
    padding: 24px 36px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 14px;
}

.loading-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #ddd;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 15px;
    color: #333;
}

/* Map Page */
#map-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.top-bar > * {
    pointer-events: auto;
}

/* Search */
.search-box {
    position: absolute;
    top: 56px;
    left: 10px;
    z-index: 1000;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    outline: none;
}

.search-results {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

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

.search-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.search-item:hover {
    background: #f5f5f5;
}

.search-item .name {
    font-weight: bold;
    color: #333;
}

.search-item .addr {
    color: #888;
    font-size: 12px;
    margin-top: 2px;
}

.search-item .heat-tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    color: white;
    margin-left: 6px;
}

/* Label Markers */
.label-marker {
    background: none !important;
    border: none !important;
    white-space: nowrap;
}

.label-pin {
    position: relative;
    display: inline-block;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 3px 8px;
    border-radius: 4px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* Boundary Overlay */
.boundary-overlay {
    pointer-events: none;
    opacity: 0.85;
    display: block;
}

/* District Stats */
.district-stat {
    background: white;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 12px;
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
}

.district-name {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 4px;
    color: #333;
}

.district-total {
    font-weight: normal;
    color: #999;
    font-size: 11px;
}

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

.stat-row {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.label-pin.selected {
    transform: scale(1.3);
    box-shadow: 0 0 0 3px white, 0 0 0 5px rgba(0,0,0,0.4);
}

.memo-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: #4285F4;
    border-radius: 50%;
    border: 1px solid white;
}

.label-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #333;
    margin: 0 auto;
}

.app-title {
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn:hover {
    background: #f0f0f0;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 30px;
    left: 10px;
    z-index: 1000;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    font-size: 13px;
}

.legend-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.2);
}

/* Filter */
.filter-panel {
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 1000;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: none;
}

.filter-panel.active {
    display: block;
}

.filter-panel label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Info Panel / Add Panel */
.info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
    display: none;
}

.info-panel.active {
    display: block;
}

.info-panel .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.info-panel h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.info-panel .address {
    color: #666;
    font-size: 13px;
    margin-bottom: 12px;
}

.ext-link {
    display: inline-block;
    color: #4a90d9;
    font-size: 13px;
    margin-bottom: 12px;
    text-decoration: none;
}

.ext-link:hover {
    text-decoration: underline;
}

.info-panel .field {
    margin-bottom: 12px;
}

.info-panel .field label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    margin-bottom: 4px;
}

.info-panel select,
.info-panel textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.info-panel textarea {
    height: 80px;
    resize: vertical;
}

.info-panel input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.btn-row {
    display: flex;
    gap: 8px;
}

.info-panel .save-btn {
    flex: 1;
    padding: 12px;
    background: #4a90d9;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

.info-panel .save-btn:hover {
    background: #357abd;
}

.apt-name-btn {
    cursor: pointer;
}

.apt-name-btn:hover {
    color: #e74c3c;
}

/* Delete Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 300px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal p {
    margin-bottom: 8px;
    font-size: 15px;
    color: #333;
}

.modal-name {
    font-weight: bold;
    font-size: 16px !important;
    margin-bottom: 20px !important;
}

.modal-btns {
    display: flex;
    gap: 10px;
}

.modal-cancel, .modal-confirm {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.modal-cancel {
    background: #f0f0f0;
    color: #333;
}

.modal-cancel:hover {
    background: #e0e0e0;
}

.modal-confirm {
    background: #e74c3c;
    color: white;
}

.modal-confirm:hover {
    background: #c0392b;
}

.memo-history {
    margin-bottom: 12px;
    font-size: 13px;
}

.memo-line {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}

.memo-line {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.memo-line-content {
    flex: 1;
    word-break: break-word;
}

.memo-line .memo-date {
    color: #999;
    font-size: 11px;
    margin-right: 6px;
}

.memo-delete {
    background: none;
    border: none;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

.memo-delete:hover {
    color: #e74c3c;
}

.save-msg {
    text-align: center;
    color: #27ae60;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* 내 위치 마커 */
.my-location {
    position: relative;
    width: 20px;
    height: 20px;
}

.my-location-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    background: #4285F4;
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    z-index: 2;
}

.my-location-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: rgba(66, 133, 244, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}
