/* CSS Variables */
:root {
    --bg-primary: #e8edf3;
    --bg-white: #ffffff;
    --bg-dark: #151b25;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-color: #00d084;
    --accent-hover: #00b874;
    --border-color: #e0e0e0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --container-max: 1280px;
    --header-height: 60px;
    --footer-height: 72px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 768px) {
    body {
        padding-bottom: var(--footer-height);
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.site-header {
    background-color: var(--bg-dark);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid-icon {
    color: #fff;
    padding: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.logo-text {
    display: none;
}

@media (min-width: 768px) {
    .logo-text {
        display: inline;
    }
}

/* Navigation */
.main-nav {
    display: none;
}

@media (min-width: 768px) {
    .main-nav {
        display: block;
    }
}

.nav-list {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-color);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #fff;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Search Section */
.search-section {
    background-color: var(--bg-white);
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0,208,132,0.1);
}

.search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background-color: var(--accent-hover);
}

/* Main Content Layout */
.main-content {
    padding: 20px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr 320px;
        gap: 20px;
    }
}

.main-column {
    min-width: 0;
}

/* App Detail Card */
.app-detail-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .app-detail-card {
        padding: 24px;
    }
}

.app-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.app-icon-wrapper {
    flex-shrink: 0;
}

.app-icon {
    width: 80px;
    height: 80px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
    .app-icon {
        width: 100px;
        height: 100px;
    }
}

.app-meta {
    flex: 1;
    min-width: 0;
}

.breadcrumb {
    margin-bottom: 8px;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumb-link {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--accent-color);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.app-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-version {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.app-category {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.app-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .app-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.app-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0,208,132,0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,208,132,0.4);
}

.download-btn:active {
    transform: translateY(0);
}

.app-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.stars {
    display: flex;
    gap: 2px;
}

.star {
    color: #ddd;
    font-size: 18px;
}

.star.filled {
    color: #ffc107;
}

.rating-value {
    font-weight: 700;
    color: var(--text-primary);
}

.votes {
    color: var(--text-muted);
    font-size: 13px;
}

/* Description Section */
.description-section {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .description-section {
        padding: 24px;
    }
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-divider {
    height: 3px;
    width: 40px;
    background-color: var(--accent-color);
    border-radius: 2px;
    margin-bottom: 20px;
}

.article-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.article-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.article-content p {
    margin-bottom: 16px;
}

.article-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.article-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 8px;
}

.article-content ol,
.article-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content ul {
    list-style-type: disc;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 16px 20px;
    margin: 20px 0;
    background-color: var(--bg-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-secondary);
}

.feature-image {
    margin: 24px 0;
    text-align: center;
}

.feature-image img {
    max-width: 500px;
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

/* Related Apps */
.related-apps-section {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.related-apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .related-apps-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .related-apps-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.related-app-item {
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.related-app-item:hover {
    background-color: var(--bg-primary);
}

.related-app-icon {
    width: 60px;
    height: 60px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin: 0 auto 8px;
    box-shadow: var(--shadow-sm);
}

.related-app-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-app-version {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.related-app-rating {
    display: flex;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    color: #ffc107;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    height: fit-content;
}

.sidebar-widget {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.most-viewed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.most-viewed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.most-viewed-item:hover {
    background-color: var(--bg-primary);
}

.most-viewed-icon {
    width: 50px;
    height: 50px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.most-viewed-info {
    flex: 1;
    min-width: 0;
}

.most-viewed-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.most-viewed-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.most-viewed-stars {
    color: #ffc107;
    font-size: 12px;
    letter-spacing: 1px;
}

/* Footer */
.site-footer {
    background-color: var(--bg-dark);
    color: rgba(255,255,255,0.7);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    margin-bottom: var(--footer-height);
}

@media (min-width: 768px) {
    .site-footer {
        margin-bottom: 0;
    }
}

/* Mobile Sticky Footer */
.mobile-sticky-footer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
}

@media (max-width: 767px) {
    .mobile-sticky-footer {
        display: flex;
    }
}

.sticky-footer-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: rgba(255,255,255,0.8);
    padding: 8px 4px;
    transition: all 0.3s ease;
}

.sticky-footer-item:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
}

.sticky-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes scale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0,208,132,0.5); }
    50% { box-shadow: 0 0 20px rgba(0,208,132,0.8); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-bounce {
    animation: bounce 3s ease-in-out infinite;
}

.animate-scale {
    animation: scale 2s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    color: var(--text-muted);
    padding: 4px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px 20px;
    text-align: center;
}

.modal-body p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-secondary {
    padding: 10px 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: var(--bg-primary);
}

.search-result-icon {
    width: 40px;
    height: 40px;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive Utilities */
@media (max-width: 640px) {
    .app-info-grid {
        grid-template-columns: 1fr;
    }
    
    .related-apps-grid {
        display: flex;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .related-apps-grid::-webkit-scrollbar {
        display: none;
    }
    
    .related-app-item {
        flex-shrink: 0;
        width: 120px;
    }
}

/* Focus States */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .mobile-sticky-footer,
    .site-header,
    .search-section,
    .sidebar {
        display: none !important;
    }
    
    body {
        padding-bottom: 0;
    }
}