/* ======================== RESET & BASE ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, system-ui, sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 16px;
    color: #f1f5f9;
}

/* کانتینر اصلی – با حاشیه مناسب موبایل */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ffffff, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

/* ======================== بخش ورود ======================== */
.user-section, .user-info {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 60px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-section input, .user-info input {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 12px 16px;
    border-radius: 40px;
    color: white;
    font-size: 0.95rem;
    width: 100%;
}
.user-section input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}
.user-section button, .user-info button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

/* دکمه‌های ثانویه بعد از ورود */
.user-info + div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}
.user-info + div button {
    flex: 1 1 auto;
    min-width: 100px;
    font-size: 0.85rem;
    padding: 10px;
}

/* ======================== محصولات ======================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.product-card {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: 0.3s;
}
.product-card:hover {
    transform: translateY(-4px);
    background: rgba(0, 0, 0, 0.8);
}
.product-img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: 20px;
    margin-bottom: 12px;
}
.product-card h3 {
    color: #facc15;
    font-size: 1.3rem;
    margin: 8px 0;
}
.product-card p {
    color: #e2e8f0;
    font-size: 0.9rem;
    margin: 4px 0;
}
/* دکمه خرید – تضمین کلیک‌پذیری */
.product-card .buy-btn,
.product-card .reviews-btn {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    pointer-events: auto;      /* اطمینان از فعال بودن رویداد کلیک */
    z-index: 10;               /* جلوتر از سایر عناصر */
    position: relative;
}

/* ======================== مودال‌ها ======================== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;            /* بسیار بالا برای جلوگیری از پوشیده شدن */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #1e293b;
    border-radius: 28px;
    padding: 20px;
    max-width: 95%;
    width: 95%;
    max-height: 90%;
    overflow-y: auto;
    color: #f1f5f9;
    border: 1px solid #6366f1;
}
.modal-content h3 {
    color: #facc15;
    margin-bottom: 15px;
}
.modal-content button {
    margin-top: 10px;
    width: 100%;
}

/* گزینه‌های درگاه پرداخت */
.gateway-option {
    display: inline-block;
    margin: 5px;
    padding: 8px 14px;
    font-size: 0.85rem;
    background: #0f172a;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.2s;
}
.gateway-option.selected {
    background: #6366f1;
    border: 2px solid #facc15;
}

/* ======================== جداول (اسکرول افقی) ======================== */
table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}
th, td {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* ======================== دکمه‌های عمومی ======================== */
button {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 40px;
}
button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}
button.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ورودی‌ها */
input, select, textarea {
    background: #334155;
    border: 1px solid #475569;
    padding: 10px 14px;
    border-radius: 28px;
    color: white;
    width: 100%;
    margin-bottom: 10px;
}
input:focus, select:focus, textarea:focus {
    border-color: #a855f7;
    outline: none;
    background: #3b4252;
}

/* بستن مودال */
.close {
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #94a3b8;
}
.close:hover {
    color: #ef4444;
}

/* ======================== موبایل (ریسپانسیو) ======================== */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }
    .container {
        padding: 16px;
        border-radius: 24px;
    }
    h1 {
        font-size: 1.5rem;
    }
    .products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .product-card .buy-btn,
    .product-card .reviews-btn {
        padding: 12px;  /* افزایش ناحیه کلیک در موبایل */
        font-size: 1rem;
    }
    .gateway-option {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ======================== تبلت ======================== */
@media (min-width: 641px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}