/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    /* Prevent horizontal scroll on iOS */
    -webkit-overflow-scrolling: touch;
}

:root {
    /* Red-themed color palette */
    --primary-color: #DC143C;
    --primary-dark: #B71C1C;
    --primary-light: #FF5252;
    --secondary-color: #FF6B6B;
    --accent-color: #FFE5E5;
    
    /* Neutral colors */
    --bg-color: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #E0E0E0;
    
    /* Spacing */
    --header-height: 60px;
    --tab-bar-height: 65px;
    --content-padding: 16px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in specific areas */
.card-title,
.modal-body,
input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
    z-index: 2100;
    overflow: hidden;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
}


/* Logo Container */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    gap: 2px;
}

.logo-line-1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.logo-line-2 {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.logo-premium {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.version-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    padding: 0;
    border-radius: 0;
    letter-spacing: 0.3px;
    border: none;
    transition: all 0.3s;
}

.version-badge:hover {
    color: rgba(255, 255, 255, 0.9);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.search-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.admin-link {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.category-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Category Overlay */
.category-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.category-overlay.active {
    display: flex;
    opacity: 1;
    justify-content: flex-end;
}

.category-panel {
    background: white;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.category-overlay.active .category-panel {
    transform: translateX(0);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.category-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.category-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.category-item {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    word-break: keep-all;
    line-height: 1.4;
}

.category-item i {
    color: var(--primary-color);
}

.category-item:hover {
    background: var(--accent-color);
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-item.active i {
    color: white;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    margin-bottom: var(--tab-bar-height);
    min-height: calc(100vh - var(--header-height) - var(--tab-bar-height));
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.tab-content.active {
    display: block;
}

.featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

/* 모바일에서 배지 크기 조정 */
@media (max-width: 768px) {
    .featured-badge {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
}

/* Feed Section */
.feed-section {
    padding: var(--content-padding);
    padding-top: 20px;
    max-width: 100%;
    margin: 0 auto;
}

/* 
 * 모바일 기준 반응형 레이아웃
 * - 모바일: 롱폼(가로영상) 1개 전체 너비, 숏폼(세로영상) 2개 나란히
 * - 화면이 커지면: 같은 크기의 카드가 더 많이 표시됨
 * - 롱폼 카드 기준 너비: ~345px (모바일 기준)
 * - 숏폼 카드 기준 너비: ~165px (모바일 기준)
 */

.feed-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* 롱폼(가로영상): 2칸 차지 */
.feed-grid .content-card[data-size="large"] {
    grid-column: span 2;
}

/* 숏폼(세로영상): 1칸 차지 */
.feed-grid .content-card[data-size="small"] {
    grid-column: span 1;
}

/* 태블릿 (768px~): 롱폼 2개가 나란히 보이기 시작 */
@media (min-width: 768px) {
    .feed-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

/* 중형 태블릿 (900px~): 롱폼 2개 + 숏폼 추가 */
@media (min-width: 900px) {
    .feed-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 14px;
    }
}

/* 데스크톱 (1200px~): 롱폼 3개가 나란히 */
@media (min-width: 1200px) {
    .feed-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
}

/* 대형 데스크톱 (1600px~): 롱폼 4개가 나란히 */
@media (min-width: 1600px) {
    .feed-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 16px;
    }
}

/* 초대형 화면 (2000px~): 롱폼 5개가 나란히 */
@media (min-width: 2000px) {
    .feed-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 18px;
    }
}

/* Content Card */
.content-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    width: 100%;
    max-width: 100%;
    /* Improve touch feedback */
    -webkit-tap-highlight-color: rgba(220, 20, 60, 0.1);
}

.content-card:active {
    transform: scale(0.98);
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .content-card:hover {
        transform: none;
    }
    
    .content-card:active {
        transform: scale(0.97);
    }
}

.card-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: var(--bg-secondary);
}

.card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-info {
    padding: 15px;
}

.card-type-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 2.8em;
}

.card-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
    min-height: 24px;
}

.keyword-tag {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.card-recommendation {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.bookmark-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    z-index: 10;
}

.bookmark-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.bookmark-btn i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.bookmark-btn.bookmarked i {
    color: var(--primary-color);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: none;
}

.loading-indicator.active {
    display: block;
}

/* Search Tab */
.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--content-padding);
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s;
    /* Prevent zoom on iOS */
    font-size: 16px;
}

@media (max-width: 768px) {
    .search-input {
        padding: 12px 16px;
        border-radius: 22px;
    }
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-color);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Recent Searches */
.recent-searches {
    margin-bottom: 30px;
}

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

.recent-searches-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-all-btn:hover {
    color: var(--primary-color);
}

.search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-chip {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-chip:hover {
    background: var(--accent-color);
    border-color: var(--primary-color);
}

.search-chip .remove-chip {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.search-chip .remove-chip:hover {
    background: var(--primary-color);
    color: white;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-results p {
    font-size: 1.1rem;
}

/* Share Tab */
.share-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--tab-bar-height) - 40px);
    padding: var(--content-padding);
}

.share-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.share-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.share-icon i {
    font-size: 2rem;
    color: white;
}

.share-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.share-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.share-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.share-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.share-notification {
    margin-top: 15px;
    padding: 12px 20px;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.share-notification.active {
    opacity: 1;
}

/* Bottom Tab Bar */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--tab-bar-height);
    background: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 2100;
    overflow: hidden;
}

.tab-bar-item {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.tab-bar-item i {
    font-size: 1.5rem;
}

.tab-bar-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.tab-bar-item:hover {
    color: var(--primary-color);
}

.tab-bar-item.active {
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 2000;
    display: none;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    display: block;
    transform: translateX(0);
}

.modal-content {
    background: white;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes modalSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

.modal-close {
    display: none; /* Hidden - use back button instead */
}

.modal-body {
    padding: 0;
    margin-top: var(--header-height);
    padding-bottom: var(--tab-bar-height);
    min-height: calc(100vh - var(--header-height) - var(--tab-bar-height));
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.modal-body::-webkit-scrollbar {
    display: none;
}

/* Modal Detail Styles */
.modal-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
}

.modal-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* YouTube Player Wrapper */
.modal-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

/* YouTube Preview (before play) */
.youtube-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.youtube-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s;
    cursor: pointer;
}

.youtube-play-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.youtube-play-btn {
    background: rgba(255, 0, 0, 0.9);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.youtube-play-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(255, 0, 0, 0.4);
}

.youtube-play-btn i {
    font-size: 1.5rem;
}

/* YouTube Player Container */
.youtube-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Player Error / Message Display */
.player-error-content {
    text-align: center;
    padding: 30px 20px;
    max-width: 350px;
    margin: 0 auto;
}

.player-error-content i {
    font-size: 2.5rem;
    color: #ff6b6b;
    margin-bottom: 15px;
    display: block;
}

.player-error-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.95);
}

.player-error-content .modal-btn {
    margin: 15px auto 0;
}

.modal-featured-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.modal-header-info {
    padding: 0 25px;
}

.modal-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.modal-type-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent-color);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-category-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
}

.modal-recommendation,
.modal-description,
.modal-keywords {
    padding: 0 25px;
}

.modal-recommendation h3,
.modal-description h3,
.modal-keywords h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-recommendation h3 i {
    color: var(--primary-color);
}

.modal-recommendation p,
.modal-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.modal-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-keyword-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 25px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.modal-btn {
    flex: 1;
    min-width: 140px;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.modal-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.modal-btn-bookmark {
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.modal-btn-bookmark:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.modal-btn-bookmark.bookmarked {
    background: var(--accent-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .modal-thumbnail-wrapper,
    .modal-player-wrapper {
        border-radius: 16px 16px 0 0;
    }
    
    .youtube-play-btn {
        padding: 16px 32px;
        font-size: 1rem;
        gap: 10px;
    }
    
    .youtube-play-btn i {
        font-size: 1.3rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-header-info,
    .modal-recommendation,
    .modal-description,
    .modal-keywords {
        padding: 0 20px;
    }
    
    .modal-actions {
        padding: 20px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-thumbnail-wrapper,
    .modal-player-wrapper {
        border-radius: 0;
    }
}

.modal-body .visit-link:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
        --tab-bar-height: 60px;
        --content-padding: 12px;
    }
    
    /* Mobile Logo */
    .logo-icon {
        font-size: 1.3rem;
    }
    
    .logo-main {
        font-size: 0.95rem;
    }
    
    .logo-premium {
        font-size: 0.6rem;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .header-actions {
        gap: 6px;
    }

    .admin-link,
    .category-btn {
        width: 36px;
        height: 36px;
    }

    .featured-section {
        padding: 12px;
    }

    .featured-title {
        font-size: 1.15rem;
    }

    .featured-info {
        padding: 16px;
    }

    .featured-reason {
        font-size: 0.9rem;
    }

    .more-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .feed-section {
        padding: 12px;
    }

    .card-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        min-height: 2.4em;
    }

    .card-info {
        padding: 12px;
    }

    .card-type-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .card-keywords {
        font-size: 0.75rem;
    }

    .card-recommendation {
        font-size: 0.8rem;
    }

    .bookmark-btn {
        width: 32px;
        height: 32px;
        bottom: 12px;
        right: 12px;
    }

    .bookmark-btn i {
        font-size: 1rem;
    }

    .search-container {
        padding: 12px;
    }

    .search-input-wrapper {
        gap: 8px;
    }

    .search-input {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .search-btn {
        width: 44px;
        height: 44px;
    }

    .recent-searches-header h3 {
        font-size: 0.9rem;
    }

    .clear-all-btn {
        font-size: 0.85rem;
    }

    .search-chip {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .share-card {
        padding: 30px 20px;
    }

    .share-icon {
        width: 70px;
        height: 70px;
    }

    .share-icon i {
        font-size: 1.75rem;
    }

    .share-card h2 {
        font-size: 1.25rem;
    }

    .share-card p {
        font-size: 0.95rem;
    }

    .tab-bar-item i {
        font-size: 1.3rem;
    }

    .tab-bar-item span {
        font-size: 0.7rem;
    }

    .modal-content {
        max-width: 95vw;
        max-height: 85vh;
    }

    .modal-body {
        padding: 30px 16px 20px;
    }

    .modal-body h2 {
        font-size: 1.25rem;
    }

    .modal-body p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1rem;
    }
    
    /* Logo - 2 line layout on mobile */
    .logo-line-1 {
        font-size: 0.95rem;
    }
    
    .logo-line-2 {
        gap: 3px;
    }
    
    .logo-premium {
        font-size: 0.6rem;
    }
    
    .version-badge {
        font-size: 0.55rem;
    }

    .featured-title {
        font-size: 1.05rem;
    }

    .featured-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .card-category-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .category-panel {
        width: 100%;
        max-width: 100vw;
    }

    .category-item {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .share-card h2 {
        font-size: 1.15rem;
    }
}

/* ==================================== */
/* Search Overlay Styles */
/* ==================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.search-overlay.active {
    display: block;
}

.search-overlay-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: white;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease-out;
}

/* Desktop/Tablet: Center and limit width */
@media (min-width: 768px) {
    .search-overlay-content {
        max-width: 700px;
        height: auto;
        max-height: 90vh;
        margin-top: 5vh;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-overlay-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.search-overlay-input:focus {
    border-color: var(--primary-color);
}

/* Search Results List */
.search-results-list {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.search-result-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.search-result-thumbnail {
    width: 100px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-type {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==================================== */
/* Info Tab (News Feed Style) */
/* ==================================== */

.info-feed {
    padding: var(--content-padding);
    max-width: 800px;
    margin: 0 auto;
}

.info-card {
    display: flex;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.info-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.info-card:active {
    transform: translateY(0);
}

.info-card-thumbnail {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.info-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge-small {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
}

.info-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-type {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.info-card-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--accent-color);
    padding: 2px 8px;
    border-radius: 8px;
}

.info-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.info-card-keywords {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.info-card-keywords .keyword-tag {
    font-size: 0.7rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 8px;
}

.info-bookmark-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    padding: 4px 8px;
}

.info-bookmark-btn.bookmarked {
    color: var(--primary-color);
}

.info-bookmark-btn:hover {
    transform: scale(1.1);
}

/* Responsive for info cards */
@media (max-width: 768px) {
    .search-overlay-content {
        max-width: 100%;
    }
    
    .info-card {
        padding: 10px;
    }
    
    .info-card-thumbnail {
        width: 100px;
        height: 100px;
    }
    
    .info-card-title {
        font-size: 0.9rem;
    }
    
    .info-card-description {
        font-size: 0.8rem;
    }
    
    .search-result-item {
        padding: 10px;
    }
    
    .search-result-thumbnail {
        width: 80px;
        height: 50px;
    }
    
    .search-result-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .info-card {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-card-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .search-overlay-header {
        padding: 12px;
    }
    
    .search-overlay-input {
        font-size: 0.95rem;
        padding: 10px 14px;
    }
}


/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ====================================
   Desktop Layout (≥1024px)
   ==================================== */

@media (min-width: 1024px) {
    /* Desktop Header with Logo */
    .header-content {
        max-width: 1920px;
        justify-content: flex-start;
        gap: 30px;
    }
    
    .logo-container {
        flex: 0 0 auto;
        margin-right: auto;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-main {
        font-size: 1.3rem;
    }
    
    .logo-premium {
        font-size: 0.75rem;
    }
    
    /* Hide category button on desktop */
    .category-btn {
        display: none;
    }
    
    /* Desktop layout container */
    .main-content {
        display: flex;
        max-width: 1920px;
        margin-left: auto;
        margin-right: auto;
        padding-right: 280px; /* Space for fixed sidebar */
        position: relative;
    }
    
    /* Content area takes remaining space */
    .tab-content {
        flex: 1;
        width: 100%;
    }
    
    /* Fixed category sidebar on the right */
    .category-overlay {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: var(--tab-bar-height);
        left: auto;
        width: 280px;
        background: transparent;
        display: block !important;
        opacity: 1 !important;
        z-index: 50;
        pointer-events: none;
    }
    
    .category-panel {
        width: 100%;
        max-width: 100%;
        height: 100%;
        transform: none !important;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
        border-left: 1px solid var(--border-color);
        pointer-events: auto;
    }
    
    .category-header {
        background: var(--primary-color);
        color: white;
        border-bottom-color: rgba(255, 255, 255, 0.2);
    }
    
    .category-header h2 {
        color: white;
    }
    
    /* Hide close button on desktop */
    .category-header .close-btn {
        display: none;
    }
    
    .category-list {
        overflow-y: auto;
        max-height: calc(100vh - var(--header-height) - var(--tab-bar-height) - 61px);
    }
    
    /* Hide category panel on desktop when Shorts tab is active */
    #shortsTab.active ~ .category-overlay {
        display: none !important;
    }
    
    /* Adjust feed grids for desktop with sidebar */
    .feed-section {
        padding: var(--content-padding);
        max-width: 100%;
    }
    
    .feed-grid {
        width: 100%;
    }
}

/* Mobile/Tablet: Always hide category panel on Shorts tab */
@media (max-width: 1023px) {
    body:has(#shortsTab.active) .category-overlay {
        display: none !important;
    }
}

/* ====================================
 * Mobile Optimization - Prevent Horizontal Scroll
 * ==================================== */

@media (max-width: 768px) {
    /* Ensure no element exceeds viewport width */
    * {
        max-width: 100vw;
    }
    
    /* Prevent horizontal scroll on all containers */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        position: relative;
    }
    
    /* Fixed elements should not exceed viewport */
    .header,
    .tab-bar {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Content areas */
    .tab-content,
    .feed-grid,
    .info-feed {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Cards should fit within grid */
    .content-card,
    .info-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    
    /* Images should not exceed container */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Prevent text overflow */
    .card-title,
    .card-description,
    .info-card-title {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}
