/* ==========================================================================
   1. Base & Layout (기본 설정 및 전역 구조)
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

.map-container {
    flex: 1;
    height: 100%;
    position: relative;
}

/* ==========================================================================
   2. Sidebar Component (사이드바 패널, 검색, 정렬, 리스트)
   ========================================================================== */
.sidebar-panel {
    width: 280px; /* 고정 최소 너비 보장 */
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    z-index: 5;
    position: relative;
    transition: margin-left 0.3s ease; /* 접힐 때 부드럽게 좌측으로 이동 */
}

.sidebar-panel.is-collapsed {
    margin-left: -280px; /* 사이드바 너비만큼 왼쪽으로 숨김 */
}

.sidebar-header {
    padding: 12px;
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0; /* 스크롤돼도 상단 영역 크기 고정 */
}

.search-input-wrap {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
}

.search-input:focus {
    border-color: #3b82f6;
}

.sort-btn-group {
    display: flex;
    gap: 4px;
}

.sort-btn {
    flex: 1;
    padding: 5px 0;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
}

.sort-btn.active {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.parking-ul-list {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: var(--theme) rgb(184 210 255 / 0.2);
}

.parking-ul-list li {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.parking-ul-list li:hover {
    background-color: #f8fafc;
}

/* ==========================================================================
   3. Sidebar Toggle Button (접기/펴기 버튼)
   ========================================================================== */
.sidebar-toggle-btn {
    position: absolute;
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.08);
    z-index: 30;
    color: #64748b;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar-toggle-btn:hover {
    background-color: #f8fafc;
    color: #1e293b;
}

/* ==========================================================================
   4. Map Legend Panel (지도 좌측 상단 범례 안내판)
   ========================================================================== */
.map-legend-panel {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.15);
    border: 1px solid rgba(15, 23, 42, 0.1);
    pointer-events: auto;
}

.legend-title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-list {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.legend-item .badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.legend-item.available .badge { background-color: #22c55e; }
.legend-item.normal .badge    { background-color: #3b82f6; }
.legend-item.busy .badge      { background-color: #f59e0b; }
.legend-item.full .badge      { background-color: #ef4444; }
.legend-item.unknown .badge   { background-color: #94a3b8; }

/* ==========================================================================
   5. Custom Marker & Detail Card (마커 & 상세 팝업 카드)
   ========================================================================== */
.custom-parking-marker {
    position: relative;
    width: 24px;
    height: 35px;
    cursor: pointer;
    user-select: none;
}

.custom-parking-marker__img {
    width: 24px;
    height: 35px;
    display: block;
}

.custom-parking-marker__title {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    visibility: hidden;
    padding: 3px 8px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333333;
    border: 1px solid #bbbbbb;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.custom-parking-marker.show-text .custom-parking-marker__title,
.custom-parking-marker.show-hover .custom-parking-marker__title {
    visibility: visible;
}

.parking-detail-card {
    position: relative;
    width: auto;
    min-width: 200px;
    max-width: 300px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    border: 1px solid #e2e8f0;
    padding: 12px 14px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.parking-detail-card::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 7px 0 7px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    display: block;
    width: 0;
}

.parking-detail-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.parking-detail-card .card-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.parking-detail-card .card-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parking-detail-card .card-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    flex-shrink: 0;
}

.parking-detail-card .btn-roadview {
    width: 100%;
    margin-top: 4px;
    padding: 6px 0;
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s;
}

.parking-detail-card .btn-roadview:hover {
    background-color: #2563eb;
}

/* ==========================================================================
   6. Congestion Badges (혼잡도 상태별 뱃지)
   ========================================================================== */
:is(.parking-detail-card, .parking-search-item) .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    vertical-align: middle;
}

:is(.parking-detail-card, .parking-search-item) .badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

:is(.parking-detail-card, .parking-search-item) .badge.AVAILABLE {
    background-color: #dcfce7;
    color: #15803d;
}
:is(.parking-detail-card, .parking-search-item) .badge.AVAILABLE .badge-dot {
    background-color: #22c55e;
}

:is(.parking-detail-card, .parking-search-item) .badge.NORMAL {
    background-color: #dbeafe;
    color: #1d4ed8;
}
:is(.parking-detail-card, .parking-search-item) .badge.NORMAL .badge-dot {
    background-color: #3b82f6;
}

:is(.parking-detail-card, .parking-search-item) .badge.BUSY {
    background-color: #ffedd5;
    color: #c2410c;
}
:is(.parking-detail-card, .parking-search-item) .badge.BUSY .badge-dot {
    background-color: #f59e0b;
}

:is(.parking-detail-card, .parking-search-item) .badge.FULL {
    background-color: #fee2e2;
    color: #b91c1c;
}
:is(.parking-detail-card, .parking-search-item) .badge.FULL .badge-dot {
    background-color: #ef4444;
}

:is(.parking-detail-card, .parking-search-item) .badge.UNKNOWN {
    background-color: #f1f5f9;
    color: #475569;
}
:is(.parking-detail-card, .parking-search-item) .badge.UNKNOWN .badge-dot {
    background-color: #94a3b8;
}

/* ==========================================================================
   7. Parking Status Table & Summary (현황 테이블 & 요약)
   ========================================================================== */
.parking-status-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

.parking-status-table th,
.parking-status-table td {
    padding: 4px 10px;
    border-bottom: 1px solid #eee;
}

.parking-status-table thead th {
    background: #f7f8fa;
    font-weight: 600;
}

.parking-status-table td {
    text-align: center;
}

.parking-status-table tbody th {
    text-align: left;
}

.parking-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* ==========================================================================
   8. Responsive (모바일 / 태블릿 반응형: 768px 이하)
   ========================================================================== */
@media (max-width: 768px) {
    /*.sidebar-panel {*/
    /*    position: absolute;*/
    /*    top: 0;*/
    /*    left: 0;*/
    /*    width: 280px;*/
    /*    max-width: 80vw;*/
    /*    height: 100%;*/
    /*    margin-left: -280px;*/
    /*}*/

    /*.sidebar-panel.is-collapsed {*/
    /*    margin-left: -280px;*/
    /*}*/

    /*.sidebar-panel.is-open {*/
    /*    margin-left: 0 !important;*/
    /*}*/

    /*.sidebar-toggle-btn {*/
    /*    right: -28px;*/
    /*    width: 28px;*/
    /*    height: 54px;*/
    /*    font-size: 14px;*/
    /*}*/
}


/*본인인증 강조 말풍선에 map-legend-panel 가려지는거 막기*/
/*@media (max-width: 415px) {*/

/*    .map-legend-panel.authenticated {*/
/*        top: 48px;*/
/*    }*/
/*}*/

/* 월정기 신청 상태 뱃지 */
.application-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* 상태 표시 점 */
.application-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 신청 완료 */
.application-status-badge.is-applied {
    color: #1769D2;
    background-color: #EAF3FF;
    border: 1px solid #C8DEFF;
}

.application-status-badge.is-applied .application-status-dot {
    background-color: #2878E5;
    box-shadow: 0 0 0 3px rgba(40, 120, 229, 0.12);
}

/* 미신청 */
.application-status-badge.is-not-applied {
    color: #667085;
    background-color: #F2F4F7;
    border: 1px solid #E4E7EC;
}

.application-status-badge.is-not-applied .application-status-dot {
    background-color: #98A2B3;
}
/* 예상 요금 안내 아이콘 */
.fee-info-icon {
    display: inline-block;

    color: #E5484D;
    font-size: 14px;
    vertical-align: middle;
    cursor: help;
    transition: transform 0.2s ease, color 0.2s ease;
}

/* 마우스 오버 */
.fee-info-icon:hover {
    color: #C92A31;
    transform: scale(1.12);
}

/* 키보드 포커스 */
.fee-info-icon:focus-visible {
    outline: 2px solid #E5484D;
    outline-offset: 3px;
    border-radius: 50%;
}