:root {
    /* پس زمینه اصلی */
    --main-bg: linear-gradient(135deg, #140b0a, #241210, #0d0706);

    /* رنگ اصلی دکمه‌ها */
    --main-green: linear-gradient(135deg, #d85a2a, #b83e18);
    --hover-green: linear-gradient(135deg, #e46a38, #c94a20);

    /* رنگ‌های تاکیدی */
    --main-orange: #d85a2a;
    --hover-orange: #f06d35;

    /* متن */
    --text-light: #f5f5f5;
    --text-dark: #120a08;

    /* پنل‌ها و کارت‌ها */
    --admin-button-bg: #1f1210;

    /* نام فایل‌ها */
    --filename-text: #ff9b68;

    /* فیلدها */
    --input-outline: #c85024;

    /* لینک‌ها */
    --link-color: #ffb088;

    /* اختیاری */
    --card-bg: #1a0f0d;
    --card-hover: #241411;

    --border-color: rgba(216, 90, 42, 0.25);
    --shadow-color: rgba(216, 90, 42, 0.18);

    --success-color: #e06b3a;
    --danger-color: #ff5a47;
}


/* =======================
   RESET
======================= */

* {
    box-sizing: border-box;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("admin/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: "Vazirmatn";
}

.search-bar input,
.search-bar input[type="text"],
.search-bar input[type="submit"] {
    font-family: "Vazirmatn";
}

input,
textarea,
select,
button {
    font-family: "Vazirmatn";
}

body {
    margin: 0;
    padding: 0;
    background: var(--main-bg);
    color: var(--text-light);
    text-align: center;
    font-size: 12px;
}

/* =======================
   MAIN WRAPPER (خیلی مهم)
======================= */

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

/* =======================
   TEXT
======================= */

h1 {
    font-size: 20px;
}

p {
    font-size: 14px;
    margin-top: 10px;
}

/* =======================
   PRODUCT GRID (اصلی‌ترین اصلاح)
======================= */

.product-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px auto;
    width: 100%;
    align-items: stretch;
}

/* =======================
   PRODUCT CARD
======================= */

.product {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 8px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    color: var(--text-dark);
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 360px;
    transition: transform 0.3s ease;
}

.product:hover {
    transform: translateY(-3px);
}

/* =======================
   IMAGE
======================= */

img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    transition: opacity 0.5s ease;
}



/* =======================
   SEARCH
======================= */

.search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.25);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.search-bar input[type="text"] {
    width: 240px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    outline: none;
    font-size: 13px;
    background: #fff;
    color: #333;
    transition: 0.3s;
}

.search-bar input[type="text"]:focus {
    box-shadow: 0 0 0 2px #4caf50;
}


.search-bar input[type="submit"] {
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    color: white;
    background: linear-gradient(135deg, #B8541A, #6E2E0F);
    transition: 0.25s;
}

.search-bar input[type="submit"]:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
    transform: scale(1.05);
}


/* =======================
   PAGINATION
======================= */

.pagination {
    margin-top: 15px;
}

.pagination a {
    padding: 5px 10px;
    margin: 0 5px;
    background-color: var(--admin-button-bg);
    color: var(--text-light);
    border-radius: 5px;
    text-decoration: none;
    font-size: 11px;
}

.pagination a.active {
    background-color: var(--main-green);
}

/* =======================
   BUTTON LINK
======================= */

.product-link-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #C85A1A, #6E2E0F);
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    transition: 0.3s;
}

.product-link-btn:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
    transform: scale(1.05);
}

/* =======================
   USER INFO
======================= */

.user-info {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: rgba(0,0,0,0.7);
    color: var(--text-light);
    padding: 8px;
    border-radius: 5px;
    font-size: 14px;
}

/* =======================
   INPUTS
======================= */

input[type="text"],
input[type="password"] {
    padding: 8px;
    border-radius: 5px;
    border: none;
    margin-bottom: 10px;
    width: 100%;
}

/* =======================
   MOBILE INPUT FIX
======================= */

.mobile-input {
    width: 100%;
    max-width: 240px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 5px;
    text-align: center;
    outline: 3px solid var(--input-outline);
    margin: 0 auto;
    display: block;
}

/* =======================
   BUTTONS
======================= */

.button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #C85A1A, #6E2E0F);
    color: var(--text-light);
    border: none;
    cursor: pointer;
    border-radius: 5px;
    width: 100%;
}

.button:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
}

.payment-button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;

    background: linear-gradient(135deg, #C85A1A, #8A3D12);
    color: #fff;

    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: 0.3s;
}


.payment-button:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
    transform: scale(1.05);
}

/* =======================
   MENU
======================= */

.main-menu {
    text-align: center;
}

.main-menu-root,
.sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    direction: rtl;
}

/* آیتم‌های اصلی */
.main-menu-root > li {
    position: relative;
    display: inline-block;
}

/* آیتم‌های زیرمنو */
.sub-menu li {
    position: relative;
    white-space: nowrap; /* 👈 جلوگیری از کش آمدن */
}

/* لینک‌ها */
.main-menu-root li a,
.sub-menu li a {
    display: block;
    padding: 10px 18px;
    margin: 0;

    background: linear-gradient(135deg, #C85A1A, #6E2E0F);
    color: #fff;
    text-decoration: none;

    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;

    min-width: 120px;
    text-align: center;

    transition: 0.25s ease;
}

/* hover لینک */
.main-menu-root li a:hover,
.sub-menu li a:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* =======================
   SUBMENU FIX کامل و نهایی
======================= */

/* همه زیرمنوها */
.main-menu-root > li > .sub-menu,
.sub-menu {
    display: none;
    position: absolute;

    top: 0;
    right: 100%;

    min-width: 160px;
    width: max-content;

    padding: 5px 0;
    margin: 0;

    border-radius: 8px;

    background: transparent;
    box-shadow: none;

    z-index: 99999;
}

/* نمایش زیرمنو */
.main-menu-root li:hover > .sub-menu,
.sub-menu li:hover > .sub-menu {
    display: block;
}

/* آیتم‌های زیرمنو */
.sub-menu li {
    position: relative;
    white-space: nowrap;
}

/* لینک‌های زیرمنو (اینجا رنگ واقعی منو) */
.sub-menu li a {
    display: block;
    padding: 10px 16px;

    background: linear-gradient(135deg, #C85A1A, #6E2E0F);
    color: #fff;

    text-decoration: none;
    border-radius: 6px;

    transition: 0.25s ease;
}

/* hover لینک‌ها */
.sub-menu li a:hover {
    background: linear-gradient(135deg, #FF9A3C, #FF6A00);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* لایه‌بندی برای اینکه زیر محصولات نره */
.main-menu {
    position: relative;
    z-index: 99999;
}

.sub-menu {
    z-index: 99999;
}

.product-container {
    position: relative;
    z-index: 1;
}

/* =======================
   AUTH BOX
======================= */
.auth-box {
    width: 100%;
    max-width: 360px;
    margin: 20px auto;
    background: #333;
    border-radius: 8px;
    padding: 10px;
    position: relative;
    z-index: 1000;
}

/* فرم‌ها عادی باشن */
.auth-form {
    display: none;
    width: 100%;
    margin-top: 10px;
}

/* فقط فعال دیده بشه */
.auth-form.active {
    display: block;
}

/* تب‌ها */
.auth-tabs {
    display: flex;
    margin-top: 10px;
}

.auth-tabs button {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    border: none;
    background: #222;
    color: white;
}

.auth-tabs button.active-tab {
    background: var(--main-green);
}

/* =======================
   DOWNLOAD
======================= */

.free-download-button {
    display: inline-block;
    padding: 8px;
    width: 50%;
}

/* =======================
   ERROR / SUCCESS
======================= */

.error {
    color: red;
}

.success {
    color: var(--text-light);
}

/* =======================
   FILE NAME
======================= */

.product p.filename {
    word-break: break-word;
}

/* =======================
   PRICE FIX
======================= */

.hidden-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--main-green);
}

/* =======================
   RESPONSIVE FIX
======================= */

@media (max-width: 768px) {

    .product-container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .product {
        width: 100%;
        max-width: 320px;   /* مهم */
        margin: 0 auto;     /* وسط چین */
        border-radius: 10px;
    }

    .auth-box {
        max-width: 95%;
    }

    .mobile-input {
        max-width: 80%;
    }
}


/* صفحه محصول تکی */
.single-product {
    display: flex !important;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

/* کارت محصول در حالت تکی */
.single-product .product {
    max-width: 420px;
    width: 100%;
}




.product-link-btn,
.product-link-btn:visited,
.product-link-btn:active {
    color: #1f3f36 !important;
    background: var(--main-green);
    display: inline-block;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
}

/* حالت hover */
.product-link-btn:hover {
    color: #fff !important;
    background: var(--hover-orange);
}

@media (min-width: 769px) {

    .top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
    }

    .auth-box {
        position: static;
        width: 280px;
        margin: 0;
    }

    .main-menu {
        flex: 1;
        text-align: center;
    }
}

.auth-box {
    position: static;
    margin: 0;
}

.top-bar {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    margin: 15px auto;
}

/* وسط (search) */
.top-center {
    display: flex;
    justify-content: center;
}

/* راست (menu) */
.top-right {
    display: flex;
    justify-content: flex-end;
}



/* سرچ */
.search-bar {
    display: flex;
    justify-content: center;
}

.search-bar input[type="text"] {
    width: 220px;
}

/* منو */
.main-menu {
    text-align: right;
}

@media (max-width: 768px) {

    .top-bar {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .top-left,
    .top-center,
    .top-right {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .search-bar input[type="text"] {
        width: 90%;
        max-width: 300px;
    }

    .auth-box {
        width: 95%;
        max-width: 360px;
    }

    .main-menu {
        text-align: center;
    }
}

@media (max-width: 768px) {

    .main-menu-root li a,
    .sub-menu li a {
        width: 90%;
        margin: 5px auto;
        font-size: 14px;
        padding: 12px;
    }



.main-menu-root > li {
    display: block;
    position: relative;
}

/* مهم‌ترین override */
.main-menu-root > li > .sub-menu,
.sub-menu {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;

    width: 100% !important;
    min-width: 100% !important;

    background: transparent;
}


}


@media (max-width: 768px) {
    .search-bar {
        width: 95%;
        flex-direction: column;
    }

    .search-bar input[type="text"] {
        width: 100%;
    }

    .search-bar input[type="submit"] {
        width: 100%;
    }
}

.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.p {
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0.25;
    background-size: contain;
    background-repeat: no-repeat;
    animation: float 12s linear infinite;
}

.p1 { background-image: url('/uploads/images/bax1.png'); left: 10%; animation-duration: 18s; }
.p2 { background-image: url('/uploads/images/bax2.png'); left: 25%; animation-duration: 14s; }
.p3 { background-image: url('/uploads/images/bax3.png'); left: 50%; animation-duration: 20s; }
.p4 { background-image: url('/uploads/images/bax4.png'); left: 70%; animation-duration: 16s; }
.p5 { background-image: url('/uploads/images/bax5.png'); left: 85%; animation-duration: 22s; }
.p6 { background-image: url('/uploads/images/bax6.png'); left: 85%; animation-duration: 12s; }
.p7 { background-image: url('/uploads/images/bax7.png'); left: 85%; animation-duration: 24s; }


@keyframes float {
    0% {
        transform: translate(0, 110vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.25;
    }

    25% {
        transform: translate(30px, 70vh) rotate(90deg);
    }

    50% {
        transform: translate(-40px, 40vh) rotate(180deg);
    }

    75% {
        transform: translate(25px, 10vh) rotate(270deg);
    }

    100% {
        transform: translate(-20px, -120px) rotate(360deg);
        opacity: 0;
    }
}


main {
    position: relative;
    z-index: 2;
}





.user-row{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    flex-wrap:wrap;
}

.user-row p{
    margin:0;
    padding:8px 14px;
    background:rgba(255,255,255,0.15);
    color:#fff;
    border-radius:8px;
    font-weight:bold;
    font-size:14px;
}

.admin-button{
    display:inline-block;
    padding:8px 14px;
    text-decoration:none;
    border-radius:8px;
    color:#fff;
    font-weight:bold;
    background:var(--main-green);
    transition:.3s;
}

.admin-button:hover{
    background:var(--hover-green);
    transform:translateY(-2px);
}

.logout-button{
    display:inline-block;
    padding:8px 14px;
    text-decoration:none;
    border-radius:8px;
    color:#fff;
    font-weight:bold;
    background:linear-gradient(135deg,#f44336,#c62828);
    transition:.3s;
}

.logout-button:hover{
    transform:translateY(-2px);
}




.login-popup-btn{
    padding:10px 18px;
    border:none;
    border-radius:8px;
    cursor:pointer;
    color:#fff;
    font-weight:bold;
    background: linear-gradient(135deg, #B8541A, #6E2E0F);
}

.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.7);
    z-index:99999;
}

.modal.show{
    display:block;
}

.modal-content{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
}

.close-modal{
    position:absolute;
    top:5px;
    left:10px;
    font-size:28px;
    color:white;
    cursor:pointer;
}

.modal .auth-box{
    margin:0;
    width:350px;
    max-width:95vw;
}


.auth-form button.button{
    background: var(--main-green);
    color: var(--text-light);
    width: 100%;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 6px;
    transition: 0.3s;
}

.auth-form button.button:hover{
    background: var(--hover-green);
    transform: scale(1.05);
}

.home-link {
    cursor: pointer;
    position: relative;
    display: inline-block;
    color: inherit;
    font-weight: 600;
    transition: all 0.25s ease;
}

/* خط خیلی ظریف زیر متن */
.home-link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 0%;
    height: 2px;
    background: var(--main-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 2px;
}

/* hover مدرن */
.home-link:hover {
    color: var(--main-green);
    transform: translateY(-1px);
}

/* خط کم‌کم ظاهر میشه */
.home-link:hover::after {
    width: 80%;
}


.show-description-btn{
    width:100%;
    margin:10px 0;
    padding:10px;
    cursor:pointer;
}

.description-modal-content{
    max-width:800px;
    max-height:80vh;
    overflow-y:auto;
    text-align:right;
}

#descriptionText{
    line-height:2;
    white-space:normal;
}



.site-title{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    cursor:pointer;
}

/* عکس جدید بره سمت راست */
.site-logo-left{
    width:100px;
    height:75px;
    object-fit:contain;
    order: 2;
}

/* لوگوی اصلی سمت چپ */
.site-logo{
    width:55px;
    height:55px;
    object-fit:contain;
    order: 1;
}







.terms-link{
    text-align:center;
    margin:12px 0;
}


.terms-link a{
    color:#4CAF50;
    text-decoration:none;
    font-size:14px;
    font-weight:bold;
    cursor:pointer;
}

.terms-link a:hover{
    text-decoration:underline;
}

.terms-modal{
    max-width:700px;
    width:90%;
}

.terms-content{
    max-height:60vh;
    overflow-y:auto;
    text-align:right;
    line-height:2;
    padding:10px;
    color:#4CAF50;
    text-shadow: 2px 2px 3px #000;
}

.terms-modal .close-modal{
    font-size:50px;
    color:#f44336;
    font-weight:bold;
    text-shadow: 0 0 4px #000;
}

/* فقط اصلاح صفحه اختصاصی بدون دست زدن به حالت عمومی */
.single-product .product h2{
    background: linear-gradient(135deg, #C85A1A, #6E2E0F);
    margin: 0;
    padding: 10px 12px;
    border-radius: 6px;
}

.single-product .product h2 a{
    color: #fff !important;
    text-decoration: none;
    display: block;
}
