/* ============================================
   استایل فروشگاه قطعات الکترونیکی
   ============================================ */

/* ===== تنظیمات کلی ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Verdana', 'Tahoma', sans-serif;
    background: #f0f4f8;
    color: #333;
    min-height: 100vh;
    display:flexbox;
    flex-direction: column;
}

a {
    text-decoration: none;
}
/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: rgb(223, 217, 217);
    padding: 15px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 10px;
    direction: rtl;
}

/* ===== لوگو ===== */
.logo h1 {
    font-size: 24px;
    color: #f0c040;
    margin: 0;
    white-space: nowrap;
}
.logo h1 a {
    color: #f0c040;
}

/* ===== منو ===== */
.nav-menu {
    display: flex;
    gap: 25px;              /* ← افزایش فاصله بین آیتم‌ها */
    align-items: center;
    flex-wrap: wrap;
    direction: rtl;
    flex: 1;                /* ← منو فضای باقیمانده را پر کند */
    justify-content: flex-start; /* ← آیتم‌ها از راست شروع شوند */
}


.nav-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 16px;      /* ← افزایش padding برای بزرگتر شدن */
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;        /* ← افزایش اندازه فونت */
    white-space: nowrap;    /* ← جلوگیری از شکستن متن */
}

.nav-menu a:hover {
    background: rgba(240, 192, 64, 0.2);
    color: #f0c040;
    transform: translateY(-2px);
}

.nav-menu a.active {
    background: rgba(240, 192, 64, 0.15);
    color: #f0c040;
}

/* ===== بخش سمت راست منو (ورود/ثبت‌نام) ===== */
.nav-menu .auth-section {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-right: auto;     /* ← این بخش را به سمت چپ می‌برد */
}

/* ===== برچسب کاربر ===== */
.user-badge {
    background: #f0c040;
    color: #1a1a2e;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
}

/* ===== سبد خرید ===== */
.cart-link {
    position: relative;
    display: inline-block;
    padding: 8px 16px;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -4px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}
/* ===== Main ===== */
.main-content {
    flex: 1;
    max-width: 100%;
    margin: 0;
    padding: 30px 20px;
    width: 100%;
}

/* ===== Messages ===== */
.success-msg {
    background: #d4edda;
    color: #155724;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-right: 4px solid #27ae60;
}
.error-msg {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-right: 4px solid #e74c3c;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-block;
    background: #f0c040;
    color: #1a1a2e;
    padding: 10px 30px;
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.3s;
}
.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(240, 192, 64, 0.4);
}

/* ============================================ */
/* بخش اسلایدر (Hero Slider) */
/* ============================================ */

.hero-slider {
    margin-bottom: 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    width: 100%;
}

.slider-container {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    width: 100%;
}

.slider-track {
    position: relative;
    width: 100%;
}

.slider-slide {
    display: none;
    padding: 50px 60px;
    animation: fadeIn 0.8s ease;
}

.slider-slide.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0.4; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.slide-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.slide-text h2 {
    font-size: 32px;
    margin-bottom: 12px;
    color: #f0c040;
}

.slide-text p {
    font-size: 18px;
    opacity: 0.85;
    margin-bottom: 20px;
}

.slide-btn {
    display: inline-block;
    background: #f0c040;
    color: #1a1a2e;
    padding: 12px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.slide-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(240, 192, 64, 0.4);
}

.slide-image {
    font-size: 80px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-dots {
    text-align: center;
    padding: 15px 0;
    background: rgba(0,0,0,0.3);
}

.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin: 0 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background: #f0c040;
    transform: scale(1.2);
}

/* ============================================ */
/* بخش دسته‌بندی محصولات */
/* ============================================ */

.categories-section {
    margin-bottom: 40px;
    width: 100%;
}

.categories-section h2 {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 20px;
    border-right: 5px solid #f0c040;
    padding-right: 15px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    width: 100%;
}

.category-card {
    background: white;
    padding: 20px 15px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 3px 15px rgba(0,0,0,0.06);
    transition: all 0.3s;
    border: 1px solid #e8ecf8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border-color: #f0c040;
}

.category-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.category-card h4 {
    font-size: 14px;
    margin-bottom: 4px;
    color: #1a1a2e;
    font-weight: bold;
}

.category-card p {
    font-size: 12px;
    color: #888;
    margin: 0;
}

/* ============================================ */
/* بخش جدیدترین محصولات */
/* ============================================ */

.new-section {
    margin-bottom: 40px;
    width: 100%;
}

.new-section h2 {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 20px;
    border-right: 5px solid #f0c040;
    padding-right: 15px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.product-card {
    background: white;
    border-radius: 15px;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 3px 15px rgba(0,0,0,0.06);
    transition: all 0.3s;
    border: 1px solid #e8ecf8;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.product-card img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    background: #f8f9ff;
    border-radius: 10px;
    margin-bottom: 10px;
}

.product-card h4 {
    font-size: 14px;
    margin-bottom: 4px;
    color: #1a1a2e;
}

.product-card .category {
    font-size: 12px;
    color: #888;
}

.product-card .price {
    font-size: 16px;
    font-weight: bold;
    color: #764ba2;
    margin: 6px 0 10px;
}

.product-card .stock {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.product-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-detail {
    background: #667eea;
    color: white;
    padding: 6px 15px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-detail:hover {
    background: #764ba2;
}

.btn-add-cart {
    background: #f0c040;
    color: #1a1a2e;
    padding: 6px 12px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-add-cart:hover {
    background: #e0b030;
}

/* ===== نشان جدید ===== */
.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f0c040;
    color: #1a1a2e;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 10px;
    font-weight: bold;
}

.product-badge.new {
    background: #27ae60;
    color: white;
}

/* ============================================ */
/* بخش درباره ما */
/* ============================================ */

.about-section {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 40px;
    color: white;
    width: 100%;
}

.about-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.about-text h2 {
    font-size: 28px;
    color: #f0c040;
    margin-bottom: 15px;
}

.about-text p {
    opacity: 0.85;
    line-height: 1.8;
    margin-bottom: 12px;
}

.about-stats {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.about-stats .stat {
    text-align: center;
}

.about-stats .stat span {
    font-size: 28px;
    font-weight: bold;
    color: #f0c040;
    display: block;
}

.about-stats .stat p {
    font-size: 14px;
    opacity: 0.7;
    margin: 0;
}

.about-image {
    font-size: 80px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================ */
/* بخش برندهای همکار */
/* ============================================ */

.brands-section {
    margin-bottom: 30px;
    width: 100%;
}

.brands-section h2 {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 20px;
    border-right: 5px solid #f0c040;
    padding-right: 15px;
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
}

.brand-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    color: #555;
    border: 1px solid #e8ecf8;
    transition: all 0.3s;
}

.brand-item:hover {
    border-color: #f0c040;
    transform: scale(1.05);
}

/* ============================================ */
/* بخش فوتر (Footer) */
/* ============================================ */

.footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.7);
    padding: 40px 20px 15px;
    margin-top: auto;
    width: 100%;
}

.footer-container {
    max-width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-section h3,
.footer-section h4 {
    color: white;
    margin-bottom: 12px;
}

.footer-section a {
    display: block;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #f0c040;
}

.footer-bottom {
    max-width: 100%;
    margin: 25px auto 0;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 13px;
}

/* ============================================ */
/* صفحه جزئیات محصول (product_detail.php) */
/* ============================================ */

.product-detail {
    padding: 30px 20px;
    max-width: 100%;
    margin: 0 auto;
}

.detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

.detail-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9ff;
    border-radius: 15px;
    padding: 20px;
}

.detail-image img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-info h2 {
    font-size: 28px;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.detail-category {
    color: #888;
    font-size: 14px;
}

.detail-price {
    font-size: 24px;
    font-weight: bold;
    color: #764ba2;
}

.detail-stock {
    color: #555;
    font-size: 16px;
}

.detail-rating {
    color: #f39c12;
    font-size: 16px;
}

.detail-description {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
}

.detail-description h4 {
    color: #1a1a2e;
    margin-bottom: 8px;
}

.detail-description p {
    color: #555;
    line-height: 1.8;
}

.add-to-cart {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.quantity-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-group label {
    font-weight: bold;
    color: #333;
}

.quantity-group input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
}

.btn-add-to-cart {
    background: linear-gradient(135deg, #f0c040, #e0b030);
    color: #1a1a2e;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-to-cart:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(240, 192, 64, 0.4);
}

.out-of-stock {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
}

.login-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
}

.login-message a {
    color: #155724;
    font-weight: bold;
}

.btn-back {
    display: inline-block;
    margin-top: 10px;
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-back:hover {
    color: #764ba2;
    transform: translateX(-5px);
}

/* ============================================ */
/* واکنش‌گرا (Responsive) */
/* ============================================ */

@media (max-width: 992px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 15px;
        padding: 10px 15px;
    }
    .nav-menu {
        justify-content: center;
        gap: 8px;
    }
    .nav-menu a {
        font-size: 12px;
        padding: 4px 10px;
    }

    .slide-content {
        flex-direction: column;
        text-align: center;
    }
    .slide-text h2 {
        font-size: 24px;
    }
    .slider-slide {
        padding: 30px 20px;
    }
    .slide-image {
        width: 100px;
        height: 100px;
        font-size: 50px;
        margin-top: 15px;
    }

    .about-container {
        flex-direction: column;
        text-align: center;
    }
    .about-stats {
        justify-content: center;
    }
    .about-image {
        width: 120px;
        height: 120px;
        font-size: 60px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .brands-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* جزئیات محصول */
    .detail-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    .detail-image img {
        max-height: 250px;
    }
    .detail-info h2 {
        font-size: 22px;
    }
    .add-to-cart {
        flex-direction: column;
        align-items: stretch;
    }
    .quantity-group {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .brands-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}
/* ============================================ */
/* دکمه بیشتر بدانید - درباره ما */
/* ============================================ */

.btn-about {
    display: inline-block;
    background: #f0c040;
    color: #1a1a2e;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-about:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(240, 192, 64, 0.4);
}