/* 공통 스타일 */

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

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

/* 컨테이너 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 28px;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.header .container {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    padding: 0 24px;
}

.footer .container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0 24px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 18px;
        border-radius: 18px;
    }

    .header .container,
    .footer .container {
        padding: 0 18px;
    }
}

/* 헤더 */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    background: linear-gradient(120deg, rgba(148, 163, 184, 0.18), rgba(226, 232, 240, 0.2));
    opacity: 0.6;
    pointer-events: none;
}

@keyframes headerShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 14px 30px rgba(15, 23, 42, 0.12);
}

.header-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0;
}

.header-content > * {
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 26px;
    font-weight: 800;
    color: #1e293b;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 12px 25px rgba(148, 163, 184, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logo:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(148, 163, 184, 0.35);
}

.logo::before {
    content: '✨';
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(148, 163, 184, 0.35));
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 25px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 20px rgba(15, 23, 42, 0.08);
}

.nav-menu ul {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: #334155;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-block;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.2);
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(148, 163, 184, 0.12);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 20px;
}

.nav-menu a:hover::before {
    opacity: 1;
}

.nav-menu a:hover {
    color: #1f2937;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 24px rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 1);
}

.nav-menu a:active {
    transform: translateY(0) scale(0.98);
}

/* 특별한 메뉴 아이템 스타일 */
.nav-menu a[href*="login"] {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: 1px solid rgba(76, 175, 80, 0.3);
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.nav-menu a[href*="login"]:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.nav-menu a[href*="golden-keywords"] {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    border: 1px solid rgba(255, 215, 0, 0.3);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    animation: goldenGlow 3s ease-in-out infinite;
}

.nav-menu a[href*="golden-keywords"]:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
    color: #333;
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.4);
}

@keyframes goldenGlow {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    50% { 
        box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
    }
}

.nav-menu a[href*="trend-analysis"] {
    background: linear-gradient(135deg, #e0f2fe 0%, #bfdbfe 100%);
    color: #1d4ed8;
    border: 1px solid rgba(129, 140, 248, 0.25);
    box-shadow: 0 4px 15px rgba(129, 140, 248, 0.2);
}

.nav-menu a[href*="trend-analysis"]:hover {
    background: linear-gradient(135deg, #c7d2fe 0%, #bfdbfe 100%);
    color: #1e3a8a;
    box-shadow: 0 6px 22px rgba(129, 140, 248, 0.3);
}

.nav-menu a[href*="history"] {
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.nav-menu a[href*="history"]:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #ddd6fe 100%);
    color: #3730a3;
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.18);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(31, 41, 55, 0.88);
    padding: 10px 14px;
    border-radius: 24px;
    box-shadow: 0 14px 32px rgba(30, 41, 59, 0.32);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 20px;
}

.username {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.user-level {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    text-shadow: none;
}

.user-level.free {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.user-level.premium {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    border: 1px solid rgba(255, 152, 0, 0.3);
    animation: premiumGlow 2s ease-in-out infinite;
}

.user-level.admin {
    background: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);
    color: white;
    border: 1px solid rgba(233, 30, 99, 0.3);
    animation: adminGlow 2s ease-in-out infinite;
}

@keyframes premiumGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(255, 152, 0, 0.6); }
}

@keyframes adminGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(233, 30, 99, 0.6); }
}

.search-quota {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 버튼 스타일 개선 */
.user-menu .btn {
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.user-menu .btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 1px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.user-menu .btn-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.user-menu .btn-outline {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-menu .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

/* 메인 콘텐츠 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 30px 0;
}

/* 카드 스타일 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 30px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.card-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* 황금 키워드 관련 스타일 */
.golden-keyword {
    position: relative;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.golden-keyword::before {
    content: '💎';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #fff;
    border: 2px solid #ffc107;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: goldenPulse 2s infinite;
}

@keyframes goldenPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
}

.golden-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #333;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #ffc107;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.golden-badge::before {
    content: '🏆';
    font-size: 14px;
}

/* 키워드 분석 결과 */
.keyword-result {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.keyword-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.keyword-result.golden {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff9e6, #fffbf0);
}

.keyword-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.keyword-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.keyword-score {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.keyword-score.excellent {
    background: #ffc107;
    color: #333;
}

.keyword-score.good {
    background: #28a745;
}

.keyword-score.average {
    background: #17a2b8;
}

.keyword-score.poor {
    background: #6c757d;
}

.keyword-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* 검색 폼 */
.search-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.search-input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

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

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

/* .search-btn 스타일은 main.css에서 관리됨 */
/*
.search-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
*/

/* 필터 옵션 */
.filter-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

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

.filter-label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 로딩 스피너 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.empty-state-text {
    font-size: 16px;
    line-height: 1.5;
}

/* 버튼 스타일 - 바이럴 버튼 제외 */
.btn:not(.viral-dashboard-btn) {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:not(.viral-dashboard-btn) {
    background: #667eea;
    color: white;
}

.btn-primary:not(.viral-dashboard-btn):hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary:not(.viral-dashboard-btn) {
    background: #6c757d;
    color: white;
}

.btn-success:not(.viral-dashboard-btn) {
    background: #28a745;
    color: white;
}

.btn-warning:not(.viral-dashboard-btn) {
    background: #ffc107;
    color: #333;
}

.btn-danger:not(.viral-dashboard-btn) {
    background: #dc3545;
    color: white;
}

.btn-outline:not(.viral-dashboard-btn) {
    background: transparent;
    border: 2px solid currentColor;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

/* 테이블 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background: #f8f9fa;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 푸터 */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
}

.footer p {
    margin: 0;
    font-size: 14px;
}

.footer a {
    color: #fbbf24;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #f59e0b;
    text-decoration: underline;
}

/* 헤더 유틸리티 영역 */
.header-utilities {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .logo {
        font-size: 24px;
        padding: 10px 16px;
    }
    
    .nav-menu a {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .user-menu {
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        padding: 15px 0;
    }
    
    .logo {
        font-size: 22px;
        padding: 8px 14px;
    }
    
    .nav-menu {
        gap: 6px;
        padding: 6px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: 100%;
    }
    
    .nav-menu ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        width: 100%;
    }
    
    .nav-menu a {
        padding: 8px 12px;
        font-size: 12px;
        flex: 0 0 auto;
    }
    
    .user-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        padding: 6px;
        width: 100%;
    }
    
    .user-info {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .username {
        font-size: 13px;
    }
    
    .user-level {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .user-menu .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 12px 0;
        gap: 12px;
    }
    
    .logo {
        font-size: 20px;
        padding: 6px 12px;
    }
    
    .logo::before {
        font-size: 24px;
    }
    
    .nav-menu {
        padding: 4px;
        gap: 4px;
    }
    
    .nav-menu ul {
        gap: 4px;
    }
    
    .nav-menu a {
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 15px;
    }
    
    .user-menu {
        padding: 4px;
        gap: 6px;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
        gap: 4px;
        padding: 4px 8px;
    }
    
    .username {
        font-size: 12px;
    }
    
    .search-quota {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .user-menu .btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}
    
    .search-input-group {
        flex-direction: column;
    }
    
    .filter-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .keyword-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .keyword-stats {
        grid-template-columns: 1fr;
    }
    
    .search-form {
        padding: 20px;
    }
}

/* 유틸리티 클래스 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-wrap { flex-wrap: wrap; }
.flex-center { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.text-primary { color: #667eea; }
.text-success { color: #28a745; }
.text-warning { color: #ffc107; }
.text-danger { color: #dc3545; }
.text-muted { color: #6c757d; }
