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

:root {
    /* Light Theme Colors */
    --primary-color: #6c5ce7;
    --primary-dark: #5b4fcf;
    --secondary-color: #00cec9;
    --accent-color: #fd79a8;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --border-color: #dfe6e9;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-light: 0 5px 15px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --primary-color: #8a7dff;
    --primary-dark: #7467e0;
    --secondary-color: #00d8d6;
    --accent-color: #ff6b9d;
    --text-color: #f5f6fa;
    --text-light: #b2bec3;
    --bg-color: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --border-color: #2d4059;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-light: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 80px 0;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
}

h1 { font-size: 2.8rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }

p {
    margin-bottom: 15px;
    color: var(--text-light);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.highlight {
    color: var(--primary-color);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* ===== Header ===== */
.header {
    background-color: var(--bg-card);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.main-nav ul {
    display: flex;
    gap: 30px;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

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

.main-nav a.active {
    color: var(--primary-color);
}

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

.search-btn,
.theme-toggle,
.menu-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.search-btn:hover,
.theme-toggle:hover {
    background-color: var(--bg-secondary);
}

.menu-toggle {
    display: none;
}

.search-bar {
    display: none;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
}

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

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

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

.search-submit {
    display: none;
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-color) 100%);
    padding: 100px 0;
    overflow: hidden;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.stat h3 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

.platform-icons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.platform-icon {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.platform-icon:hover {
    transform: translateX(10px);
}

.platform-icon i {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
}

.platform-icon.psp i { background-color: #e84118; }
.platform-icon.android i { background-color: #3ddc84; }
.platform-icon.compressed i { background-color: #ff9f43; }

.platform-icon span {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===== Featured Games ===== */
.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    margin-bottom: 10px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.game-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    position: relative;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow);
}

.game-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    z-index: 1;
}

.game-badge.psp { background-color: #e84118; }
.game-badge.apk { background-color: #3ddc84; }
.game-badge.compressed { background-color: #ff9f43; }

.game-image {
    height: 200px;
    overflow: hidden;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.game-content {
    padding: 20px;
}

.game-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.game-info i {
    color: var(--primary-color);
}

.game-desc {
    font-size: 0.95rem;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Categories ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.category-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.category-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    background-color: var(--primary-color);
}

.category-card h3 {
    margin-bottom: 10px;
}

.category-card p {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.game-count {
    display: inline-block;
    padding: 5px 15px;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== Blog Preview ===== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.blog-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

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

.blog-image {
    height: 200px;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.blog-content {
    padding: 25px;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.blog-category {
    padding: 3px 10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
}

.blog-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-excerpt {
    font-size: 0.95rem;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.read-more:hover {
    gap: 12px;
}

.section-footer {
    text-align: center;
}

/* ===== CTA Section ===== */
.cta {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
}

.cta h2,
.cta p {
    color: white;
}

.cta p {
    opacity: 0.9;
    margin-bottom: 30px;
}

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 10px;
}

.newsletter-form input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
}

.form-note {
    margin-top: 15px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ===== Footer ===== */
.footer {
    background-color: var(--bg-secondary);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.footer-description {
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-card);
    border-radius: 50%;
    color: var(--text-color);
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: var(--text-light);
    transition: var(--transition);
}

.footer-col ul li a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.disclaimer {
    font-size: 0.8rem !important;
    opacity: 0.7;
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-5px);
}

/* ===== Responsive Design ===== */
@media (max-width: 992px) {
    h1 { font-size: 2.4rem; }
    h2 { font-size: 1.8rem; }
    
    .hero .container {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .platform-icons {
        flex-direction: row;
        justify-content: center;
    }
    
    .platform-icon {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .platform-icon span {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    section {
        padding: 60px 0;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-card);
        box-shadow: var(--shadow);
        padding: 20px;
    }
    
    .main-nav.active {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 15px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .games-grid,
    .categories-grid,
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .stat h3 {
        font-size: 1.8rem;
    }
    
    .platform-icons {
        flex-direction: column;
    }
}

/* Loading Styles */
.games-loading {
    text-align: center;
    padding: 2rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #6c5ce7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Hide games grid initially */
.games-grid:empty {
    display: none;
}

/* Error State */
.games-error {
    text-align: center;
    padding: 2rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin: 1rem 0;
}

.games-error p {
    color: #856404;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}