:root {
    --header-height: 48px;
    --primary-color: #1362FB;
    --primary-hover: #0B4FD1;
}

/* UIKit Primary 색상 오버라이드 */
.uk-button-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.uk-button-primary:hover,
.uk-button-primary:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: white !important;
}

.uk-button-primary-outline {
    border: 1px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    background-color: transparent !important;
}

.uk-button-primary-outline:hover,
.uk-button-primary-outline:focus {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

/* 기본 레이아웃 */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: sans-serif;
    min-width: 320px;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
}

/* 헤더 검색창 */
.header-search-container {
    position: relative;
    flex: 0 0 280px;
    max-width: 280px;
}

.header-search-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0 4px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.header-search-box:focus-within {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(19, 98, 251, 0.15);
}

.header-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 8px;
    font-size: 14px;
    background: transparent;
    min-width: 0;
}

.header-search-input::placeholder {
    color: #666;
    font-weight: 500;
}

.header-search-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.header-search-btn:hover {
    background: rgba(19, 98, 251, 0.1);
    color: var(--primary-color);
}

.header-search-btn [uk-icon] {
    width: 16px !important;
    height: 16px !important;
}

/* 검색 결과 - 반응형 */
.header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 4px;
    width: 100%;
}

.header-search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.header-search-result-item:hover,
.header-search-result-item.selected {
    background: #f8f9fa;
}

.result-content {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.result-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.result-subtitle {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.result-type {
    background: #f0f0f0;
    color: #666;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 플로팅 위치 버튼 */
.floating-location-btn {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.location-floating-button {
    width: 48px;
    height: 48px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.location-floating-button:hover {
    background: #f8f9fa;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.location-floating-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.location-floating-button.loading {
    background: #f0f8ff;
    border-color: var(--primary-color);
    opacity: 0.7;
}

.location-floating-button [uk-icon] {
    width: 24px !important;
    height: 24px !important;
    color: #666;
}

.location-floating-button.loading [uk-icon] {
    color: var(--primary-color);
    animation: simple-spin 1s linear infinite;
}

@keyframes simple-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 데스크톱 */
@media (min-width: 960px) {
    .container {
        flex-direction: row;
    }

    .box-a {
        flex: 0 0 375px;
        max-width: 375px;
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--header-height));
        overflow: hidden;
    }

    .box-a .box-c {
        flex: 1;
        overflow-y: auto;
        display: block;
    }

    .box-b {
        flex: 1;
        position: relative;
        height: calc(100vh - var(--header-height));
    }

    .box-b .box-c {
        display: none;
    }

    .property-desktop-box {
        flex: 0 0 400px;
        max-width: 400px;
        background: white;
        border-left: 1px solid #eee;
        border-right: 1px solid #eee;
        z-index: 100;
        overflow-y: auto;
    }

    .floating-location-btn {
        bottom: 20px;
        right: 20px;
    }

    .header-search-results {
        min-width: 320px;
        max-width: 400px;
    }

    .header-search-result-item {
        padding: 12px 16px;
    }

    .result-title {
        font-size: 14px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .result-subtitle {
        font-size: 12px;
    }
}

/* 모바일 */
@media (max-width: 959px) {
    html, body {
        height: 100%;
        overflow: hidden;
        position: relative;
    }

    .container {
        height: 100%;
        flex-direction: column;
    }

    .box-a {
        flex: 0 0 auto;
    }

    .box-b {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    .box-a .box-c {
        display: none;
    }

    .box-b .box-c {
        display: block;
    }

    .floating-location-btn {
        bottom: 120px;
        right: 16px;
    }

    .header-search-container {
        flex: 0 0 220px;
        min-width: 180px;
        max-width: 220px;
    }

    .header-search-results {
        position: fixed;
        left: 8px;
        right: 8px;
        top: 56px;
        width: auto;
        min-width: auto;
        max-width: none;
        max-height: 60vh;
    }

    .header-search-result-item {
        padding: 12px 16px;
        align-items: flex-start;
        gap: 8px;
    }

    .result-content {
        flex: 1;
        margin-right: 0;
    }

    .result-title {
        font-size: 14px;
        margin-bottom: 4px;
        white-space: nowrap;
    }

    .result-subtitle {
        font-size: 12px;
        color: #888;
        white-space: nowrap;
    }

    .result-type {
        align-self: flex-start;
        margin-top: 2px;
    }

    .header-search-box {
        padding: 0 2px;
    }

    .header-search-input {
        font-size: 16px;
        padding: 8px 4px;
    }

    .header-search-btn {
        width: 25px;
        height: 25px;
        padding: 2px;
        margin-left: 2px;
    }

    .header-search-btn [uk-icon] {
        width: 12px !important;
        height: 12px !important;
    }
}

/* 작은 화면 */
@media (max-width: 480px) {
    .floating-location-btn {
        bottom: 110px;
        right: 12px;
    }

    .location-floating-button {
        width: 44px;
        height: 44px;
    }

    .location-floating-button [uk-icon] {
        width: 22px !important;
        height: 22px !important;
    }

    .header-search-container {
        flex: 0 0 160px;
        max-width: 160px;
        min-width: 140px;
    }

    .header-search-results {
        left: 4px;
        right: 4px;
        top: 52px;
    }

    .header-search-box {
        padding: 0 1px;
    }

    .header-search-input {
        padding: 6px 2px;
        font-size: 14px;
    }

    .header-search-btn {
        width: 20px;
        height: 20px;
        margin-left: 1px;
    }

    .header-search-btn [uk-icon] {
        width: 10px !important;
        height: 10px !important;
    }
}

/* 매우 작은 화면 */
@media (max-width: 360px) {
    .header-search-container {
        flex: 0 0 120px;
        max-width: 120px;
        min-width: 100px;
    }

    .header-search-input {
        padding: 6px 2px;
        font-size: 13px;
    }

    .header-search-input::placeholder {
        font-size: 12px;
    }

    .header-search-results {
        left: 4px;
        right: 4px;
        top: 50px;
    }

    .header-search-result-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
        gap: 4px;
    }

    .result-content {
        width: 100%;
        margin-bottom: 4px;
    }

    .result-title {
        font-size: 13px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .result-subtitle {
        font-size: 11px;
        white-space: normal;
        line-height: 1.3;
    }

    .result-type {
        align-self: flex-end;
        margin-top: 0;
    }
}

/* 로그인 모달 */
#login-modal .uk-modal-dialog {
    width: 90% !important;
    max-width: 400px !important;
    margin: auto !important;
    position: relative !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

#login-modal .uk-modal-body {
    padding: 30px !important;
    text-align: center !important;
    border-radius: 12px !important;
    background: white !important;
}

/* 블러 효과 */
.blur-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.65) !important;
    z-index: 999 !important;
    backdrop-filter: blur(5px) !important;
    pointer-events: none !important;
}

.container.blur-active {
    filter: blur(4px) !important;
    transition: filter 0.3s ease !important;
}
