/* 전체 레이아웃 */
body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
}

.container-fluid {
    padding: 20px;
}

/* 사이드바 스타일 */
.sidebar {
    background-color: #ffffff;
    border-right: 1px solid #dee2e6;
    padding: 0;
}

/* 기본 사이드바 (flex 아님) */
.sidebar:not(.sidebar-flex) {
    min-height: calc(100vh - 120px);
}

.sidebar .card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar .card-header {
    background-color: #6c757d;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem 0rem 1rem; /* 기본 패딩을 줄임 */
}

/* 사이드바 Flexbox 설정 */
.sidebar-flex {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 76px); /* 네비바 높이 제외 */
}

/* 팀 선택 카드 - 내용에 따라 높이 조정 */
.team-selection-card {
    flex-shrink: 0; /* 줄어들지 않음 */
    margin-bottom: 15px;
}

.team-selection-card .card-body {
    padding: 10px;
}

/* 날짜 필터 카드 */
.date-filter-card {
    flex-shrink: 0; /* 줄어들지 않음 */
    margin-bottom: 15px;
}

.date-filter-card .card-header {
    background-color: #17a2b8;
    color: white;
    font-weight: 600;
}

.date-filter-card .card-body {
    padding: 15px;
}

.date-filter-card .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.date-filter-card .form-select:focus {
    border-color: #17a2b8;
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25);
}

/* 장소 목록 카드 - 나머지 공간 모두 차지 */
.locations-card {
    flex: 1; /* 남은 공간 모두 차지 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* flexbox에서 overflow 처리를 위해 필요 */
}

/* 장소 목록 카드 바디 - flex로 설정 */
.locations-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 장소 목록 컨테이너 - 남은 공간 모두 차지하면서 스크롤 */
.locations-list-container {
    flex: 1; /* 남은 공간 모두 차지 */
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* flexbox에서 overflow 처리를 위해 필요 */
    padding-top: 10px;
}

/* 서클 프로그래스바 컨테이너 */
.progress-container {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    overflow: hidden;
}

/* 서클 스피너 */
.circle-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    position: relative;
}

.circle-spinner-inner {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(0, 123, 255, 0.3);
    border-left: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 로딩 텍스트 */
.loading-text {
    color: #495057;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 10px;
}

.loading-text i {
    color: #ffd700;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 로딩 도트 애니메이션 */
.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #007bff;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}
.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}
.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* 지도 스타일 */
.map-container {
    height: calc(100vh - 120px);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#map {
    height: 100%;
    width: 100%;
}

/* 팀 정보 스타일 */
.team-info {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.team-info h6 {
    color: #495057;
    margin-bottom: 10px;
}

/* 장소 목록 스타일 */
.location-item {
    padding: 2px 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.location-item:hover {
    background-color: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-2px);
}

.location-item.active {
    background-color: #2196f3;
    color: white;
    border-color: #2196f3;
}

.location-item .location-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.location-item.active .location-title {
    color: #ffffff;
}

.location-item .location-name {
    font-size: 0.95em;
    margin-bottom: 5px;
}

.location-item .location-date {
    font-size: 0.9em;
    color: #6c757d;
}

.location-item .location-description {
    font-size: 0.9em;
    margin-bottom: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #495057;
}

.location-item.active .location-date {
    color: #ffffff;
}

.location-item.active .location-description {
    color: #ffffff;
}

/* 모달 스타일 */
.modal-xl {
    max-width: 1200px;
}

.upload-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.upload-section:hover {
    border-color: #adb5bd;
}

/* 파일 목록 스타일 */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.file-item .file-info {
    flex: 1;
    margin-left: 10px;
}

.file-item .file-name {
    font-weight: 600;
    font-size: 0.9em;
}

.file-item .file-size {
    font-size: 0.8em;
    color: #6c757d;
}

.file-item .file-actions {
    display: flex;
    gap: 8px;
}

.file-item .btn-sm {
    padding: 4px 8px;
    font-size: 0.8em;
}

/* 대표 사진 표시 */
.representative-photo {
    border: 3px solid #28a745;
    position: relative;
}

.representative-photo::after {
    content: '대표';
    position: absolute;
    top: -10px;
    left: -10px;
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
}

/* 지도 마커 정보창 스타일 */
.info-window {
    padding: 10px;
    max-width: 300px;
    font-family: 'Noto Sans KR', sans-serif;
}

.info-window h6 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.info-window .info-date {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.info-window .info-description {
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #34495e;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.info-window .info-reference {
    font-size: 0.85em;
    color: #8e44ad;
    background-color: #f8f9ff;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    border-left: 3px solid #8e44ad;
}

/* 이미지 갤러리 스타일 */
.info-image-gallery {
    margin: 8px 0;
}

.info-image-gallery .main-image {
    margin-bottom: 6px;
}

.info-window .representative-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    background-color: #f8f9fa;
}

.info-window .representative-image:hover {
    transform: scale(1.02);
}

/* 썸네일 갤러리 스타일 */
.thumbnail-gallery {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.thumbnail {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
    background-color: #f8f9fa;
}

.thumbnail:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: #3498db;
}

.thumbnail.active {
    opacity: 1;
    border-color: #2980b9;
    box-shadow: 0 0 8px rgba(41, 128, 185, 0.4);
}

.more-photos {
    width: 40px;
    height: 40px;
    background-color: #95a5a6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
}

/* 유튜브 섹션 스타일 */
.info-youtube {
    margin: 8px 0;
    position: relative;
}

.youtube-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: contain;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #e74c3c;
    background-color: #f8f9fa;
}

.youtube-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.youtube-thumbnail::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(231, 76, 60, 0.9);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    pointer-events: none;
}

.youtube-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
}

/* InfoWindow 편집 버튼 스타일 */
.info-window .btn-edit {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 8px;
    width: 100%;
}

.info-window .btn-edit:hover {
    background-color: #2980b9;
}

/* 여행 경로 선 스타일 */
.route-line {
    stroke: #e74c3c;
    stroke-width: 3;
    stroke-dasharray: none;
}

/* 로딩 스피너 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 토스트 알림 스타일 */
.toast {
    min-width: 300px;
}

.toast-header {
    background-color: #2c3e50;
    color: white;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .sidebar {
        margin-bottom: 20px;
    }

    .map-container {
        height: calc(100vh - 100px); /* 전체 화면 높이에서 네비바와 여백 제외 */
        position: relative;
    }

    .modal-xl {
        max-width: 95%;
    }

    /* 모바일에서 지도가 전체 화면을 차지하도록 */
    .container-fluid {
        padding: 10px;
    }

    /* 모바일에서 지도 영역을 더 크게 */
    .col-md-9 {
        padding: 0;
    }

    /* 모바일에서 지도 컨테이너를 고정 높이로 */
    .map-container {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        position: relative;
    }

    /* 현재 위치 토글 버튼 */
.current-location-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.current-location-toggle .btn {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: none;
    background-color: #4285F4;
    color: white;
    transition: all 0.3s ease;
    font-size: 18px;
}

.current-location-toggle .btn:hover {
    background-color: #3367D6;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.current-location-toggle .btn:active {
    transform: scale(0.95);
}

.current-location-toggle .btn i {
    font-size: 18px;
}

/* 위치 추적 중일 때 버튼 스타일 */
.current-location-toggle .btn.tracking {
    background-color: #34A853;
    animation: pulse 2s infinite;
}

/* 위치 권한 거부 시 버튼 스타일 */
.current-location-toggle .btn.disabled {
    background-color: #9E9E9E;
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(52, 168, 83, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(52, 168, 83, 0.8);
    }
    100% {
        box-shadow: 0 4px 12px rgba(52, 168, 83, 0.4);
    }
}

/* 모바일용 플로팅 장소 선택 버튼 */
    .mobile-location-selector {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 1000;
        display: block; /* 항상 표시 */
    }

    .mobile-location-selector .btn {
        background-color: rgba(13, 110, 253, 0.9);
        border: none;
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 14px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(10px);
    }

    .mobile-location-selector .btn:hover {
        background-color: rgba(13, 110, 253, 1);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    /* 모바일에서 사이드바 스크롤 개선 */
    .sidebar {
        max-height: calc(100vh - 100px); /* 전체 화면 높이로 확장 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 모바일에서 장소 아이템 터치 개선 */
    .location-item {
        padding: 12px;
        margin-bottom: 8px;
        border-radius: 8px;
        transition: all 0.2s ease;
    }

    .location-item:active {
        transform: scale(0.98);
        background-color: #e9ecef;
    }
}

/* 사진 갤러리 스타일 */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.photo-gallery img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.3s ease;
    background-color: #f8f9fa;
}

.photo-gallery img:hover {
    transform: scale(1.05);
}

/* 네비게이션 바 스타일 */
.navbar-brand {
    font-weight: 600;
    font-size: 1.3em;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #f8f9fa !important;
}

/* 버튼 스타일 개선 */
.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #95a5a6;
    border-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
}

/* 전체 장소 모드 스타일 */
.all-location-item {
    border-left: 4px solid #17a2b8 !important; /* 파란색 테두리 */
}

.all-location-item:hover {
    background-color: rgba(23, 162, 184, 0.1);
}

.all-location-item.active {
    background-color: rgba(23, 162, 184, 0.2);
    border-left-color: #138496 !important;
}

/* 팀 정보 표시 스타일 */
.location-team {
    font-size: 12px;
    color: #17a2b8;
    font-weight: 600;
    margin-bottom: 4px;
    padding: 2px 6px;
    background-color: rgba(23, 162, 184, 0.1);
    border-radius: 12px;
    display: inline-block;
}

.info-team {
    font-size: 13px;
    color: #17a2b8;
    font-weight: 600;
    margin-bottom: 6px;
    padding: 4px 8px;
    background-color: rgba(23, 162, 184, 0.1);
    border-radius: 12px;
    display: inline-block;
}

/* 편집 안내 메시지 */
.info-notice {
    margin-top: 10px;
    padding: 8px 12px;
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
    font-style: italic;
}

/* Google Places Autocomplete 스타일 개선 */
.pac-container {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    z-index: 1060 !important; /* Bootstrap 모달보다 위에 표시 */
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, sans-serif;
}

.pac-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
}

.pac-item:hover {
    background-color: #f8f9fa;
}

.pac-item-selected {
    background-color: #e3f2fd !important;
}

.pac-matched {
    font-weight: 600;
    color: #1976d2;
}

.pac-icon {
    margin-right: 8px;
}

/* 새 장소 추가 모달에서 Places 입력 필드 강조 */
#newLocationName:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.25);
}

/* Places 자동완성 입력 필드 스타일 */
#newLocationName {
    position: relative;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

/* 좌표 입력 필드 스타일 */
#newLocationLat,
#newLocationLng {
    background-color: #f8f9fa;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* 모달 내 폼 스타일 개선 */
#addLocationForm .form-label {
    font-weight: 600;
    color: #2c3e50;
}

/* 팀 파일 프리뷰 스타일 */
.team-file-preview {
    max-width: 100px;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f8f9fa;
}

.team-file-preview:hover {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* 팀 업로드된 파일 컨테이너 */
#teamUploadedFiles {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

#teamUploadedFiles h6 {
    margin-bottom: 10px;
    color: #495057;
}

#teamUploadedFiles .uploaded-files {
    margin-bottom: 20px;
}

/* 기타파일 아이콘 스타일 */
.other-file-icon {
    font-size: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

.other-file-icon.pdf {
    color: #dc3545;
}

.other-file-icon.doc {
    color: #0d6efd;
}

.other-file-icon.txt {
    color: #6c757d;
}

.other-file-icon.xls {
    color: #198754;
}

.other-file-icon.ppt {
    color: #fd7e14;
}

.other-file-icon.default {
    color: #6f42c1;
}

.other-file-icon.zip {
    color: #ffc107;
}

/* 전체 경로 보기 버튼 스타일 */
#showAllRoutesBtn {
    background-color: #ffffff;
    color: #3498db;
    border-color: #3498db;
    font-weight: 600;
    transition: all 0.3s ease;
}

#showAllRoutesBtn:hover {
    background-color: #3498db;
    color: #ffffff;
    border-color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

#showAllRoutesBtn:focus {
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* 장소 추가 버튼 스타일 */
#addLocationBtn {
    background-color: #ffffff;
    color: #28a745;
    border-color: #28a745;
    font-weight: 600;
    transition: all 0.3s ease;
}

#addLocationBtn:hover {
    background-color: #28a745;
    color: #ffffff;
    border-color: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

#addLocationBtn:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* 기타파일 프리뷰 스타일 */
.other-file-preview {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.other-file-preview:hover {
    background-color: #e9ecef;
}

.other-file-preview .file-info {
    flex-grow: 1;
}

.other-file-preview .file-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.other-file-preview .file-size {
    font-size: 0.9em;
    color: #6c757d;
}
