* {
    box-sizing: border-box;
    border: 0 solid #f2f3f7;
    margin: 0;
    padding: 0;
}

body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    color: #001A2C;
}

a {
    text-decoration: none;
    color: inherit;
}


/* =================================================================
   메인 검색 영역 (상단 파란 배경)
================================================================= */

.emotion-search-main {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    min-height: 50vh;
    padding: max(40px, calc(env(safe-area-inset-top) + 20px)) 12px 60px;
    position: relative;
}

.emotion-search-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.02)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.emotion-search-block {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.emotion-search-sub-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.emotion-search-main-title {
    color: white;
    font-size: clamp(20px, 4.5vw, 36px);
    font-weight: 700;
    margin-bottom: 40px;
    line-height: 1.4;
    text-shadow: 0 4px 16px rgba(0, 26, 44, 0.3);
}

/* =================================================================
   검색 입력 및 태그
================================================================= */

.emotion-search-input-box {
    margin-bottom: 50px;
}

.search-input {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: clamp(6px, 1.8vw, 8px) clamp(16px, 2.5vw, 20px);
    display: flex;
    align-items: flex-start; /* 위쪽부터 쌓이게 */
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 20px 40px rgba(0, 26, 44, 0.15);
    max-width: 600px;
    margin: 0 auto;
    transition: all 0.3s ease;
    min-height: 56px;
}

.search-input:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 48px rgba(0, 26, 44, 0.2);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.tag-item {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: tagSlideIn 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 87, 146, 0.2);
}

.tag-item .tag-text {
    user-select: none;
}

.tag-item .tag-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: white;
    transition: background 0.2s ease;
}

.tag-item .tag-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes tagSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.input-area {
    border: none;
    outline: none;
    flex: 1;
    font-size: 16px;
    padding: 12px 0;
    background: transparent;
    font-weight: 500;
    color: #001A2C;
    min-width: 200px;
}

.input-area::placeholder {
    color: rgb(156, 163, 175);
    font-weight: 400;
    transition: opacity 0.3s ease;
}

.search-btn-wrapper {
    margin-left: 10px;
}

.search-btn {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 87, 146, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 87, 146, 0.4);
}

/* =================================================================
   감정 카테고리
================================================================= */

.emotion-category-section {
    margin-bottom: 40px;
}

.category-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.category-toggle-wrapper {
    margin-bottom: 30px;
}

.category-toggle-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(248, 250, 252, 0.15) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    text-shadow: 0 1px 4px rgba(0, 26, 44, 0.3);
    box-shadow: 0 4px 16px rgba(0, 26, 44, 0.15);
}

.category-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(248, 250, 252, 0.25) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 26, 44, 0.2);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.emotion-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s ease;
}

.emotion-categories.show {
    max-height: 3000px; /* 충분한 높이 */
    opacity: 1;
    margin-top: 20px;
}

.category-group {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(248, 250, 252, 0.1) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.category-group:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 26, 44, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(248, 250, 252, 0.15) 100%);
}

.category-group-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: left;
    text-shadow: 0 2px 8px rgba(0, 26, 44, 0.3);
}

.emotion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emotion-tag {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    border: 1px solid rgba(0, 87, 146, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #001A2C;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 26, 44, 0.08);
}

.emotion-tag:hover {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 87, 146, 0.3);
}

.emotion-tag.selected {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 87, 146, 0.3);
}


/* =================================================================
   검색 결과 영역
================================================================= */

.search-results-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 60px 20px;
    margin-top: -50px; /* 메인 영역과 살짝 겹치도록 */
    position: relative;
    z-index: 2;
}

@supports(padding:max(0px)){
    .search-results-section{
        padding: max(40px, 6vw) 20px;
    }
}

.results-container {
    max-width: 1200px;
    margin: 0 auto;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-info {
    flex: 1;
}

.results-title {
    font-size: clamp(20px, 3.2vw, 28px);
    font-weight: 700;
    color: #001A2C;
    text-shadow: 0 2px 4px rgba(0, 26, 44, 0.1);
    margin-bottom: 20px;
}

.results-subtitle {
    font-size: 16px;
    color: #005792;
    font-weight: 500;
    margin-top: 8px;
}

.sort-filter {
    display: flex;
    gap: 12px;
}

.sort-dropdown {
    position: relative;
    z-index: 20;
    max-width: 100%;
}

.sort-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    border: 1px solid rgba(0, 87, 146, 0.15);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #001A2C;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 26, 44, 0.08);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: space-between;
}

.sort-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-color: rgba(0, 87, 146, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 87, 146, 0.12);
}

.sort-icon {
    transition: transform 0.3s ease;
}

.sort-dropdown.active .sort-icon {
    transform: rotate(180deg);
}

.sort-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 87, 146, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 26, 44, 0.15);
    z-index: 1000;
    min-width: 140px;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-width: 92vw;
    overflow-x: auto;
}

.sort-dropdown.active .sort-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-option {
    padding: 12px 16px;
    font-size: 14px;
    color: #001A2C;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px;
}

.sort-option:hover {
    background: linear-gradient(135deg, rgba(0, 87, 146, 0.1) 0%, rgba(0, 26, 44, 0.05) 100%);
    color: #005792;
}

.sort-option.active {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    color: white;
    font-weight: 600;
}

.sort-option.active:hover {
    background: linear-gradient(135deg, #004773 0%, #000F1A 100%);
}


/* =================================================================
   여행지 카드
================================================================= */

.destination-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.destination-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 87, 146, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 26, 44, 0.1);
}

.destination-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 26, 44, 0.15);
    border-color: rgba(0, 87, 146, 0.2);
}

.card-image {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.destination-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 24px;
}

.destination-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.destination-name {
    font-size: 20px;
    font-weight: 700;
    color: #001A2C;
    text-shadow: 0 1px 2px rgba(0, 26, 44, 0.1);
    flex: 1;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.destination-location {
    background: linear-gradient(135deg, rgba(0, 87, 146, 0.1) 0%, rgba(0, 26, 44, 0.05) 100%);
    color: #005792;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 87, 146, 0.15);
    white-space: nowrap;
    flex-shrink: 0;
    overflow-wrap: anywhere;
}

.destination-description {
    font-size: 14px;
    color: #005792;
    line-height: 1.6;
    font-weight: 400;
}


/* =================================================================
   찜하기 버튼 및 배지 (★ 최종 수정된 부분)
================================================================= */

/* 찜 버튼의 모든 상태에 적용될 공통 스타일 */
.like-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;

    /* 크기와 폰트 크기를 고정하여 위치 변경 방지 */
    width: 40px;
    height: 40px;
    font-size: 22px; /* 모든 상태에서 동일한 폰트 크기 유지 */

    /* 텍스트(하트)를 항상 정중앙에 위치시킴 */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* 수직 정렬 보정 */

    /* 기타 시각적 스타일 */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 26, 44, 0.1);

    /* 부드러운 전환 효과 (font-size 변경 제거) */
    transition: color 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

/* 기본 상태 (찜 안 함) */
.like-btn {
    color: #005792;
}

/* 'liked' 클래스가 추가된 상태 (찜 함) */
.like-btn.liked {
    color: #ff4757;
    animation: heartBeat 0.6s ease-in-out;
}

/* 마우스를 올렸을 때 효과 (찜 상태와 무관하게 동일하게 적용) */
.like-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.1); /* 레이아웃에 영향을 주지 않는 transform 사용 */
    box-shadow: 0 6px 20px rgba(0, 26, 44, 0.15);
}

/* 하트 애니메이션 (font-size 변경 제거) */
@keyframes heartBeat {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.emotion-badge {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 87, 146, 0.2);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #001A2C;
    box-shadow: 0 2px 8px rgba(0, 26, 44, 0.1);
}


/* =================================================================
   반응형 디자인
================================================================= */

@media (max-width: 1200px) {
    .emotion-search-main { padding: 60px 20px 80px; }
    .destination-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
}

@media (max-width: 768px) {
    .emotion-search-main { padding: 40px 16px 60px; min-height: 60vh; }
    .search-input { max-width: 100%; }
    .emotion-categories { grid-template-columns: 1fr; gap: 12px; }
    .category-group { padding: 16px; }
    .emotion-tag { font-size: 12px; padding: 5px 12px; }
    .destination-grid { grid-template-columns: 1fr; gap: 16px; }
    .card-image { height: 160px; }
    .results-header { flex-direction: column; align-items: flex-start; gap: 16px; }
}

@media (max-width: 640px){
    .destination-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@media (max-width: 480px) {
    .emotion-search-main { padding: 30px 12px 50px; }
    .search-input { padding: 6px 16px; }
    .input-area { font-size: 14px; padding: 12px 0; min-width: 120px; }
    .search-btn { width: 40px; height: 40px; }
    .category-group { padding: 12px; }
    .category-group-title { font-size: 14px; margin-bottom: 12px; }
    .popular-tags { gap: 8px; }
    .popular-tag { font-size: 12px; padding: 6px 12px; }
}

@media (max-width: 400px){
    .destination-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px){
    .search-btn { width: 36px; height: 36px; }
    .emotion-badge { font-size: 11px; padding: 4px 8px; }
    .card-image { height: 140px; }
    .destination-name { -webkit-line-clamp: 2; }
    .destination-name.is-medium { font-size: 17px; }
    .destination-name.is-small { font-size: 15px; }
}

.pagination {
    margin-top: 16px;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination .page-btn,
.pagination .page-nav {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* ✅ 활성화된 버튼을 그라디언트 색상으로 변경 */
.pagination .page-btn.active {
    background: linear-gradient(135deg, #005792 0%, #001A2C 100%);
    color: #fff;
    border: none; /* 경계선 지우고 싶으면 */
}

/* 비활성화 상태 */
.pagination .page-nav[disabled],
.pagination .page-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-ellipsis {
    padding: 0 4px;
    color: #94a3b8;
}
