/* 메인 CSS 파일 - 최적화된 버전 */

:root {
    --primary-color: #28A745;
    --primary-dark: #1e7e34;
    --secondary-color: #64748b;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* 전역 스타일 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #fafafa;
}

/* 네비게이션 바 */
.navbar {
    background: transparent !important;
    box-shadow: none;
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 2rem;
    color: var(--primary-color) !important;
}

/* 카드 스타일 */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    background: white;
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.card-title a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.card-title a:hover {
    color: var(--primary-dark);
}

/* 버튼 스타일 */
.btn {
    border-radius: 0.75rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* 순위 테이블 */
.ranking-preview table,
.ranking-table table,
.restaurant-table table {
    font-size: 0.9rem;
    margin-bottom: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.ranking-preview th,
.ranking-table th,
.restaurant-table th {
    background: #28a745 !important;
    color: white !important;
    font-size: 0.85rem;
    padding: 1rem 0.75rem;
    text-align: center;
    font-weight: 600;
    border: none;
}

.ranking-preview td,
.ranking-table td,
.restaurant-table td {
    padding: 0.875rem 0.75rem;
    border-color: var(--border-color);
    vertical-align: middle;
}

.ranking-preview tr:hover,
.ranking-table tr:hover,
.restaurant-table tr:hover {
    background-color: #f8fafc;
}

/* 방문하기 링크 기본 스타일 */
.restaurant-table .visit-link {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    min-width: 40px;
    text-align: center;
}

.restaurant-table .visit-link:hover {
    background-color: #218838;
    color: white;
    text-decoration: none;
}

/* 페이지네이션 */
.pagination .page-link {
    border: none;
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border-radius: 0.5rem;
}

.pagination .page-link:hover {
    background-color: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    box-shadow: var(--shadow-md);
}

/* 텍스트 그라데이션 */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 3.5rem !important;
    font-weight: 700 !important;
}

/* 제목 스타일 강화 */
h1 {
    font-size: 2.8rem !important;
    font-weight: 700 !important;
}

h3 {
    font-size: 2rem !important;
    font-weight: 600 !important;
}

h5 {
    font-size: 1.4rem !important;
    font-weight: 600 !important;
}

/* 빈 상태 */
.empty-state {
    padding: 3rem 1rem;
}

.empty-state-icon {
    opacity: 0.6;
}

/* 모바일 최적화 - 통합된 반응형 디자인 */
@media (max-width: 768px) {
    /* 기본 레이아웃 최적화 */
    .navbar-brand { font-size: 1.6rem; }
    .text-gradient { font-size: 2.5rem !important; }
    h1 { font-size: 2.2rem !important; }
    h3 { font-size: 1.6rem !important; }
    h5 { font-size: 1.2rem !important; }
    .container { padding-left: 5px; padding-right: 5px; }
    .card-header { padding: 0.75rem; }
    .card-body { padding: 0.5rem; }
    .d-flex { flex-direction: column; align-items: start !important; }
    .d-flex .btn { margin-top: 0.75rem; width: 100%; }
    
    /* 테이블 최적화 */
    .ranking-preview,
    .ranking-table,
    .restaurant-table { 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
    }
    .ranking-preview table,
    .ranking-table table,
    .restaurant-table table { 
        font-size: 0.75rem; 
        width: 100%; 
        max-width: 100%; 
        table-layout: fixed;
    }
    .ranking-preview th,
    .ranking-preview td,
    .ranking-table th,
    .ranking-table td,
    .restaurant-table th,
    .restaurant-table td { 
        padding: 0.5rem 0.375rem; 
        word-wrap: break-word; 
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 컬럼 숨김 - 통합 규칙 (카테고리, 평점, 리뷰수 숨김) - 방문하기는 유지 */
    .ranking-preview th:nth-child(4),
    .ranking-preview td:nth-child(4),
    .ranking-preview th:nth-child(5),
    .ranking-preview td:nth-child(5),
    .ranking-preview th:nth-child(6),
    .ranking-preview td:nth-child(6),
    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4),
    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5),
    .ranking-table th:nth-child(6),
    .ranking-table td:nth-child(6),
    .restaurant-table th:nth-child(4),
    .restaurant-table td:nth-child(4),
    .restaurant-table th:nth-child(5),
    .restaurant-table td:nth-child(5),
    .restaurant-table th:nth-child(6),
    .restaurant-table td:nth-child(6) {
        display: none;
    }
    
    /* 컬럼 너비 최적화 - 3컬럼 구조 (순위, 식당명, 방문하기) */
    .ranking-preview th:nth-child(1),
    .ranking-preview td:nth-child(1),
    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1),
    .restaurant-table th:nth-child(1),
    .restaurant-table td:nth-child(1) {
        width: 15%;
        text-align: center;
    }
    
    .ranking-preview th:nth-child(2),
    .ranking-preview td:nth-child(2),
    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2),
    .restaurant-table th:nth-child(2),
    .restaurant-table td:nth-child(2) {
        width: 65%;
        text-align: center;
    }
    
    .ranking-preview th:nth-child(3),
    .ranking-preview td:nth-child(3),
    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3),
    .restaurant-table th:nth-child(3),
    .restaurant-table td:nth-child(3) {
        width: 20%;
        text-align: center;
    }
    
    /* 식당명 링크 스타일 - 모바일 최적화 */
    .restaurant-table .name-cell a {
        text-decoration: none !important;
        color: inherit !important;
        display: block !important;
        padding: 6px !important;
        border-radius: 6px !important;
        transition: background-color 0.3s ease !important;
    }
    
    .restaurant-table .name-cell a:hover {
        background-color: #f8f9fa !important;
        text-decoration: none !important;
    }
    
    .restaurant-table .name-cell strong {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        cursor: pointer !important;
        font-weight: 600 !important;
        display: block !important;
        margin-bottom: 2px !important;
    }
    
    .restaurant-table .name-cell .category {
        font-size: 0.7rem !important;
        margin-top: 1px !important;
        color: #6c757d !important;
        text-align: center !important;
    }
    
    /* 방문하기 링크 스타일 개선 */
    .restaurant-table .visit-link {
        display: inline-block !important;
        background-color: #28a745 !important;
        color: white !important;
        padding: 3px 6px !important;
        border-radius: 3px !important;
        font-size: 0.65rem !important;
        font-weight: 500 !important;
        text-decoration: none !important;
        margin: 0 !important;
        transition: background-color 0.2s ease !important;
        white-space: nowrap !important;
        min-width: 35px !important;
        text-align: center !important;
        height: auto !important;
        line-height: 1.2 !important;
    }
    
    .restaurant-table .visit-link:hover {
        background-color: #218838 !important;
        color: white !important;
        text-decoration: none !important;
    }
    
    /* 방문하기 링크가 있는 셀 스타일 */
    .restaurant-table td:last-child {
        text-align: center !important;
        vertical-align: middle !important;
        width: 20% !important;
        min-width: 60px !important;
    }
    
    /* 방문하기 링크 컨테이너 */
    .restaurant-table .visit-cell {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        height: 100% !important;
    }
}

/* 초소형 모바일 최적화 */
@media (max-width: 480px) {
    /* 테이블 최적화 */
    .ranking-preview table,
    .ranking-table table,
    .restaurant-table table { 
        font-size: 0.65rem; 
        width: 100%; 
        max-width: 100%; 
        table-layout: fixed;
    }
    .ranking-preview th,
    .ranking-preview td,
    .ranking-table th,
    .ranking-table td,
    .restaurant-table th,
    .restaurant-table td { 
        padding: 0.3rem 0.25rem; 
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 컬럼 숨김 - 상속 (방문하기는 유지) */
    .ranking-preview th:nth-child(4),
    .ranking-preview td:nth-child(4),
    .ranking-preview th:nth-child(5),
    .ranking-preview td:nth-child(5),
    .ranking-preview th:nth-child(6),
    .ranking-preview td:nth-child(6),
    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4),
    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5),
    .ranking-table th:nth-child(6),
    .ranking-table td:nth-child(6),
    .restaurant-table th:nth-child(4),
    .restaurant-table td:nth-child(4),
    .restaurant-table th:nth-child(5),
    .restaurant-table td:nth-child(5),
    .restaurant-table th:nth-child(6),
    .restaurant-table td:nth-child(6) {
        display: none;
    }
    
    /* 컬럼 너비 - 3컬럼 구조 (순위, 식당명, 방문하기) */
    .ranking-preview th:nth-child(1),
    .ranking-preview td:nth-child(1),
    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1),
    .restaurant-table th:nth-child(1),
    .restaurant-table td:nth-child(1) {
        width: 15%;
        text-align: center;
    }
    
    .ranking-preview th:nth-child(2),
    .ranking-preview td:nth-child(2),
    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2),
    .restaurant-table th:nth-child(2),
    .restaurant-table td:nth-child(2) {
        width: 65%;
        text-align: center;
    }
    
    .ranking-preview th:nth-child(3),
    .ranking-preview td:nth-child(3),
    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3),
    .restaurant-table th:nth-child(3),
    .restaurant-table td:nth-child(3) {
        width: 20%;
        text-align: center;
    }
    
    /* 식당명 링크 - 작은 화면용 */
    .restaurant-table .name-cell a {
        padding: 4px !important;
    }
    
    .restaurant-table .name-cell strong {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
        font-weight: 600 !important;
        display: block !important;
        margin-bottom: 1px !important;
    }
    
    .restaurant-table .name-cell .category {
        font-size: 0.65rem !important;
        margin-top: 1px !important;
        color: #6c757d !important;
        text-align: center !important;
    }
    
    /* 방문하기 링크 - 작은 화면용 */
    .restaurant-table .visit-link {
        padding: 2px 5px !important;
        font-size: 0.6rem !important;
        margin: 0 !important;
        min-width: 30px !important;
        height: auto !important;
        line-height: 1.1 !important;
    }
    
    /* 방문하기 링크가 있는 셀 - 작은 화면용 */
    .restaurant-table td:nth-child(3) {
        width: 20% !important;
        min-width: 50px !important;
    }
}

/* 관리자 링크 숨김 */
.admin-link {
    display: none !important;
}

/* 사파리 모바일 특화 - 중복 제거됨 (위의 통합 규칙으로 대체) */
