/* ===== 전역 설정 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0e27;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --accent-purple: #9333ea;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 30px rgba(147, 51, 234, 0.3);
}

body {
    font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #2d1b4e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 배경 애니메이션 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(147, 51, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    animation: bgPulse 15s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes bgPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }
}

/* ===== 앱 컨테이너 ===== */
.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 헤더 ===== */
.app-header {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-glow);
    animation: fadeInDown 0.6s ease-out;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo-section:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.logo-icon {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.app-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #9333ea 0%, #3b82f6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stats-badge {
    background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.4);
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
}

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

/* ===== 필터 패널 ===== */
.filter-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.filter-section {
    flex: 1;
    min-width: 250px;
}

.filter-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

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

.filter-btn {
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #9333ea 0%, #3b82f6 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 5px 20px rgba(147, 51, 234, 0.4);
}

/* ===== 검색 섹션 ===== */
.search-section {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.search-btn {
    padding: 16px 60px;
    background: linear-gradient(135deg, #ec4899 0%, #9333ea 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4);
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(236, 72, 153, 0.6);
}

.search-btn:active {
    transform: translateY(-1px);
}

/* ===== 검색 뷰 ===== */
.search-view {
    padding: 60px 0;
    animation: fadeInUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-section {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.search-btn {
    padding: 20px 80px;
    background: linear-gradient(135deg, #ec4899 0%, #9333ea 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(236, 72, 153, 0.5);
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 50px rgba(236, 72, 153, 0.7);
}

/* ===== 결과 뷰 (새로운 창 느낌) ===== */
.results-view {
    background: rgba(10, 14, 39, 0.7);
    border: 2px solid var(--accent-blue);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.2);
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 10px;
    animation: fadeIn 0.5s ease-out;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn span {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
    transform: translateX(-5px);
}

.back-btn:hover span {
    transform: translateX(-3px);
}

.results-summary {
    display: flex;
    gap: 12px;
}

.summary-tag {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(147, 51, 234, 0.2) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-blue);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ===== 뉴스 그리드 ===== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* ===== 뉴스 카드 ===== */
.news-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out both;
    position: relative;
    overflow: hidden;
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(147, 51, 234, 0.3);
    border-color: var(--accent-purple);
}

.news-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.score-badge {
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: baseline;
    gap: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.score-value {
    font-size: 1.8rem;
}

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

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.source-badge,
.date-badge {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.news-title {
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.keyword-tag {
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #a78bfa;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.action-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn.youtube {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: white;
}

.action-btn.news {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.action-btn.related {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* ===== 빈 상태 ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

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

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ===== 푸터 ===== */
.app-footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== 애니메이션 ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .app-title {
        font-size: 1.8rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .filter-panel {
        flex-direction: column;
        gap: 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo-section {
        flex-direction: column;
    }
}