/* 기본 스타일 */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100vw;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 스마트폰 목업 */
.phone-mockup {
    width: 390px;
    height: 844px;
    background-color: #1c1c1e;
    border-radius: 50px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 10px #111;
    position: relative;
    box-sizing: border-box;
}

/* 화면(스크린) */
.screen {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 34px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 상단 헤더 영역 */
.header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
    z-index: 1000;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #2ecc71 0%, #f39c12 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

/* 햄버거 메뉴 스타일 */
.hamburger-menu {
    background: #fff;
    /* border: 1px solid #e5e7eb; */
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    /* box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06); */
    user-select: none;
}

.hamburger-line {
    width: 18px;
    height: 2px;
    background-color: #333;
    margin: 2px 0;
    transition: 0.3s;
}

/* 상단 컨트롤 패널 */
.controls-panel {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
    z-index: 1000;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 검색바 컨테이너 */
.search-container {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

#search-box {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    outline: none;
}

#search-box:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

/* 필터 버튼 */
.filter-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    flex-shrink: 0;
}

.filter-toggle:hover {
    background: #f9fafb;
}

.filter-toggle.active {
    background: #2ecc71;
    border-color: #2ecc71;
}

.filter-toggle.active svg path {
    stroke: white;
}

/* 필터 패널 */
.filter-panel {
    display: none;
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(229, 231, 235, 0.7);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    transition: height 0.3s ease;
}

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

/* 필터 버튼 컨테이너 */
.filter-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.filter-buttons::-webkit-scrollbar {
    height: 6px;
}

.filter-buttons::-webkit-scrollbar-track {
    background: transparent;
}

.filter-buttons::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 999px;
}

.filter-buttons button {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    scroll-snap-align: start;
}

.filter-buttons button:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.filter-buttons button.full-width {
    flex-basis: 100%;
}

.filter-buttons button.active {
    background-color: #2ecc71;
    color: white;
    border-color: #2ecc71;
}

#sort-by-distance.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 메인 콘텐츠 영역 (지도 전폭) */
.main-content {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* 결과 목록 기본: 데스크톱 하단 패널 내부에서 사용 */
#results-list {
    height: 100%;
    overflow-y: auto;
    background-color: transparent;
    scrollbar-width:none

}

.list-item {
    padding: 12px;
    margin: 10px;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.list-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(16, 24, 40, 0.08);
}

.list-item:focus {
    transform: scale(1.02);
    box-shadow: 0 6px 14px rgba(16, 24, 40, 0.15);
}

.list-item h3 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #212529;
}

.list-item p {
    margin: 0;
    font-size: 12px;
    color: #6c757d;
}

.list-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 10px;
    align-items: center;
}

.thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    background: #f3f4f6;
}

.meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chip {
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 999px;
    background: #fff;
}

/* 지도 (전폭) */
#map {
    width: 100%;
    height: 100%;
}

/* 팝업 스타일 */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
}

.leaflet-popup-content {
    margin: 15px;
}

.popup-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 8px;
}

.popup-info {
    font-size: 13px;
    margin-bottom: 4px;
}

/* shadcn 스타일 모사: 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s ease;
    cursor: pointer;
}

.btn:hover {
    background: #f9fafb;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #ffffff;
}

.btn-primary:hover {
    filter: brightness(0.98);
}

/* 오버레이(드로어) */
.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    display: none;
    z-index: 1500;
}

.overlay-backdrop.open {
    opacity: 1;
    pointer-events: auto;
    display: block;
}

.results-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 70%;
    background: #ffffff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -10px 30px rgba(16, 24, 40, 0.15);
    transform: translateY(100%);
    transition: transform .28s ease;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #eef2f7;
}

.overlay-backdrop.open .results-drawer {
    transform: translateY(0%);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.drawer-title {
    font-weight: 700;
    font-size: 14px;
}

.drawer-body {
    flex: 1;
    overflow: auto;
}

/* 데스크톱 하단 결과 패널 */
.bottom-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32%;
    background: rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(229, 231, 235, 0.7);
    box-shadow: 0 -10px 24px rgba(16, 24, 40, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    transition: height 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.drag-handle {
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    user-select: none;
}

.drag-indicator {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2ecc71 0%, #f39c12 100%);
}

.panel-body {
    flex: 1;
    overflow: auto;
}

/* 미디어 모달 */
.media-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1600;
    display: none;
}

.media-backdrop.open {
    opacity: 1;
    pointer-events: auto;
    display: block;
}

.media-modal {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 86%;
    max-width: 560px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.media-title {
    font-weight: 700;
    font-size: 14px;
}

.media-body {
    padding: 12px;
    overflow: auto;
}

.flicking-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.flicking-camera {
    display: flex;
    height: 100%;
}

.flicking-panel {
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    padding: 0 5px;
    box-sizing: border-box;
}

.tinder-card {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.tinder-card img {
    width: 100%;
    border-radius: 10px 10px 0 0;
    object-fit: cover;
    margin-bottom: 0;
    max-height: 50vh;
}

.tinder-card .quote-card {
    padding: 20px;
    background: #f1f5f9;
    border-radius: 10px;
    margin: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tinder-card .quote-text {
    font-style: italic;
    margin: 0 0 15px 0;
    color: #334155;
    line-height: 1.6;
    font-size: 15px;
    flex: 1;
}

.tinder-card .quote-author {
    text-align: right;
    font-size: 13px;
    color: #64748b;
}

.tinder-card .quote-source {
    text-align: right;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
}

.media-desc {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin: 10px 15px;
}

.tts-card-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 0 5px;
}

.tts-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2ecc71;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.tts-card-button:hover {
    background: #27ae60;
    transform: scale(1.05);
}

.tts-card-button.playing {
    background: #e74c3c;
}

.tts-card-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.tinder-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 15px;
}

.tinder-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.tinder-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #cbd5e1;
}

.tinder-dot.active {
    background: #2ecc71;
    transform: scale(1.2);
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.1);
}

/* 사용자 위치 마커 스타일 */
.user-marker {
    background-color: #3498db;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.7);
}

/* 위치 정보 팝업 스타일 */
#location-popup {
    position: absolute;
    top: 60px;
    right: 16px;
    z-index: 1001;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.1);
    display: none;
    width: 250px;
}

#location-popup p {
    margin: 0 0 10px 0;
    font-size: 14px;
}

#location-popup button {
    width: 100%;
    padding: 8px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}

#location-popup button:hover {
    background: #27ae60;
}

#location-popup button:last-child {
    margin-bottom: 0;
}

/* 인앱 알림 토스트 스타일 */
#inapp-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    max-width: 90%;
    font-size: 14px;
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast-message {
    margin-right: 15px;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #ccc;
}

@media (max-width: 480px) {
    .media-modal {
        width: 96%;
        max-width: none;
        height: 80vh;
    }
}

/* 모바일 최적화 */
@media (max-width: 480px) {

    body,
    html {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    body {
        display: block;
        background-color: #ffffff;
    }

    .phone-mockup {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        background-color: #ffffff;
    }

    .screen {
        border-radius: 0;
        height: 100%;
    }

    .header-area {
        padding: 10px 16px;
        padding-top: calc(10px + env(safe-area-inset-top));
        background: rgba(255, 255, 255, 0.7);
        border-bottom: 1px solid rgba(229, 231, 235, 0.7);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .controls-panel {
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.7);
        border-bottom: 1px solid rgba(229, 231, 235, 0.7);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .search-container {
        margin-bottom: 0;
    }

    /* 필터 패널 모바일 스타일 */
    .filter-panel {
        top: 90px;
        width: 90%;
        padding: 16px;
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* 모바일: 지도 전폭, 데스크톱 하단 패널 숨기지 않음.*/
    #map {
        width: 100%;
        height: 100%;
        border-left: none;
    }

    #results-list {
        display: block;
    }

    .bottom-panel {
        display: block;
    }

    .overlay-backdrop {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .results-drawer {
        height: 65%;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    /* 모바일에서만 하단 액션 바 표시 */
    #mobile-actions {
        display: block;
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px 16px;
        border-top: 1px solid #eef2f7;
    }
}

/* 데스크톱 기본: 하단 액션 바 숨김 */
#mobile-actions {
    display: none;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
  }
  
  .user-marker {
    width: 20px;
    height: 20px;
    background-color: red;
    border-radius: 50%;
    animation: blink 1s infinite;
    box-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
  }
  