/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 브레드크럼 네비게이션 */
.breadcrumb {
    background: #f8f9fa;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #6c757d;
    font-weight: 500;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 네비게이션 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* 메인 컨텐츠 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 검색 및 필터 섹션 */
.search-filter-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.search-box button:hover {
    transform: translateY(-2px);
}

.filter-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-container select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-container select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-container button {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.filter-container button:hover {
    background: #5a6268;
}

/* 페이지네이션 */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 20px 0;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

#pageNumbers {
    display: flex;
    gap: 5px;
}

/* Intro 섹션 */
.intro-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.intro-content {
    max-width: 100%;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #495057;
    text-align: justify;
    margin: 0;
}

/* 관련 아파트 링크 */
.related-apartments {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.related-apartments h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.related-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.related-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.related-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.link-icon {
    font-size: 1.2rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.link-text {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.no-related-apartments {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.no-apartments-icon {
    font-size: 1.5rem;
    margin-right: 12px;
}

.no-apartments-text {
    font-size: 1rem;
    font-weight: 500;
}

/* 아파트 헤더 */
.apartment-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.apartment-title {
    font-size: 2.8rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.apartment-location {
    font-size: 1.2rem;
    opacity: 0.9;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.location, .build-year {
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* 요약 통계 */
.summary-stats {
    margin-bottom: 40px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    text-align: center;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2d3748;
    margin: 0;
}

.stat-value.primary {
    color: #e74c3c;
    font-size: 2.2rem;
}

/* 분석 섹션 */
.analysis-section, .trend-section, .transaction-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
}

.analysis-section h2, .trend-section h2, .transaction-section h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 25px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* 평형별 분석 */
.area-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.area-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #38a169;
}

.area-group h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.area-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.area-stats .stat {
    color: #4a5568;
    font-size: 0.9rem;
    padding: 5px 0;
}

/* 차트 섹션 */
.chart-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
}

.chart-section h3 {
    font-size: 1.4rem;
    color: #2d3748;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
}

.chart-container canvas {
    max-width: 100%;
    height: 100%;
}

/* 전용면적 필터 */
.area-filter {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.filter-label {
    font-weight: 600;
    margin-bottom: 15px;
    color: #2d3748;
    font-size: 1rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.filter-result {
    font-size: 14px;
    color: #718096;
    font-style: italic;
    margin-top: 10px;
}

/* 거래내역 테이블 */
.transaction-table {
    margin-top: 20px;
    overflow-x: auto;
}

.transaction-table h3 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.4rem;
}

.transaction-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.transaction-table th {
    background: #667eea;
    color: white;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.transaction-table th:hover {
    background: #5a6fd8;
}

.transaction-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.transaction-table tr:hover {
    background-color: #f8f9fa;
}

.transaction-table .price {
    font-weight: bold;
    color: #e74c3c;
}

/* 푸터 */
.footer {
    background: white;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin-top: 40px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
}

.footer-content p {
    color: #718096;
    margin-bottom: 10px;
}

.update-info {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 인덱스 페이지 전용 스타일 */
.main-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 전체 통계 요약 */
.overview-stats {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-item {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    text-align: center;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #718096;
}

/* 구별 현황 */
.district-summary {
    margin-bottom: 40px;
}

.district-summary h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 20px;
    text-align: center;
}

.district-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.district-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    border-left: 4px solid #38a169;
}

.district-item h3 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 15px;
}

.district-stats div {
    margin-bottom: 8px;
    color: #4a5568;
}

/* 컨트롤 패널 */
.controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #2d3748;
}

.control-group select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

.search-group {
    margin-left: auto;
}

.search-group input {
    padding: 8px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

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

/* 아파트 섹션 */
.apartments-section h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 25px;
    text-align: center;
}

.apt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.apt-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border-left: 4px solid #667eea;
}

.apt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.apt-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 10px;
    line-height: 1.3;
}

.apt-info {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.apt-price {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 10px;
}

.rank {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

a {
    text-decoration: none;
    color: inherit;
}

/* 결과 없음 메시지 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
    font-size: 1.1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
}

/* 푸터 */
.main-footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.8;
}

/* 기존 상세페이지 호환성 스타일 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 30px;
}

.apt-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.info-item {
    background: rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.info-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 5px;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    border: 1px solid #e1e5e9;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2d3748;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.price-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.price-item {
    text-align: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.price-label {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 5px;
}

.price-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d3748;
}

.price-unit {
    font-size: 0.8rem;
    color: #a0aec0;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .apartment-title {
        font-size: 2.2rem;
    }
    
    .apartment-location {
        flex-direction: column;
        gap: 10px;
    }
    
    .main-header h1 {
        font-size: 2rem;
    }
    
    .stats-grid, .stats-container {
        grid-template-columns: 1fr 1fr;
    }
    
    .district-grid {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-group {
        margin-left: 0;
    }
    
    .search-group input {
        width: 100%;
    }
    
    .apt-grid {
        grid-template-columns: 1fr;
    }
    
    .trend-chart {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .area-analysis {
        grid-template-columns: 1fr;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .container, .main-content {
        padding: 10px;
    }
    
    .main-header, .apartment-header {
        padding: 20px 15px;
    }
    
    .stats-grid, .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stat-item, .stat-card {
        padding: 15px;
    }
    
    .stat-number, .stat-value {
        font-size: 1.5rem;
    }
    
    .apartment-title {
        font-size: 1.8rem;
    }
    
    .apartment-location {
        font-size: 1rem;
    }
    
    .analysis-section, .trend-section, .transaction-section {
        padding: 20px;
    }
}

/* 시세 분석 섹션 스타일 */
.market-analysis {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.market-analysis h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.analysis-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analysis-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
}

.analysis-section h3 {
    color: #495057;
    font-size: 1.3rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-text {
    color: #6c757d;
    line-height: 1.7;
    font-size: 0.95rem;
}

.analysis-text strong {
    color: #2c3e50;
    font-weight: 600;
}

.trend-detail, .level-detail, .frequency-detail, .investment-detail {
    display: block;
    margin-top: 10px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1565c0;
    border-left: 3px solid #2196f3;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .market-analysis {
        padding: 20px;
        margin: 20px 0;
    }
    
    .analysis-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .analysis-section {
        padding: 20px;
    }
    
    .market-analysis h2 {
        font-size: 1.5rem;
    }
    
    .analysis-section h3 {
        font-size: 1.1rem;
    }
}