/* app/static/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- [1] 기본 및 루트 변수 --- */
:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --accent: #c8102e;
    --text-dark: #0f172a;
    --text-gray: #64748b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --header-height: 90px;
}

/* --- [2] 전역 스타일 리셋 --- */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; padding: 0; font-family: 'Inter', sans-serif; background-color: var(--bg-light); color: var(--text-dark); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* --- [3] OKOnsen-style header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    box-sizing: border-box;
}

.header-left { justify-self: start; }
.logo-wrapper { justify-self: center; display: flex; align-items: center; }
.header-right { justify-self: end; }

.logo-img {
    height: 64px;
    width: auto;
    display: block;
}

.nav-guide-link {
    font-weight: 700;
    color: #444;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-guide-link:hover { color: var(--accent); }

.lang-selector { display: flex; gap: 8px; }
.lang-btn {
    padding: 5px 15px;
    font-size: 0.85rem;
    font-weight: 800;
    border: 1px solid #ddd;
    background: #fff;
    color: #999;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s;
}
.lang-btn.active {
    background: var(--text-dark);
    color: #fff;
    border-color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.top-filter-bar {
    width: 100%;
    background: #fff;
    padding: 10px 0 14px;
    border-top: 1px solid #f2f2f2;
}

.theme-filter-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px;
    scroll-snap-type: x proximity;
}
.theme-filter-buttons::-webkit-scrollbar { display: none; }

.theme-button {
    padding: 7px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex: 0 0 auto;
    scroll-snap-align: start;
}
.filter-emoji { font-size: 0.95rem; line-height: 1; }
.filter-label { line-height: 1.1; }
.theme-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.theme-button.active {
    background: var(--text-dark);
    color: #fff;
    border-color: var(--text-dark);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
}
.count-badge {
    background: #eee;
    color: #666;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 800;
    min-width: 1.25em;
    text-align: center;
}
.theme-button.active .count-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* legacy header (detail pages hide header block) */
.fixed-top-area {
    display: none;
}
.main-header {
    display: none;
}

/* --- [4] 필터 컨트롤 및 드롭다운 스타일 --- */
.filter-controls {
    display: flex;
    align-items: center;
}

.tag-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px; 
    border-radius: 999px;
    background: white;
    border: 1px solid var(--border);
    font-size: 0.95rem; 
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    cursor: pointer;
    width: auto; 
}

.tag-filter-btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.tag-filter-btn.active { 
    background: var(--text-dark); 
    color: white; 
    border-color: var(--text-dark); 
}

.filter-dropdown { position: relative; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 0; 
    background: var(--white);
    border-radius: 16px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.12); 
    border: 1px solid var(--border);
    width: 260px; 
    z-index: 1100;
    padding: 8px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .dropdown-menu {
        left: auto;
        right: 0; 
    }
}

.filter-dropdown.is-open .dropdown-menu { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.dropdown-item:hover { background-color: var(--bg-light); }

.dropdown-item .tag-icon { 
    margin-right: 12px; 
    font-size: 1.1rem; 
    width: 24px; 
    text-align: center;
    display: inline-flex;
    justify-content: center;
}

.dropdown-item .tag-name { flex-grow: 1; font-weight: 500; font-size: 0.95rem; }

.dropdown-item .tag-count { 
    font-size: 0.8rem; 
    color: var(--text-gray); 
    background-color: #f1f5f9; 
    padding: 4px 10px; 
    border-radius: 999px;
    font-weight: 600;
}

/* --- [5] 이후 레이아웃 스타일 --- */
.school-card.is-filter-hidden,
.card-grid.is-filter-empty,
.section-header.is-filter-empty {
    display: none !important;
}
.map-section {
    width: 100%;
    height: 50vh;
    min-height: 400px;
    background: #e5e7eb;
}
.content-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 48px;
}
#map { width: 100%; height: 100%; }
.content-wrapper { max-width: 1400px; margin: 60px auto; padding: 0 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.section-title { font-size: 1.6rem; font-weight: 800; margin: 0; }
.view-all { color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: var(--shadow-md);
    font-weight: 700;
    color: var(--text-dark);
}
.quick-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.quick-filter-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
}
.quick-filter-chip.is-active {
    background: var(--text-dark);
    color: #fff;
    border-color: var(--text-dark);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
.card { background: var(--white); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); display: flex; flex-direction: column; transition: transform 0.3s ease, box-shadow 0.3s ease; content-visibility: auto; contain-intrinsic-size: 430px; }
.card:hover { transform: translateY(-8px); box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
.card-img { width: 100%; height: 220px; background-size: cover; background-position: center; position: relative; }
.card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-badge { position: absolute; top: 15px; left: 15px; padding: 5px 12px; border-radius: 8px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(5px); }
.card-body { padding: 24px; flex-grow: 1; }
.card-body h4 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.school-card.is-highlighted {
    outline: 3px solid #f59e0b;
    transform: translateY(-4px);
}
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-gray); margin-bottom: 20px; }
.card-footer { padding: 18px 24px; background: #fcfcfc; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-price { font-weight: 800; color: var(--primary); font-size: 1rem; }
.detail-container, .list-container { max-width: 1000px; margin: 32px auto 80px; padding: 0 24px; }
.back-to-list-btn { display: inline-flex; align-items: center; gap: 8px; background: #f1f5f9; color: var(--text-dark); padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; margin-bottom: 24px; transition: background-color 0.2s; }
.back-to-list-btn:hover { background-color: #e2e8f0; }
.detail-header, .list-header { margin-bottom: 40px; }
.detail-title, .list-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 15px; }
.detail-category { color: var(--primary); font-weight: 700; text-transform: uppercase; font-size: 0.9rem; display: block; }
.detail-guide-hero {
    margin: -12px 0 28px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
}
.detail-guide-hero img {
    width: 100%;
    max-height: 380px;
    display: block;
    object-fit: cover;
}
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin: 40px 0; }
.info-item { background: white; padding: 24px; border-radius: 16px; border: 1px solid var(--border); text-align: center; }
.info-label { font-size: 0.75rem; color: var(--text-gray); text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.info-value { font-size: 1.1rem; font-weight: 800; }
.detail-content h2 { font-size: 1.5rem; margin-top: 50px; border-bottom: 2px solid var(--border); padding-bottom: 15px; }
.detail-content table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 25px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.detail-content th { background: #f8fafc; padding: 15px; font-weight: 700; text-align: left; }
.detail-content td { padding: 15px; border-bottom: 1px solid var(--border); }
.detail-cta-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 30px;
}
.detail-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}
.gm-style-iw-c { padding: 0 !important; border-radius: 16px !important; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important; }
.gm-style-iw-d { overflow: hidden !important; }
.info-window-content { padding: 20px; width: 280px; }
.iw-header .iw-badge { color: white; padding: 4px 10px; border-radius: 6px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; display: inline-block; margin-bottom: 12px; }
.iw-header .iw-title { font-size: 1.1rem; font-weight: 700; color: var(--text-dark); margin: 0 0 6px; }
.iw-header .iw-address { font-size: 0.85rem; color: var(--text-gray); margin: 0 0 16px; }
.iw-details-btn { display: block; width: 100%; padding: 12px; text-align: center; background-color: var(--primary); color: white; border-radius: 10px; font-weight: 600; transition: background-color 0.2s; }
.iw-details-btn:hover { background-color: #1d4ed8; }
.main-footer { background: #0f172a; color: #94a3b8; padding: 48px 24px 40px; text-align: center; font-size: 0.9rem; }
.footer-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}
.footer-stats .stat-pill { margin: 0; }
.footer-links { margin-bottom: 20px; display: flex; justify-content: center; gap: 30px; }
.footer-links a { color: #cbd5e1; font-weight: 500; }
.footer-links a:hover { color: white; }

.family-site-card:hover {
    transform: translateY(-2px);
    border-color: #475569 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

/* --- [10] 반응형 --- */
@media (max-width: 768px) {
    .header-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 8px;
    }
    .header-left { grid-column: 1; grid-row: 1; }
    .header-right { grid-column: 2; grid-row: 1; justify-self: end; }
    .logo-wrapper { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
    .logo-img { height: 52px; }
    .nav-guide-link { font-size: 0.85rem; }
    .map-section { min-height: 340px; height: 45vh; }
    .top-filter-bar { padding: 6px 0 8px; }
    .theme-filter-buttons { justify-content: flex-start; gap: 6px; padding: 0 8px; }
    .theme-button { padding: 5px 9px; font-size: 0.72rem; gap: 3px; }
    .filter-emoji { font-size: 0.85rem; }
    .count-badge { font-size: 0.58rem; padding: 1px 5px; min-width: 1.1em; }
    .detail-container, .list-container { padding-left: 16px; padding-right: 16px; }
    .section-title { font-size: 1.4rem; text-align: center; } 
    .section-header { justify-content: center; flex-direction: column; gap: 10px; } 
    .detail-title, .list-title { font-size: 2rem; text-align: center; }
    .card-grid, .info-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
    .card { border-radius: 16px; }
    .card-body, .card-footer { padding-left: 16px; padding-right: 16px; }
    .card-img { height: 200px; }
    .footer-links { flex-wrap: wrap; gap: 14px 20px; }
    .stats-banner { justify-content: center; }
    .stat-pill { width: 100%; justify-content: center; text-align: center; }
    .detail-cta-panel { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .logo-img { height: 44px; }
    .map-section { min-height: 300px; height: 40vh; }
    .content-wrapper { padding: 0 12px 32px; }
    .section-title { font-size: 1.2rem; }
    .detail-title, .list-title { font-size: 1.6rem; }
}

/* --- [11] 상세/리스트 페이지 전용 심플 헤더 스타일 --- */
.main-header.simple-header {
    display: flex !important;
    flex-direction: row !important;     
    justify-content: center !important; 
    align-items: center !important;     
    height: 80px !important;            
    padding: 0 24px !important;         
    gap: 0 !important;
}

.main-header.simple-header .logo {
    width: auto !important;             
    margin: 0 !important;               
    order: 0 !important;                
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .simple-header ~ .content-wrapper,
    .simple-header ~ .detail-container, 
    .simple-header ~ .list-container {
        margin-top: 100px !important;
    }
}

/* --- [12] 지도 커스텀 마커 (OKOnsen photo style) --- */
.marker-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid #fff;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.marker-icon:hover {
    transform: scale(1.15) translateY(-4px);
    z-index: 999;
}
.marker-icon.map-marker-active {
    transform: scale(1.2) translateY(-4px);
    box-shadow: 0 0 0 3px var(--accent), 0 6px 16px rgba(0, 0, 0, 0.3);
}

.map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); 
    border: 2px solid white; 
    font-size: 1.1rem;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.map-marker::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid; 
}

.map-marker.marker-univ { background-color: var(--accent); }
.map-marker.marker-univ::after { border-top-color: var(--accent); }
.map-marker.marker-school { background-color: var(--primary); }
.map-marker.marker-school::after { border-top-color: var(--primary); }

.map-marker:hover {
    transform: scale(1.1) translateY(-4px); 
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}
.map-marker.map-marker-active {
    transform: scale(1.15) translateY(-6px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
    z-index: 1200;
}

/* --- [13] [신규] 리액션 (좋아요/싫어요) 스타일 --- */
.reaction-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background-color: var(--white);
    color: var(--text-gray);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.reaction-btn i {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

/* 마우스 오버 효과 */
.reaction-btn:hover {
    background-color: var(--bg-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.reaction-btn:hover i {
    transform: scale(1.1) rotate(-5deg);
}

/* 활성화(클릭됨) 상태: 좋아요 */
.reaction-btn.active-like {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.reaction-btn.active-like:hover {
    background-color: #1d4ed8; 
}

/* 활성화(클릭됨) 상태: 싫어요 */
.reaction-btn.active-dislike {
    background-color: #f43f5e; 
    color: var(--white);
    border-color: #f43f5e;
}

.reaction-btn.active-dislike:hover {
    background-color: #e11d48; 
}

/* --- [14] 통계 배지 (Stats Banner) 스타일 --- */
.stats-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px; 
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #1e293b; /* 다크 네이비 배경 */
    color: #e2e8f0;
    padding: 10px 18px;
    border-radius: 8px; /* 둥근 사각형 */
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #334155;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-pill i {
    color: #94a3b8;
    font-size: 1rem;
}

/* 숫자/날짜 하이라이트 색상 */
.stat-highlight {
    color: #f59e0b; /* 오렌지/옐로우 포인트 */
    font-weight: 800;
    margin-right: 4px;
}

/* 마지막 배지 (Updating Weekly) 특별 스타일 */
.stat-pill.highlight-pill {
    border-color: #f59e0b; 
    background-color: rgba(245, 158, 11, 0.1);
}

.stat-pill.highlight-pill i, 
.stat-pill.highlight-pill .stat-highlight {
    color: #f59e0b;
    margin: 0;
}