@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&family=Product+Sans:wght@400;500;700&display=swap');

:root {
    --primary: #01875f;
    --primary-dark: #006847;
    --primary-light: #e8f5e9;
    --accent: #1a73e8;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --border: #dadce0;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    --shadow-lg: 0 2px 6px 2px rgba(60,64,67,0.15), 0 8px 24px 4px rgba(60,64,67,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Noto Sans KR', 'Product Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 게시판 컨테이너 ===== */
.playstore-board,
.playstore-view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== 헤더 ===== */
.board-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    margin-bottom: 32px;
    color: white;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.board-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

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

.board-title {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.title-icon {
    width: 48px;
    height: 48px;
    color: white;
}

.board-description {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 300;
}

/* ===== 카테고리 필터 ===== */
.category-filter {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.category-btn {
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-xl);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.category-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.category-btn.active {
    background: white;
    color: var(--primary);
    border-color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== 검색 ===== */
.search-section {
    margin-bottom: 32px;
}

.search-form {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 8px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-icon {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
    margin-left: 12px;
}

.search-input {
    flex: 1;
    border: none;
    padding: 12px 8px;
    font-size: 1rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
}

.search-select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    cursor: pointer;
}

.search-btn {
    padding: 12px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ===== 앱 그리드 ===== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.app-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
}

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

.app-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.app-card-link {
    display: block;
    padding: 20px;
    text-decoration: none;
    color: inherit;
}

.app-icon-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.featured-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.app-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-category {
    display: inline-block;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.app-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rating-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rating-stars {
    display: flex;
    gap: 2px;
}

.star {
    width: 14px;
    height: 14px;
    color: #fbbc04;
}

.star.full {
    color: #fbbc04;
}

.star.half {
    color: #fbbc04;
    opacity: 0.5;
}

.star.empty {
    color: var(--border);
}

.rating-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.app-price {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
}

.app-downloads {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 0.813rem;
}

.download-icon {
    width: 16px;
    height: 16px;
}

/* ===== 빈 상태 ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    color: var(--text-tertiary);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

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

/* ===== 페이징 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 48px 0;
}

.pagination a,
.pagination strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--bg-tertiary);
}

.pagination strong {
    background: var(--primary);
    color: white;
}

/* ===== 글쓰기 버튼 ===== */
.write-button-wrapper {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 100;
}

.write-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.write-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(1, 135, 95, 0.4);
}

.write-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== 상세보기 ===== */
.app-header {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.app-header-main {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.app-icon-large {
    flex-shrink: 0;
}

.app-icon-large img {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    object-fit: cover;
}

.app-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.app-developer {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.125rem;
}

.app-developer:hover {
    text-decoration: underline;
}

.app-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    font-size: 0.813rem;
    font-weight: 600;
}

.badge.featured {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.badge.installs {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.price-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.install-btn svg {
    width: 20px;
    height: 20px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: var(--border);
    transform: scale(1.1);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== 평점 개요 ===== */
.rating-overview {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.rating-score {
    text-align: center;
}

.score-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 12px;
}

.score-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.score-stars .star {
    width: 24px;
    height: 24px;
}

.score-count {
    color: var(--text-secondary);
    font-size: 0.938rem;
}

/* ===== 스크린샷 갤러리 ===== */
.screenshots-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.screenshots-gallery {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.screenshots-gallery::-webkit-scrollbar {
    height: 8px;
}

.screenshots-gallery::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

.screenshot-item {
    flex-shrink: 0;
    width: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s;
}

.screenshot-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== 앱 설명 ===== */
.app-description {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.description-content {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1rem;
}

.description-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 16px 0;
}

/* ===== 추가 정보 ===== */
.additional-info {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== 파일 목록 ===== */
.files-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.file-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.file-icon {
    width: 32px;
    height: 32px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 댓글 섹션 ===== */
.comments-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.comment-count {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== 하단 버튼 ===== */
.view-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 32px 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn svg {
    width: 18px;
    height: 18px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: #ea4335;
    color: white;
}

.btn-danger:hover {
    background: #d33426;
}

/* ===== 이미지 오버레이 ===== */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.overlay-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.close-overlay {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-overlay:hover {
    background: white;
    transform: scale(1.1);
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .playstore-board,
    .playstore-view {
        padding: 16px;
    }
    
    .board-header {
        padding: 32px 24px;
    }
    
    .board-title {
        font-size: 1.75rem;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .app-header-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .write-button-wrapper {
        bottom: 20px;
        right: 20px;
    }
    
    .write-btn {
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .search-input-wrapper {
        flex-wrap: wrap;
    }
    
    .search-select {
        width: 100%;
    }
    
    .app-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .install-btn {
        width: 100%;
        justify-content: center;
    }
}
