:root {
    --bg-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --card-bg: #ffffff;
    --primary-color: #2563eb;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pinned-card {
    border: 2px solid var(--primary-color) !important;
    background: #f0f7ff !important;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
}

#deep-search-btn:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --card-bg: #1e293b;
        --border-color: #334155;
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
    }
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* Header */
.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 32px 0;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 24px;
}

/* New Search Box Styling */
.search-box-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 8px;
}

.search-box {
    width: 100%;
    max-width: 580px;
    position: relative;
    box-shadow: var(--shadow-md);
    border-radius: 50px;
    background: var(--card-bg);
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    padding-right: 50px;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.search-box svg {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    pointer-events: none;
    transition: var(--transition);
}

.search-box input:focus+svg {
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}

@media (max-width: 640px) {
    .search-box {
        max-width: 100%;
    }
}



.title-wrapper {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

#results-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* Nav Menu */
.nav-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding-bottom: 8px;
}

.nav-item {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.4);
}

/* 엔터 버튼 특별 스타일 */
.nav-item[data-category="엔터"] {
    background: linear-gradient(45deg, #ff0080, #7928ca);
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
}

.nav-item[data-category="엔터"]::after {
    content: '✨';
    margin-left: 4px;
}

.nav-item[data-category="엔터"]:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.6);
}

.nav-item[data-category="엔터"].active {
    background: linear-gradient(45deg, #ff0080, #7928ca);
    box-shadow: 0 0 20px rgba(121, 40, 202, 0.8);
    animation: pulsate 1.5s infinite alternate;
}

@keyframes pulsate {
    from {
        opacity: 0.9;
    }

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

/* Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 16px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

/* Card */
.news-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    transform: translateY(0);
}

.news-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.news-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    /* 정사각형 */
    overflow: hidden;
    background: var(--border-color);
    position: relative;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    /* 상단이 짤리지 않게 */
    transition: var(--transition);
}

.news-card:hover .news-image img {
    transform: scale(1.05);
}

.news-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.news-image.placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.news-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.news-press {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.rank-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-style: italic;
}

.rank-1 {
    background: #ef4444;
}

.rank-2 {
    background: #f59e0b;
}

.rank-3 {
    background: #10b981;
}

.rank-default {
    background: #94a3b8;
}

.rank-badge {
    margin-bottom: 8px;
}

.news-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Empty */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}

/* Footer */
.app-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
    margin-top: 80px;
    color: var(--text-secondary);
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.footer-brand p {
    max-width: 320px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.link-group h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.link-group ul {
    list-style: none;
}

.link-group ul li {
    margin-bottom: 10px;
}

.link-group ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.link-group ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    font-size: 0.9rem;
}

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

.back-to-top a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    transition: var(--transition);
}

.back-to-top a:hover {
    background: var(--primary-color);
    color: #fff;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand p {
        margin: 0 auto;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.news-card {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.news-card:nth-child(1) {
    animation-delay: 0.05s;
}

.news-card:nth-child(2) {
    animation-delay: 0.1s;
}

.news-card:nth-child(3) {
    animation-delay: 0.15s;
}

.news-card:nth-child(4) {
    animation-delay: 0.2s;
}

.news-card:nth-child(5) {
    animation-delay: 0.25s;
}

@media (max-width: 640px) {
    .news-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
/* Floating Top Button */
.floating-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-top-btn:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

/* Mobile Enhancements */
@media (max-width: 640px) {
    .flex-between {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }
    
    .footer-copy-text p {
        margin: 8px 0;
        font-size: 0.85rem;
    }
    
    .floating-top-btn {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand p {
        margin: 0 auto 20px;
    }
    
    .footer-links {
        justify-items: center;
    }
}
