/*
 Theme Name: Gamiato
 Theme URI: https://tejex.net/
 Author: Tejex
 Author URI: https://tejex.net
 Description: A modern and responsive WordPress theme designed for gaming and video content websites. Features a clean design with support for dark mode, custom footer, and author pages.
 Version: 1.2
 Text Domain: gamiato
 Tags: blog, two-columns, right-sidebar, custom-footer, dark-mode, gaming, video
*/

body {
    font-family: 'IRANSansX', Arial, sans-serif;
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    background: #fff;
    color: #333;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body.dark-mode {
    background: #1a1a1a;
    color: #ddd;
}

a {
    text-decoration: none;
    color: #232323;
}

.site-container {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: box-shadow 0.3s ease, backdrop-filter 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
}

body.dark-mode .site-header {
    background: rgba(26, 26, 26, 0.9);
}

body.menu-active .site-header {
    backdrop-filter: blur(8px) !important;
}

.site-header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    box-sizing: border-box;
    width: 100%;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo img {
    max-height: 50px;
}

.header-logo a {
    display: inline-block;
}

.icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.header-left .icon,
.header-right .icon {
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: filter 0.3s ease;
}

.header-left .icon:hover,
.header-right .icon:hover {
    filter: brightness(0) saturate(100%) hue-rotate(0deg) sepia(100%) saturate(500%) hue-rotate(-50deg);
}

body.dark-mode .header-left .icon,
body.dark-mode .header-right .icon {
    filter: invert(1);
}

body.dark-mode .header-left .icon:hover,
body.dark-mode .header-right .icon:hover {
    filter: brightness(0) saturate(100%) hue-rotate(0deg) sepia(100%) saturate(500%) hue-rotate(-20deg) invert(1);
}

body.dark-mode .dark-mode-toggle .icon {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(40deg);
}

body.dark-mode .dark-mode-toggle .icon:hover {
    filter: brightness(0) saturate(100%) hue-rotate(0deg) sepia(100%) saturate(500%) hue-rotate(-50deg) invert(1);
}

.search-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1001;
}

.search-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    position: relative;
    margin-top: 50px;
}

body.dark-mode .search-form {
    background: rgba(26, 26, 26, 0.95);
}

.search-form .header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.search-form input {
    width: 500px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f0f0f0;
    color: #333;
    font-size: 16px;
    font-family: 'IRANSansX', Arial, sans-serif;
}

body.dark-mode .search-form input {
    background: #333;
    color: #ddd;
    border-color: #555;
}

.search-form input::placeholder {
    color: #777;
    font-family: 'IRANSansX', Arial, sans-serif;
}

body.dark-mode .search-form input::placeholder {
    color: #aaa;
}

.close-search {
    position: absolute;
    top: 30px;
    right: 30px;
    cursor: pointer;
    border: none;
}

.menu-search-form {
    display: none;
    padding: 10px 20px;
}

.mobile-search-form {
    width: 100%;
}

.mobile-search-form form {
    width: 100%;
}

.mobile-search-form input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: #f0f0f0;
    color: #333;
    font-size: 16px;
    font-family: 'IRANSansX', Arial, sans-serif;
}

body.dark-mode .mobile-search-form input {
    background: #333;
    color: #ddd;
}

.mobile-search-form input::placeholder {
    color: #777;
    font-family: 'IRANSansX', Arial, sans-serif;
}

body.dark-mode .mobile-search-form input::placeholder {
    color: #aaa;
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1001;
}

.menu-overlay.active {
    display: block;
}

.side-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1002;
    overflow: hidden;
}

body.dark-mode .side-menu {
    background: #333;
}

.side-menu.active {
    display: block;
}

.menu-header {
    padding: 20px;
    position: relative;
}

.menu-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.menu-logo-img {
    max-height: 50px;
}

.menu-close {
    position: absolute;
    right: 0;
    cursor: pointer;
}

.menu-close .icon {
    width: 20px;
    height: 20px;
}

body.dark-mode .menu-close .icon {
    filter: invert(1);
}

.menu-divider {
    border-top: 1px dashed rgba(0, 0, 0, 0.2);
    margin: 15px 0;
}

body.dark-mode .menu-divider {
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
}

.menu-content {
    padding: 0 20px;
    overflow: hidden;
    max-height: calc(100vh - 200px);
}

.submenu-back-button {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    font-family: 'IRANSansX', Arial, sans-serif;
}

body.dark-mode .submenu-back-button {
    color: #ddd;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.nav-menu li {
    margin: 10px 0;
    position: relative;
    display: block;
    width: 100%;
}

.nav-menu li a {
    color: #333;
    font-size: 16px;
    transition: color 0.3s ease;
    padding: 5px 0;
    display: inline-block;
    position: relative;
}

body.dark-mode .nav-menu li a {
    color: #ddd;
}

.nav-menu li a:hover {
    color: #e20a0b;
}

/* استایل برای آیتم‌های دارای زیرمنو */
.nav-menu .menu-item-has-children {
    position: relative;
    width: 100%;
}

.nav-menu .menu-item-has-children > a {
    display: block;
    width: 100%;
    text-align: right;
}

/* آیکون در آخر خط منو */
.nav-menu .menu-item-has-children > a::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: url('/wp-content/themes/gamiato/assets/icons/fa-chevron-down.svg') no-repeat center center;
    background-size: contain;
    transition: background 0.3s ease;
}

/* آیکون در حالت باز */
.nav-menu .menu-item-has-children > a.open::after {
    background: url('/wp-content/themes/gamiato/assets/icons/fa-chevron-up.svg') no-repeat center center;
    background-size: contain;
}

body.dark-mode .nav-menu .menu-item-has-children > a::after {
    filter: invert(1);
}

body.dark-mode .nav-menu .menu-item-has-children > a.open::after {
    filter: invert(1);
}

/* مخفی کردن زیرمنوها به صورت پیش‌فرض */
.sub-menu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    padding-right: 20px;
    width: 100%;
    overflow: visible;
}

.sub-menu li {
    margin: 5px 0;
    display: block;
    width: 100%;
}

.sub-menu li a {
    font-size: 14px;
    color: #666;
    padding-left: 0;
}

body.dark-mode .sub-menu li a {
    color: #bbb;
}

.sub-menu li a:hover {
    color: #e20a0b;
}

.menu-footer {
    padding: 20px;
    position: absolute;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.social-button:hover {
    opacity: 0.9;
}

.social-button .icon {
    width: 20px;
    height: 20px;
}

.social-button.instagram {
    background: #833AB4;
    background: linear-gradient(90deg, rgba(131,58,180,1) 0%, rgba(253,29,29,1) 50%, rgba(252,176,69,1) 100%);
}

.social-button.telegram {
    background: linear-gradient(0deg, rgb(0 175 195) 0%, rgba(45,204,253,1) 100%);
}

.site-main {
    margin-top: 80px;
}

.featured-posts {
    padding: 20px 0;
    width: 100%;
}

.featured-posts-grid {
    display: grid;
    grid-template-areas: 
        "post1 post2"
        "second-row second-row";
    grid-template-columns: calc(65% - 7.5px) calc(35% - 7.5px);
    grid-template-rows: auto auto;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.second-row {
    grid-area: second-row;
    display: flex;
    gap: 15px;
    width: 100%;
}

.second-row .post-link {
    flex-grow: 0;
    flex-shrink: 0;
}

.second-row .post-link:nth-child(1) {
    flex: 0 0 calc(25% - 10px);
}

.second-row .post-link:nth-child(2) {
    flex: 0 0 calc(50% - 10px);
}

.second-row .post-link:nth-child(3) {
    flex: 0 0 calc(25% - 10px);
}

.featured-post.post-1 {
    grid-area: post1;
}

.featured-post.post-2 {
    grid-area: post2;
}

.post-link {
    display: block;
    width: 100%;
    height: 100%;
}

.featured-post {
    position: relative;
    height: 300px;
    border-radius: 14px;
    overflow: hidden;
}

.featured-post .post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.3s ease;
}

.featured-post:hover .post-image {
    filter: brightness(0.7);
}

.featured-post .post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    background: linear-gradient(to bottom, transparent 20%, rgb(0 0 0 / .95));
    transition: background 0.3s ease;
    z-index: 1;
}

.featured-post:hover .post-overlay {
    background: linear-gradient(to bottom, transparent 20%, rgb(0 0 0 / .95));
}

.featured-post h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.5;
    color: #fff;
}

.featured-post .category-info {
    margin-top: 10px;
    font-size: 14px;
}

.featured-post .category-info span {
    color: #e20a0b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.featured-post .category-info .icon {
    width: 16px;
    height: 16px;
}

.slider-section {
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

body.dark-mode .section-title {
    color: #ddd;
}

.section-title .icon-wrapper {
    background: #e20a0b;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.section-title .icon {
    filter: invert(1);
}

.slider-nav {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
}

.slider-prev,
.slider-next {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
    line-height: 0;
    box-shadow: none;
    border-radius: 0;
}

.slider-prev .icon,
.slider-next .icon {
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: none;
}

body.dark-mode .slider-prev .icon,
body.dark-mode .slider-next .icon {
    filter: invert(1);
}

.slider-prev .icon {
    transform: rotate(180deg);
}

.slider-next .icon {
    transform: rotate(180deg);
}

.swiper {
    width: 100%;
    padding: 10px 0;
    overflow: visible; /* بهبود نمایش در موبایل */
}

.swiper-wrapper {
    display: flex;
    align-items: stretch;
}

.swiper-slide {
    flex-shrink: 0;
    cursor: pointer;
    width: auto;
}

/* استایل جدید برای کارت‌های انتخاب سردبیر */
.editor-choice .swiper-slide.post-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    width: 300px; /* عرض کارت برای نمایش 4 کارت در دسکتاپ */
}

.editor-choice .post-image-link {
    display: block;
    width: 100%;
    height: 200px;
    position: relative;
}

.editor-choice .post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.editor-choice .post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0;
    z-index: 1;
}

.editor-choice .title-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(15px);
    border-radius: 0;
    padding: 10px;
    text-align: center;
    margin: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-choice .title-wrapper h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .editor-choice .title-wrapper h3 {
    color: #fff;
}

.site-footer {
    padding: 20px 0;
    text-align: center;
    background: #1a1a1a;
    color: #fff;
}

body.dark-mode .site-footer {
    background: #333;
}

/* Two-Column Container Styles */
.two-column-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    box-sizing: border-box;
}

.column-main {
    flex: 0 0 994px;
}

.column-sidebar {
    flex: 0 0 426px;
}

@media (max-width: 1500px) {
    .site-container, .header-container {
        max-width: 95%;
    }

    .featured-posts-grid {
        grid-template-columns: calc(65% - 7.5px) calc(35% - 7.5px);
    }
}

@media (max-width: 767px) {
    .site-container, .header-container {
        max-width: 100%;
        padding: 0 10px;
    }

    .site-main {
        margin-top: 60px;
    }

    .side-menu {
        width: 65%;
    }

    .header-left a,
    .header-right .search-toggle {
        display: none;
    }

    .header-left .menu-toggle,
    .header-right .dark-mode-toggle {
        display: block;
    }

    .header-left {
        order: 1;
        margin-right: auto;
    }

    .header-right {
        order: 3;
        margin-left: auto;
    }

    .header-logo {
        order: 2;
        flex-grow: 1;
        text-align: center;
    }

    .search-popup {
        display: none !important;
    }

    .menu-search-form {
        display: block;
    }

    .featured-posts-grid {
        display: grid;
        grid-template-areas: 
            "post1"
            "post2 post3"
            "post4 post5";
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto auto auto;
        gap: 15px;
        width: 100%;
    }

    .post-link:nth-child(1) {
        grid-area: post1;
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .post-link:nth-child(2) {
        grid-area: post2;
        grid-column: 1 / 2;
        grid-row: 2;
    }

    .second-row {
        display: contents;
    }

    .second-row .post-link:nth-child(1) {
        grid-area: post3;
        grid-column: 2 / 3;
        grid-row: 2;
    }

    .second-row .post-link:nth-child(2) {
        grid-area: post4;
        grid-column: 1 / 2;
        grid-row: 3;
    }

    .second-row .post-link:nth-child(3) {
        grid-area: post5;
        grid-column: 2 / 3;
        grid-row: 3;
    }

    .featured-post.post-1 {
        height: 200px;
        width: 100%;
    }

    .featured-post.post-2 {
        height: 200px;
        width: 100%;
    }

    .featured-post.post-3 {
        height: 200px;
        width: 100%;
        margin: 0;
    }

    .featured-post.post-4 {
        height: 200px;
        width: 100%;
        margin: 0;
    }

    .featured-post.post-5 {
        height: 200px;
        width: 100%;
        margin: 0;
    }

    .featured-post:not(.post-1) .category-info {
        display: none;
    }

    .featured-post h2 {
        font-size: 16px;
    }

    .two-column-container {
        flex-wrap: wrap;
    }

    .column-main,
    .column-sidebar {
        flex: 0 0 100%;
    }

    .editor-choice .swiper-slide.post-card {
        width: 100%; /* عرض کامل برای نمایش 1 کارت در موبایل */
    }

    .editor-choice .post-image-link {
        height: 200px; /* افزایش ارتفاع کارت در موبایل */
    }

    .editor-choice .title-wrapper h3 {
        font-size: 14px;
    }

    .swiper {
        overflow: hidden; /* جلوگیری از مشکلات Overflow در موبایل */
    }

    .swiper-wrapper {
        width: 100%;
    }

    .swiper-slide {
        width: 100% !important; /* اطمینان از عرض کامل در موبایل */
    }
}