/* Gamelix Frontend - Netflix Style CSS
   모던하고 세련된 Netflix 스타일 게임 플랫폼 디자인 */

/* 글꼴 임포트 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS 변수 정의 */
:root {
    /* 메인 컬러 팔레트 (Netflix 스타일) */
    --bg-primary: #141414;      /* 메인 배경 */
    --bg-secondary: #1f1f1f;    /* 카드 배경 */
    --bg-tertiary: #2a2a2a;     /* 호버 상태 */
    --bg-modal: rgba(20, 20, 20, 0.95);
    
    /* 텍스트 컬러 */
    --text-primary: #ffffff;     /* 주요 텍스트 */
    --text-secondary: #b3b3b3;   /* 보조 텍스트 */
    --text-muted: #808080;       /* 비활성 텍스트 */
    
    /* 액센트 컬러 */
    --accent-red: #e50914;       /* Netflix 빨강 (로고, 중요 버튼) */
    --accent-blue: #0071eb;      /* 액션 버튼 */
    --accent-green: #46d369;     /* 성공 상태 */
    --accent-yellow: #ffb000;    /* 경고 상태 */
    --accent-purple: #9d4edd;    /* 특별 기능 */
    
    /* 게임 카테고리 컬러 */
    --category-puzzle: #9d4edd;
    --category-action: #f72585;
    --category-arcade: #4cc9f0;
    --category-sports: #7209b7;
    --category-strategy: #560bad;
    --category-racing: #ff6b6b;
    --category-adventure: #51cf66;
    
    /* 그림자 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.6);
    
    /* 트랜지션 */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s ease-out;
    --transition-slow: 0.5s ease-out;
    
    /* 브레이크포인트 */
    --mobile-sm: 320px;
    --mobile-md: 375px;
    --mobile-lg: 425px;
    --tablet: 768px;
    --desktop-sm: 1024px;
    --desktop-md: 1440px;
    --desktop-lg: 1920px;
}

/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* 컨테이너 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 헤더 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(20, 20, 20, 0.95), rgba(20, 20, 20, 0.7));
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition-normal);
    padding: 1rem 0;
}

.header.scrolled {
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-red);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover {
    transform: scale(1.05);
    transition: var(--transition-fast);
}

/* 네비게이션 */
.nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-red);
    transition: var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* 검색 영역 */
.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 300px;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* 메인 콘텐츠 */
.main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

/* 히어로 섹션 */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%23e50914;stop-opacity:0.1"/><stop offset="100%" style="stop-color:%230071eb;stop-opacity:0.1"/></linearGradient></defs><rect width="1200" height="600" fill="url(%23grad)"/></svg>');
    background-size: cover;
    background-position: center;
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-red), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* 카테고리 필터 */
.category-filter {
    display: flex;
    gap: 1rem;
    padding: 2rem 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-btn {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    min-width: fit-content;
}

.category-btn:hover,
.category-btn.active {
    background: var(--accent-red);
    color: var(--text-primary);
    border-color: var(--accent-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 게임 그리드 */
.games-section {
    padding: 2rem 0;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.games-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* 게임 카드 */
.game-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    aspect-ratio: 16/10;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    background: var(--bg-tertiary);
}

.game-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

.game-info {
    padding: 1.25rem;
}

.game-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.game-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.game-category {
    background: var(--category-puzzle);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-yellow);
    font-size: 0.875rem;
}

.game-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.play-button {
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
    font-size: 0.875rem;
}

.play-button:hover {
    background: #c40812;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .search-input {
        width: 250px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .category-filter {
        padding: 1rem 0;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .search-input {
        width: 200px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
}

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

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.hidden { display: none; }
.visible { display: block; }

/* 다크 모드 전용 (기본값) */
.dark-mode {
    color-scheme: dark;
}

/* 게임 상세 모달 */
.game-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-detail-modal[style*="flex"] {
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 1rem;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.game-detail-modal[style*="flex"] .modal-content {
    transform: scale(1);
}

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

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 2rem;
}

.game-detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.game-thumbnail-large {
    width: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.game-thumbnail-large img {
    width: 100%;
    height: auto;
    display: block;
}

.game-info-detailed {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-meta-detailed {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.game-meta-detailed .category {
    background: var(--category-bg);
    color: var(--category-color);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.game-meta-detailed .rating,
.game-meta-detailed .play-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.game-meta-detailed .rating i {
    color: var(--accent-color);
}

.game-description-full {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.game-actions-detailed {
    margin-top: 1rem;
}

.play-button-large {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    min-width: 200px;
    justify-content: center;
}

.play-button-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(229, 9, 20, 0.4);
}

.play-button-large i {
    font-size: 1.2rem;
}

/* 에러 토스트 */
.error-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--error-bg, #dc3545);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(220, 53, 69, 0.3);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.error-toast.show {
    transform: translateX(0);
}

.error-toast i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.error-toast span {
    flex: 1;
    font-weight: 500;
}

.error-toast button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.error-toast button:hover {
    opacity: 1;
}

/* 모달 열림 상태 */
body.modal-open {
    overflow: hidden;
}

/* 게임 카드 애니메이션 */
.game-card {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.game-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* 빈 게임 상태 */
.no-games {
    text-align: center;
    padding: 4rem 2rem;
    grid-column: 1 / -1;
}

.no-games i {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-games h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.no-games p {
    color: var(--text-secondary);
    margin: 0;
}

/* 모바일 모달 반응형 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .game-detail-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .error-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* 추가 카테고리 색상 */
:root {
    --category-puzzle: #4f46e5;
    --category-action: #dc2626;
    --category-arcade: #7c3aed;
    --category-sports: #059669;
    --category-strategy: #d97706;
    --category-racing: #db2777;
    --category-adventure: #0891b2;
}
