@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #81C784;
    --accent-color: #FF5722;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-light: #f8f9fa;
    --bg-dark: #1a1a1a;
    --header-bg-light: rgba(255, 255, 255, 0.95);
    --header-bg-dark: rgba(40, 40, 40, 0.95);
    --footer-bg: #333;
    --footer-text: #fff;
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header Styles */
.site-header {
    position: sticky;
    top: 0;
    background-color: var(--header-bg-light);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
}

.logo:hover {
    color: var(--primary-dark);
}

.logo::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.logo:hover::after {
    width: 100%;
}

.menu-icon {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
}

.menu-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><polygon fill="rgba(255,255,255,0.05)" points="0,100 100,0 100,100"/></svg>');
    background-size: cover;
    animation: heroAnimation 30s linear infinite;
}

@keyframes heroAnimation {
    0% {
        transform: translateX(0) translateY(0);
    }
    50% {
        transform: translateX(-5%) translateY(-5%);
    }
    100% {
        transform: translateX(0) translateY(0);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 1s ease;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    animation: fadeInUp 1s ease 0.2s both;
}

/* Games Grid - Modified to support theme-based variables */
.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--grid-columns, 180px), 1fr));
    gap: var(--grid-gap, 20px);
    padding: var(--grid-container-padding, 40px 20px);
    max-width: 1400px;
    margin: 0 auto;
}

.game-card {
    background: white;
    border-radius: var(--grid-border-radius, 15px);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
}

/* Special styles for different grid types */
.game-card.grid-small {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.game-card.grid-medium {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.game-card.grid-large {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.game-card.hover .game-img-container::after {
    opacity: 1;
}

.game-img-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Default 1:1 Aspect Ratio - will be overridden by theme */
    aspect-ratio: var(--grid-aspect-ratio, 1/1);
    overflow: hidden;
}

.game-img-container::after {
    content: 'Play';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(76, 175, 80, 0.8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-card:hover .game-img-container::after {
    opacity: 1;
    background: rgba(76, 175, 80, 0.9);
}

.game-img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.game-card:hover .game-img-container img {
    transform: scale(1.1);
}

.game-info {
    padding: var(--grid-item-padding, 15px);
}

.game-info h3 {
    font-size: var(--grid-item-font-size, 1rem);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.game-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: #f1f1f1;
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
    border: 1px solid var(--primary-light);
}

/* Footer */
footer {
    /* Removing the fixed background gradient */
    /* background: linear-gradient(135deg, var(--primary-dark), var(--footer-bg)); */
    /* This will now be set by theme.css */
    color: var(--footer-text);
    padding: 30px 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-links {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: nowrap; /* Prevent links from wrapping */
    justify-content: center; /* Center the links */
}

.footer-links a {
    color: #ccc;
    transition: color 0.3s ease;
    position: relative;
    font-size: 0.95rem; /* Slightly reduce font size to help fit on small screens */
    white-space: nowrap; /* Prevent individual link text from wrapping */
}

/* Back to Home Link */
.back-to-home {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-to-home:hover {
    color: var(--primary-dark);
    transform: translateX(-5px);
}

/* Content Container */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

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

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

/* Responsive Design - Updated for theme-based grid */
@media (max-width: 1200px) {
    .games-container {
        grid-template-columns: repeat(auto-fill, minmax(calc(var(--grid-columns, 180px) * 0.9), 1fr));
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 1rem;
    }
    
    .menu-icon {
        display: flex;
    }
    
    .menu-icon.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    .menu-icon.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-icon.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .games-container {
        grid-template-columns: repeat(auto-fill, minmax(calc(var(--grid-columns, 180px) * 0.8), 1fr));
        gap: calc(var(--grid-gap, 20px) * 0.75);
        padding: calc(var(--grid-container-padding, 40px) / 2) 15px;
    }
    
    .game-info h3 {
        font-size: calc(var(--grid-item-font-size, 1rem) * 0.9);
    }
    
    .footer-links {
        gap: 10px; /* Reduce gap between links on mobile */
    }
    
    .footer-links a {
        font-size: 0.9rem; /* Further reduce font size on mobile */
        padding: 0 5px; /* Add some horizontal padding for tap targets */
    }
}

@media (max-width: 480px) {
    .games-container {
        grid-template-columns: repeat(auto-fill, minmax(calc(var(--grid-columns, 180px) * 0.7), 1fr));
        gap: calc(var(--grid-gap, 20px) * 0.5);
        padding: calc(var(--grid-container-padding, 40px) / 3) 10px;
    }
    
    .game-info h3 {
        font-size: calc(var(--grid-item-font-size, 1rem) * 0.85);
    }
    
    .game-type {
        font-size: 0.7rem;
    }
    
    .site-header {
        padding: 0.8rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .hero {
        padding: 50px 15px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .footer-links {
        gap: 8px; /* Even smaller gap on very small screens */
    }
    
    .footer-links a {
        font-size: 0.85rem; /* Smallest font size for tiny screens */
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #81C784;
        --primary-dark: #4CAF50;
        --primary-light: #C8E6C9;
        --text-primary: #f1f1f1;
        --text-secondary: #ccc;
    }
    
    body {
        background-color: var(--bg-dark);
    }
    
    .site-header {
        background-color: var(--header-bg-dark);
    }
    
    .menu-icon span {
        background-color: var(--text-primary);
    }
    
    .game-card {
        background-color: #2a2a2a;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
    
    .game-type {
        background-color: #3a3a3a;
        color: #ccc;
    }
    
    footer {
        background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    }
}
