/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* GPS 및 위치 관련 스타일 */
.controls {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.location-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #1e7e34;
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-search {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-search:hover {
    background: #138496;
}

.location-info {
    font-size: 12px;
    color: #6c757d;
    font-family: monospace;
    display: none;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-type-filter {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.card-type-filter label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.nearby-filter {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nearby-filter label {
    font-size: 14px;
    cursor: pointer;
}

.search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-controls input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
}

.search-controls input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* 로딩 인디케이터 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* GPS 도움말 */
.gps-help {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    z-index: 1000;
}

.gps-help h4 {
    margin-bottom: 10px;
    color: #856404;
}

.gps-help p {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.gps-help button {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
}

/* 헤더 스타일 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 600;
}

header p {
    font-size: 14px;
    opacity: 0.9;
}

/* 지도 컨테이너 */
.map-container {
    width: 100%;
    height: 400px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 15px 0;
    overflow: hidden;
}

/* 매장 리스트 */
.store-list-container {
    padding: 15px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.store-list-container h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #495057;
}

.store-list {
    max-height: 300px;
    overflow-y: auto;
}

.store-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
}

.store-item:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.store-item h4 {
    margin-bottom: 5px;
    color: #343a40;
    font-size: 1rem;
}

.store-item .address {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.store-item .card-types {
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.store-item .distance {
    color: #28a745;
    font-size: 0.85rem;
    font-weight: 500;
}

.store-list-notice {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #b3d7ff;
    color: #004085;
    text-align: center;
    margin-bottom: 15px;
}

/* 마커 인포윈도우 */
.marker-info {
    padding: 10px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 200px;
}

.marker-info strong {
    display: block;
    margin-bottom: 5px;
    color: #343a40;
}

.marker-info .card-types {
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    display: inline-block;
    margin-top: 5px;
}

.marker-info.gwangju .card-types {
    background: #fff3cd;
    color: #856404;
}

.marker-info.onnuri .card-types {
    background: #d1ecf1;
    color: #0c5460;
}

.marker-info.both .card-types {
    background: #e2e3ff;
    color: #383d41;
}

.marker-info .distance {
    color: #28a745;
    font-weight: bold;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .controls {
        padding: 10px;
        gap: 10px;
    }
    
    .location-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .card-type-filter {
        justify-content: center;
    }
    
    .map-container {
        height: 300px;
        border-radius: 0;
        margin: 10px 0;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .gps-help {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* 헤더 스타일 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-align: center;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.filter-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.checkmark.onnuri {
    background-color: #ff6b6b;
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.checkmark.gwangju {
    background-color: #4ecdc4;
    border: 2px solid rgba(78, 205, 196, 0.3);
}

.checkmark.nearby {
    background-color: #ffa726;
    border: 2px solid rgba(255, 167, 38, 0.3);
}

.filter-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.filter-label input[type="checkbox"]:not(:checked) + .checkmark {
    opacity: 0.3;
}

.search-group {
    display: flex;
    gap: 10px;
}

.location-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.location-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.location-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.location-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.location-info {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.location-filter {
    margin-top: 5px;
}

/* 사용자 위치 마커 스타일 (Leaflet용) */
.user-location-marker {
    background: transparent !important;
    border: none !important;
    color: #2ecc71;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#search-input {
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    width: 200px;
}

#search-btn {
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

#search-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 메인 콘텐츠 스타일 */
.main-content {
    display: flex;
    height: calc(100vh - 140px);
}

.map-container {
    flex: 1;
    min-height: 500px;
}

.sidebar {
    width: 300px;
    border-left: 1px solid #e0e0e0;
    background-color: #fafafa;
    overflow-y: auto;
}

/* 통계 스타일 */
.stats {
    padding: 20px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat-count {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

/* 매장 목록 스타일 */
.store-list {
    padding: 20px;
}

.store-list h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.store-item {
    padding: 12px;
    margin-bottom: 8px;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.store-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.store-item.onnuri {
    border-left-color: #ff6b6b;
}

.store-item.gwangju {
    border-left-color: #4ecdc4;
}

.store-item.both {
    border-left: 4px linear-gradient(to bottom, #ff6b6b 50%, #4ecdc4 50%);
    background: linear-gradient(to right, rgba(255, 107, 107, 0.05) 50%, rgba(78, 205, 196, 0.05) 50%);
}

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

.store-address {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.store-types {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.type-badge {
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
    color: white;
}

.type-badge.onnuri {
    background-color: #ff6b6b;
}

.type-badge.gwangju {
    background-color: #4ecdc4;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

/* 로딩 애니메이션 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
        order: 2;
        max-height: 300px;
    }
    
    .map-container {
        order: 1;
        height: 400px;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-group {
        width: 100%;
    }
    
    #search-input {
        flex: 1;
        width: auto;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .header {
        padding: 15px;
    }
    
    .filter-group {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
}