/*
 Theme Name: WebGame
 Theme URI: https://web-game.ir/
 Author: Grok
 Author URI: dariush kianifar
 Description: A WordPress theme for web games, displaying categories and games on the homepage, responsive for mobile.
 Version: 1.4
 Text Domain: webgame
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a{
    text-decoration: none;
}

body {
    font-family:  Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
}

.site-branding {
    text-align: center;
}

.branding-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.site-logo {
    max-width: 50px;
    height: auto;
    margin-right: 0.5rem;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
}

header h1 a {
    color: #fff;
    text-decoration: none;
}

header h1 a:hover {
    color: #ddd;
}

.site-description {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 0.3rem;
}

/* ÙÙØ· Ø¨Ø®Ø´âÙØ§Û ÙØ±Ø¨ÙØ· Ø¨Ù ÙÙÙ ÙÙØ§ÛØ´ Ø¯Ø§Ø¯Ù Ø´Ø¯ÙâØ§ÙØ¯ */
nav {
    background: #444;
    position: relative;
}

nav .container {
    position: relative;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 !important;
}

nav ul li {
    margin: 0.3rem;
    position: relative;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 15px;
    display: block;
}

nav ul li a:hover {
    color: #ddd;
}

/* Ø§Ø³ØªØ§ÛÙ Ø²ÛØ±ÙÙÙ */
nav ul li.has-submenu > .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0; /* Ø¨Ø±Ø§Û RTL */
    background: #333;
    min-width: 120px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
}

nav ul li.has-submenu:hover > .sub-menu {
    display: block; /* ÙÙØ§ÛØ´ Ø²ÛØ±ÙÙÙ Ø¨Ø§ ÙØ§ÙØ± Ø¯Ø± Ø¯Ø³Ú©ØªØ§Ù¾ */
}

nav ul li.has-submenu > .sub-menu li {
    margin: 0;
}

nav ul li.has-submenu > .sub-menu li a {
    padding: 10px;
    color: #fff;
}

nav ul li.has-submenu > .sub-menu li a:hover {
    background: #555;
}

/* Ø§Ø³ØªØ§ÛÙ Ø¨Ø±Ø§Û ÙÙØ¨Ø§ÛÙ */
@media (max-width: 768px) {
    nav ul {
        display: flex;
        flex-direction: row; /* ÙÙÙÛ Ø§ØµÙÛ Ø§ÙÙÛ */
        flex-wrap: wrap; /* Ø§Ø¬Ø§Ø²Ù ÙÛâØ¯ÙØ¯ Ø¢ÛØªÙâÙØ§ Ø¨Ù Ø®Ø· Ø¨Ø¹Ø¯Û Ø¨Ø±ÙÙØ¯ */
        width: 100%;
        background: #444;
        justify-content: flex-start; /* Ø¢ÛØªÙâÙØ§ Ø§Ø² Ø±Ø§Ø³Øª Ø´Ø±ÙØ¹ ÙÛâØ´ÙÙØ¯ (RTL) */
    }

    nav ul li {
        margin: 0.2rem;
        flex: 0 0 auto; /* Ø¹Ø±Ø¶ Ø¢ÛØªÙâÙØ§ Ø¨Ø± Ø§Ø³Ø§Ø³ ÙØ­ØªÙØ§ */
    }

    nav ul li a {
        padding: 10px 12px;
        font-size: 0.9rem;
        border-bottom: none; /* Ø­Ø°Ù Ø®Ø· Ø²ÛØ±ÛÙ Ø¯Ø± ÙÙÙÛ Ø§ØµÙÛ */
    }

    nav ul li.has-submenu > .sub-menu {
        position: absolute;
        top: 100%;
        right: 0; /* Ø¨Ø±Ø§Û RTL */
        display: none; /* Ø²ÛØ±ÙÙÙÙØ§ Ø¨Ù ØµÙØ±Øª Ù¾ÛØ´âÙØ±Ø¶ ÙØ®ÙÛ */
        background: #555;
        width: 200px; /* Ø¹Ø±Ø¶ Ø«Ø§Ø¨Øª Ø¨Ø±Ø§Û Ø²ÛØ±ÙÙÙ */
        border-radius: 4px;
    }

    nav ul li.has-submenu.active > .sub-menu {
        display: block; /* ÙÙØ§ÛØ´ Ø²ÛØ±ÙÙÙ Ø¨Ø§ Ú©ÙÛÚ© */
    }

    nav ul li.has-submenu > .sub-menu li {
        width: 100%;
    }

    nav ul li.has-submenu > .sub-menu li a {
        padding: 10px;
        border-bottom: 1px solid #666;
    }
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.game-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-card img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    aspect-ratio: 1/1;
}

.game-card h3 {
    padding: 0.5rem;
    font-size: 1.1rem;
}

.game-card p {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
    padding: 0 0.5rem;
}

.game-card .game-update {
    font-size: 0.75rem;
    color: #444;
    margin: 0.3rem 0;
}

.game-card .update-message {
    font-size: 0.8rem;
    color: #2c7dfa;
    font-style: italic;
    margin: 0.3rem 0;
}

.game-card .play-button {
    display: inline-block;
    margin: 0.5rem;
}

.game-content {
    margin: 2rem 0;
}

.entry-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.game-thumbnail img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.game-description {
    margin-bottom: 2rem;
}

.game-play iframe {
    max-width: 100%;
    height: 300px;
    border-radius: 8px;
}

.game-play iframe.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

.genre-item {
    display: inline-block;
    background-color: #e0e0e0;
    color: #333;
    padding: 4px 10px;
    margin: 5px 5px 0 0;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Ø§Ø³ØªØ§ÛÙâÙØ§Û ØµÙØ­ÙâØ¨ÙØ¯Û */
.pagination{
    justify-content: center;
    align-items: center;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px; /* ÙØ§ØµÙÙ Ø¨ÛÙ ÙÛÙÚ©âÙØ§ */
    margin: 20px 0;
    direction: rtl; /* Ø±Ø§Ø³ØªâÚÛÙ */
}

.page-numbers {
    display: inline-block;
    padding: 8px 12px;
    background-color: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.page-numbers:hover:not(.current) {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.page-numbers.current {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    cursor: default;
}

.page-numbers.dots {
    background: none;
    border: none;
    padding: 8px;
    cursor: default;
}

.page-numbers.prev,
.page-numbers.next {
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .branding-link {
        flex-direction: row;
        justify-content: center;
    }

    .site-logo {
        max-width: 40px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .site-description {
        font-size: 0.7rem;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .game-card img {
        height: 150px;
        width: 150px;
    }

    .game-play iframe {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .game-card img {
        height: 120px;
        width: 120px;
    }

    .game-card h3 {
        font-size: 1rem;
    }

    .game-card p {
        font-size: 0.75rem;
    }

    .game-card .game-update {
        font-size: 0.7rem;
    }

    .game-card .update-message {
        font-size: 0.75rem;
    }

    .game-play iframe {
        height: 300px;
    }
}