/* ==========================================
   Common Styles for H5 Game Website
   ========================================== */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #4a4a4a;
    --accent-color: #2a2a2a;
    --text-color: #333;
    --light-bg: #fafafa;
    --white: #ffffff;
    --gray: #666;
    --light-gray: #e5e5e5;
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --header-height: 70px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
}

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

/* Header Styles */
header {
    background-color: var(--white);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

/* Navigation */
nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: var(--border-radius);
}

nav a:hover,
nav a.active {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

/* Main Content */
main {
    min-height: calc(100vh - var(--header-height) - 200px);
    padding: 40px 0;
}

/* Footer Styles */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
}

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

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--white);
    padding-left: 5px;
}

.footer-logo {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.footer-logo img {
    height: 35px;
    margin-right: 10px;
    filter: invert(1);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* Back to Top Button */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    z-index: 999;
}

#backToTop:hover {
    background-color: var(--primary-color);
    transform: translateY(-5px);
}

#backToTop.show {
    display: flex;
}

/* Utility Classes */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--secondary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: var(--gray);
}

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

.game-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.game-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--light-gray);
}

.game-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-card-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.game-card-description {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 15px;
    line-height: 1.5;
    flex: 1;
}

.game-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--light-gray);
}

/* Card Component */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Section Title */
.section-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-align: center;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .menu-toggle {
        display: flex;
    }

    nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: var(--white);
        box-shadow: var(--box-shadow);
        height: 100vh;
        height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    nav.active {
        height: 100vh;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 20px;
    }

    nav a {
        display: block;
        padding: 12px 16px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 24px;
    }

    #backToTop {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .logo {
        font-size: 20px;
    }

    .logo img {
        height: 32px;
    }
}