/* ============== 러닝 지도 스타일 ============== */

/* 지도 섹션 */
.map-section {
    position: relative;
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 400px;
}

.main-map {
    width: 100%;
    height: 100%;
}

/* 지도 위 컨트롤 오버레이 */
.map-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 12px;
    pointer-events: none;
}

.map-controls-overlay > * {
    pointer-events: auto;
}

/* 검색 바 */
.map-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.map-search-input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    outline: none;
}

.map-search-input:focus {
    box-shadow: 0 2px 14px rgba(102, 126, 234, 0.3);
}

.map-search-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.map-search-btn:active {
    transform: scale(0.95);
}

/* 필터 칩 */
.filter-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.filter-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.filter-chip:active {
    transform: scale(0.95);
}

/* 내 위치 버튼 */
.my-location-btn {
    position: absolute;
    bottom: 180px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.my-location-btn:active {
    transform: scale(0.9);
    background: #f0f4ff;
}

/* 스팟 추가 FAB */
.add-spot-fab {
    position: absolute;
    bottom: 120px;
    right: 12px;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.8rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.2s;
    line-height: 1;
}

.add-spot-fab:active {
    transform: scale(0.9);
}

/* ============== 하단 스팟 리스트 ============== */

.spot-list-section {
    position: fixed;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 20;
    max-height: 50vh;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    touch-action: auto;
}

.spot-list-section.collapsed {
    max-height: 60px;
}

.spot-list-section.expanded {
    max-height: 70vh;
}

.spot-list-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    flex-shrink: 0;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.spot-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 10px;
    flex-shrink: 0;
}

.spot-list-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.spot-count {
    font-size: 0.8rem;
    color: #999;
    font-weight: 600;
}

.spot-list-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 0 12px 12px;
    flex: 1;
    min-height: 0;
}

/* 스팟 카드 */
.spot-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eef0ff;
}

.spot-card:active {
    transform: scale(0.98);
    background: #eef0ff;
}

.spot-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.spot-card-icon.road { background: #e3f2fd; }
.spot-card-icon.trail { background: #e8f5e9; }
.spot-card-icon.track { background: #fff3e0; }
.spot-card-icon.park { background: #f1f8e9; }
.spot-card-icon.riverside { background: #e0f7fa; }

.spot-card-info {
    flex: 1;
    min-width: 0;
}

.spot-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spot-card-meta {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    color: #999;
}

.spot-card-meta span {
    display: flex;
    align-items: center;
    gap: 2px;
}

.spot-card-arrow {
    color: #ccc;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* 빈 상태 */
.empty-spot-state {
    text-align: center;
    padding: 24px 16px;
}

.empty-spot-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.empty-spot-state p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.empty-spot-state .empty-sub {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 4px;
}

/* ============== 스팟 추가/수정 모달 ============== */

.form-section {
    margin-bottom: 20px;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* 스팟 타입 토글 */
.spot-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.spot-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.spot-type-btn.active {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}

.spot-type-btn:active {
    transform: scale(0.98);
}

.spot-type-hint {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 8px;
}

/* 스팟 지도 (모달 내) */
.spot-map {
    width: 100%;
    height: 250px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.spot-map-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-sm:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-danger {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.btn-danger:active {
    background: #ffcdd2;
}

.point-info {
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
    font-weight: 600;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.modal-footer .btn-primary {
    flex: 2;
}

.modal-footer .btn-secondary {
    flex: 1;
}

/* ============== 스팟 상세 모달 ============== */

.detail-spot-map {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.spot-detail-info {
    margin-bottom: 16px;
}

.spot-detail-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 4px;
}

.spot-detail-author {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 12px;
}

.spot-detail-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.spot-badge {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
}

.spot-badge.category {
    background: #e3f2fd;
    color: #1565c0;
}

.spot-badge.difficulty {
    background: #fff3e0;
    color: #e65100;
}

.spot-badge.surface {
    background: #f1f8e9;
    color: #33691e;
}

.spot-badge.distance {
    background: #fce4ec;
    color: #ad1457;
}

/* 탭 */
.detail-tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 16px;
}

.detail-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.detail-tab.active {
    color: #667eea;
}

.detail-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

/* 정보 탭 내용 */
.spot-meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spot-meta-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 10px;
}

.spot-meta-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.spot-meta-content {
    flex: 1;
}

.spot-meta-label {
    font-size: 0.75rem;
    color: #999;
    font-weight: 600;
}

.spot-meta-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

/* 번개 모임 탭 */
.meetup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.meetup-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.meetup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meetup-card {
    padding: 14px;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #eef0ff;
}

.meetup-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.meetup-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
}

.meetup-card-people {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 600;
    white-space: nowrap;
}

.meetup-card-datetime {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 8px;
}

.meetup-card-datetime span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.meetup-repeat-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}

.repeat-info-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
}

.meetup-card-desc {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
    margin-bottom: 10px;
}

.meetup-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meetup-card-author {
    font-size: 0.75rem;
    color: #aaa;
}

.meetup-join-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.meetup-join-btn:active {
    transform: scale(0.95);
}

.meetup-join-btn.joined {
    background: #e0e0e0;
    color: #999;
}

.meetup-join-btn.full {
    background: #ffcdd2;
    color: #c62828;
    cursor: default;
}

.empty-meetup {
    text-align: center;
    padding: 20px;
}

.empty-meetup p {
    font-size: 0.85rem;
    color: #999;
    margin: 0;
}

.empty-meetup .empty-sub {
    font-size: 0.8rem;
    color: #bbb;
    margin-top: 4px;
}

/* ============== 반응형 ============== */

@media (max-width: 480px) {
    .map-section {
        height: calc(100vh - 170px);
    }

    .spot-map {
        height: 200px;
    }

    .detail-spot-map {
        height: 180px;
    }

    .my-location-btn {
        bottom: 170px;
    }

    .add-spot-fab {
        bottom: 110px;
    }
}

/* 아이폰 하단 안전 영역 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .spot-list-section {
        bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

/* ============== 카카오맵 커스텀 오버레이 ============== */

.spot-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid white;
}

.spot-marker:active {
    transform: scale(1.2);
}

.spot-marker.road { background: #42a5f5; }
.spot-marker.trail { background: #66bb6a; }
.spot-marker.track { background: #ffa726; }
.spot-marker.park { background: #9ccc65; }
.spot-marker.riverside { background: #26c6da; }

/* ============== 좋아요/싫어요 & 공유 ============== */

.spot-reactions {
    padding: 14px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin: 12px 0;
}

.reaction-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.reaction-btn:active {
    transform: scale(0.95);
}

.reaction-btn.active-like {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}

.reaction-btn.active-dislike {
    border-color: #ef5350;
    background: #fff5f5;
    color: #ef5350;
}

.reaction-btn.share-btn {
    margin-left: auto;
}

.reaction-icon {
    font-size: 1rem;
}

.reaction-count {
    font-size: 0.8rem;
}

/* ============== 댓글 ============== */

.spot-comments-section {
    margin-top: 12px;
}

.comments-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 12px 0;
}

.comments-title span {
    color: #667eea;
    font-weight: 700;
}

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.comment-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.85rem;
    outline: none;
}

.comment-input:focus {
    border-color: #667eea;
}

.comment-submit-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.comment-submit-btn:active {
    transform: scale(0.95);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 10px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.comment-author {
    font-size: 0.8rem;
    font-weight: 700;
    color: #333;
}

.comment-date {
    font-size: 0.7rem;
    color: #bbb;
}

.comment-text {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 8px;
}

.comment-delete-btn:hover {
    color: #ef5350;
}

/* ============== 채팅방 ============== */

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg.other {
    align-self: flex-start;
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-msg.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg-author {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: #667eea;
}

.chat-msg.mine .chat-msg-author {
    color: rgba(255, 255, 255, 0.8);
}

.chat-msg-time {
    font-size: 0.65rem;
    color: #bbb;
    margin-top: 3px;
    text-align: right;
}

.chat-msg.mine .chat-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    background: white;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-send-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-empty {
    text-align: center;
    padding: 40px 16px;
    color: #bbb;
    font-size: 0.85rem;
}

/* ============== 모임 관리 버튼 ============== */

.meetup-creator-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.meetup-action-btn {
    padding: 5px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.meetup-action-btn:active {
    transform: scale(0.95);
}

.meetup-action-btn.edit {
    border-color: #667eea;
    color: #667eea;
}

.meetup-action-btn.end {
    border-color: #ffa726;
    color: #e65100;
}

.meetup-action-btn.delete {
    border-color: #ef5350;
    color: #c62828;
}

.meetup-action-btn.chat {
    border-color: #66bb6a;
    color: #2e7d32;
}

.meetup-status-ended {
    display: inline-block;
    padding: 3px 8px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
}

/* meetup header - just button right-aligned */
.meetup-header {
    justify-content: flex-end;
}
