:root {
    --main-bg: linear-gradient(135deg, #1f3f36, #516358, #2f4f44);
    --main-green: linear-gradient(135deg, #4caf50, #2e7d32);
    --hover-green: linear-gradient(135deg, #66bb6a, #388e3c);
    --main-orange: #FF6347;
    --hover-orange: #FF4500;
    --text-light: white;
    --text-dark: black;
    --admin-button-bg: #333;
    --filename-text: #316358;
    --input-outline: #316358;
    --link-color: #00ffff;
}

/* =======================
   RESET
======================= */

* {
    box-sizing: border-box;
}

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, #4caf50, #2e7d32);
    transition: 0.25s;
}

.search-bar input[type="submit"]:hover {
    background: linear-gradient(135deg, #66bb6a, #388e3c);
    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-color: var(--main-green);
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    transition: 0.3s;
}

.product-link-btn:hover {
    background-color: var(--hover-orange);
    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-color: var(--main-green);
    color: var(--text-light);
    border: none;
    cursor: pointer;
    border-radius: 5px;
    width: 100%;
}

.button:hover {
    background-color: var(--hover-green);
}

.payment-button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;

    background: linear-gradient(135deg, #519358, #2e7d32);
    color: #fff;

    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: 0.3s;
}


.payment-button:hover {
    background-color: var(--main-orange);
    transform: scale(1.05);
}

/* =======================
   MENU
======================= */

.main-menu {
    text-align: center;
}

.main-menu-root,
.sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-block;
    direction: rtl;
}

.main-menu-root > li,
.sub-menu li {
    position: relative;
    display: inline-block;
}

.main-menu-root li a,
.sub-menu li a {
    display: block;
    padding: 10px 18px;
    margin: 2px;
    background: linear-gradient(135deg, #316358, #4caf50);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
    min-width: 120px;
    text-align: center;
    transition: 0.25s ease;
}


.main-menu-root li a:hover,
.sub-menu li a:hover {
    background: linear-gradient(135deg, #66bb6a, #2e7d32);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}


.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #316358;
    min-width: 180px;
    z-index: 9999;
}

.main-menu-root li:hover > .sub-menu,
.sub-menu li:hover > .sub-menu {
    display: block;
}

/* =======================
   AUTH BOX
======================= */

.auth-box {
    width: 100%;
    max-width: 360px;
    margin: 20px auto;
    background: #333;
    border-radius: 8px;
    padding: 10px;
}

.auth-tabs {
    display: flex;
}

.auth-tabs button {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    border: none;
    background: #222;
    color: white;
    font-size: 14px;
}

.auth-tabs button.active-tab {
    background: var(--main-green);
}

.auth-form {
    display: none;
    margin-top: 10px;
}

.auth-form.active {
    display: block;
}

/* =======================
   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 h2,
.product h2 a {
    color: #1f3f36;
    text-decoration: none;
}


.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;
    }

    .sub-menu {
        position: static;
    }
}

@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;
    gap: 10px;
}

.user-row p{
    margin: 0;
}

.admin-button,
.logout-button{
    display: inline-block;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 6px;
}

