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

/* 라이트 모드 (기본) 색상 정의 */
:root {
    color-scheme: light;
    --bg-color: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-hover-bg: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #2563eb;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-dark: #0f172a;
    
    --primary: #2563eb;
    --primary-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --primary-hover: #1d4ed8;
    --accent: #d97706;
    --danger: #dc2626;
    --success: #059669;
}

/* 다크 모드 색상 정의 */
body.dark-theme {
    color-scheme: dark;
    --bg-color: #080c14;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-hover-bg: rgba(31, 41, 55, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #3b82f6;
    
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --primary: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --primary-hover: #2563eb;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    min-height: 100vh;
}

/* 라이트모드 백그라운드 그라디언트 효과 */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.04) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(5, 150, 105, 0.02) 0px, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* 다크모드 백그라운드 그라디언트 효과 */
body.dark-theme::before {
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* 테마 토글 버튼 */
.theme-toggle-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    z-index: 1000;
    outline: none;
}

.theme-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3.5rem;
    padding-top: 1rem;
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #1d4ed8, #6d28d9, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

body.dark-theme header h1 {
    background: linear-gradient(135deg, #60a5fa, #c084fc, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
}

/* 뒤로가기 및 모바일 퀵 버튼 스타일 */
.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s ease;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    color: var(--primary);
}

.mobile-only-link {
    display: none;
}

/* Ad Areas */
.ad-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

body.dark-theme .ad-section {
    background: rgba(255, 255, 255, 0.02);
}

.ad-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Select Box Area */
.selector-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin-bottom: 2.5rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-theme .selector-panel {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

select {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme select {
    background: rgba(8, 12, 20, 0.8);
}

select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body.dark-theme select:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Custom Arrow */
.select-wrapper::after {
    content: "▼";
    font-size: 0.75rem;
    color: var(--text-muted);
    position: absolute;
    right: 1.25rem;
    bottom: 1.2rem;
    pointer-events: none;
}

/* Apartment List */
.list-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-section-title span {
    color: var(--primary);
}

.apt-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.apt-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    cursor: pointer;
}

.apt-card:hover {
    background: var(--card-hover-bg);
    border-color: rgba(37, 99, 235, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

body.dark-theme .apt-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.apt-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.apt-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.apt-address {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.apt-address span {
    background: rgba(0, 0, 0, 0.03);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

body.dark-theme .apt-address span {
    background: rgba(255, 255, 255, 0.05);
}

.apt-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.apt-card:hover .apt-arrow {
    color: var(--primary);
    transform: translateX(4px);
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.01);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

/* Detail Page */
.detail-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 2rem;
    align-items: start;
}

.detail-grid > div {
    min-width: 0; /* flex/grid 가로폭 강제 팽창 버그 차단 */
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary);
}

.apt-detail-header {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.25rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.apt-detail-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spec-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.spec-val {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 통계 카드 */
.stat-summary-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.08));
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 20px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
}

body.dark-theme .stat-summary-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-color: rgba(59, 130, 246, 0.2);
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.summary-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

/* 차트 / 그래프 영역 */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.bar-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 180px;
    padding-top: 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem;
    overflow-x: auto; /* 데이터 급증 시 막대 그래프 부분 독립 가로 스크롤 지원 */
    -webkit-overflow-scrolling: touch;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
    min-width: 45px; /* 기둥과 월별 텍스트 겹침 방지 최소 가로폭 */
}

.chart-bar {
    width: 65%;
    max-width: 35px;
    background: var(--primary-gradient);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
    position: relative;
}

.chart-bar:hover::after {
    content: attr(data-count);
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--bg-color);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.chart-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* 광고 영역 가로 삐져나감 방지 */
.ad-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 2rem 0;
    text-align: center;
}

/* 실거래 내역 테이블 */
.deals-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.deals-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.deals-panel-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.sort-btn {
    padding: 0.45rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

body.dark-theme .sort-btn {
    background: rgba(255, 255, 255, 0.05);
}

.sort-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: var(--primary);
}

body.dark-theme .sort-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.deal-table-wrapper {
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    /* 모바일 테이블 터치 드래그 스크롤링 지원 */
    -webkit-overflow-scrolling: touch;
}

.deal-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px; /* 모바일에서 찌그러지지 않도록 최소 가로폭 지정 */
}

.deal-table th {
    background: rgba(0, 0, 0, 0.03);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.85rem 1rem;
}

body.dark-theme .deal-table th {
    background: rgba(0, 0, 0, 0.2);
}

.deal-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.deal-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

body.dark-theme .deal-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.amount-badge {
    font-weight: 700;
    color: var(--accent);
}

.area-badge {
    font-family: monospace;
}

/* 사이드바 - 같은 동 다른 아파트 추천 */
.sidebar-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    position: sticky;
    top: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.sidebar-panel h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.recommend-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.recommend-item {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

body.dark-theme .recommend-item {
    background: rgba(255, 255, 255, 0.02);
}

.recommend-item:hover {
    background: var(--card-hover-bg);
    border-color: var(--primary);
    transform: translateX(3px);
}

.recommend-item span {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.chart-spinner {
    border: 3px solid rgba(0,0,0,0.05);
    width: 35px; height: 35px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

body.dark-theme .chart-spinner {
    border-color: rgba(255,255,255,0.05);
}

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

/* Responsive */
@media (max-width: 850px) {
    html {
        font-size: 15px !important; /* 모바일 표준 폰트 크기(15px)로 원복하여 오버 스케일링으로 인한 삐져나감 해소 */
    }

    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.8rem 0.4rem !important; /* 양옆 및 상하 여백 최소화 */
        box-sizing: border-box !important;
    }
    
    /* 상단 헤더 여백 대폭 압축 */
    header {
        margin-bottom: 1.25rem !important;
        padding-top: 0.5rem !important;
    }

    header h1 {
        font-size: 1.35rem;
    }

    header p {
        font-size: 0.8rem;
    }

    /* 선택 상자 및 버튼 폰트 */
    select {
        font-size: 0.9rem;
        padding: 0.75rem 0.95rem;
    }
    
    .select-wrapper label {
        font-size: 0.8rem;
    }

    /* 모든 패널 카드 모바일 가로폭 강제 제어 및 하단 마진 대폭 단축 */
    .selector-panel,
    .deals-panel,
    .chart-container,
    .apt-detail-header,
    .sidebar-panel,
    .stat-summary-card,
    .doc-panel {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 0.8rem !important; /* 기존 2rem에서 0.8rem(12px)로 세로 간격 압축 */
    }

    /* 약관 및 면책조항 페이지 가독성 */
    .doc-panel {
        padding: 1.25rem 0.75rem !important;
    }
    .doc-panel h2 {
        font-size: 1.25rem !important;
    }

    /* 아파트 리스트 */
    .apt-name {
        font-size: 1.1rem;
    }
    
    .apt-address span {
        font-size: 0.8rem;
    }

    /* 상세 페이지 아파트 정보 카드 패딩 촘촘화 */
    .apt-detail-header {
        padding: 1rem 0.65rem;
    }

    .apt-detail-header h2 {
        font-size: 1.4rem;
    }

    .specs-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .spec-label {
        font-size: 0.8rem;
    }

    .spec-val {
        font-size: 0.95rem;
    }

    /* 통계 요약 카드: 세로 간격 축소 */
    .stat-summary-card {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
        padding: 1rem 0.65rem !important;
    }
    .summary-item {
        border-right: none !important;
        border-bottom: none !important;
        padding-bottom: 0;
    }
    .summary-item:first-child {
        border-right: 1px solid var(--border-color) !important; /* 가운데 경계선 복구 */
    }
    
    .summary-label {
        font-size: 0.75rem;
    }
    
    .summary-value {
        font-size: 1.15rem;
    }

    /* 최근 거래량 추이 그래프 컨테이너 패딩 조율 */
    .chart-container {
        padding: 1.25rem 0.75rem;
    }
    
    .chart-title {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .bar-chart {
        height: 150px; /* 세로 공간을 위해 그래프 높이 살짝 단축 */
        padding-top: 15px;
    }

    /* 실거래가 상세 테이블 패딩 최소화 */
    .deals-panel {
        padding: 1rem 0.5rem;
    }

    .deals-panel-header h3 {
        font-size: 1.05rem;
    }

    /* 테이블 래퍼 가로폭 100% 절대 격리 및 스크롤 보장 */
    .deal-table-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
        border: 1px solid var(--border-color);
        border-radius: 12px;
    }

    /* 테이블 헤더 및 데이터 셀의 텍스트 줄바꿈/겹침 절대 차단 */
    .deal-table th,
    .deal-table td {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        white-space: nowrap !important; /* 글자가 겹쳐서 내려앉는 현상 원천 차단 */
    }

    .deal-table {
        min-width: 580px !important; /* 모바일에서 580px의 가로 한 줄 정렬 상태로 테이블만 래퍼 내에서 슬라이드 스크롤 */
        width: 100% !important;
    }

    .amount-badge {
        font-size: 0.9rem;
        font-weight: 700;
    }
    
    .area-badge {
        font-size: 0.85rem;
    }
    
    .sort-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.65rem;
    }
    
    .sidebar-panel h3 {
        font-size: 1.05rem;
    }
    
    .recommend-item {
        font-size: 0.9rem;
        padding: 0.7rem 0.8rem;
    }
    
    .recommend-item span {
        font-size: 0.75rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem; /* 간격 대폭 축소 */
    }
    
    .selector-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .sidebar-panel {
        position: static;
        padding: 1rem 0.65rem;
    }
    
    .theme-toggle-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.4rem !important;
        font-size: 0.85rem !important;
        border-radius: 50% !important;
        width: 34px !important;
        height: 34px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    #themeText {
        display: none !important;
    }

    .back-link {
        font-size: 0.75rem !important;
        margin-bottom: 0 !important;
    }

    /* 모바일 전용 다른 아파트 보기 링크 활성화 */
    .mobile-only-link {
        display: inline-block !important;
        padding: 0.35rem 0.65rem !important;
        background: rgba(37, 99, 235, 0.08) !important;
        border: 1px solid rgba(37, 99, 235, 0.15) !important;
        color: var(--primary) !important;
        text-decoration: none !important;
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        transition: all 0.2s ease !important;
    }
    .mobile-only-link:hover {
        background: var(--primary) !important;
        color: white !important;
    }

    /* 광고 영역 상하 마진 단축 */
    .ad-section {
        margin: 0.8rem 0 !important;
        padding: 0.8rem !important;
    }

    /* 푸터 상단 마진 단축 */
    footer {
        margin-top: 2.5rem !important;
        padding: 1.5rem 0 !important;
    }
}

/* Footer Styles */
footer {
    border-top: 1px solid var(--border-color);
    margin-top: 5rem;
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-disclaimer {
    font-size: 0.8rem;
    opacity: 0.8;
}

.footer-right {
    display: flex;
    gap: 1.5rem;
}

.footer-right a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-right a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .footer-right {
        justify-content: center;
    }
}

/* Modal Styles for Contact Form */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(8, 12, 20, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none; /* 초기값 숨김 */
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.dark-theme .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    padding: 2.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark-theme .modal-card {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--danger);
}

.modal-form .form-group {
    margin-bottom: 1.25rem;
}

.modal-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.modal-form input[type="text"],
.modal-form input[type="email"],
.modal-form textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

body.dark-theme .modal-form input[type="text"],
body.dark-theme .modal-form input[type="email"],
body.dark-theme .modal-form textarea {
    background: rgba(8, 12, 20, 0.8);
}

.modal-form input:focus,
.modal-form textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body.dark-theme .modal-form input:focus,
body.dark-theme .modal-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.modal-form textarea {
    resize: none;
    height: 140px;
    font-family: inherit;
}

.modal-btn-submit {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.modal-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.2);
}

/* External URL Button Style */
.btn-external {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    background: linear-gradient(135deg, #03cf5d, #02b34f); /* 네이버 상징 초록 그라데이션 */
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(3, 207, 93, 0.15);
    transition: all 0.2s ease;
}

.btn-external:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(3, 207, 93, 0.3);
    filter: brightness(1.05);
}

body.dark-theme .btn-external {
    box-shadow: 0 4px 15px rgba(3, 207, 93, 0.25);
}

/* PC에서는 기본적으로 모바일 전용 링크를 숨김 */
.mobile-only-link {
    display: none;
}

/* 검색 초기화 버튼 스타일 */
.btn-reset {
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

body.dark-theme .btn-reset {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .btn-reset:hover {
    background: rgba(239, 68, 68, 0.15);
}

