/* استایل کلی */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', sans-serif;
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    font-display: swap;
}

/* Optimized font loading */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Regular.woff2') format('woff2'),
        url('../fonts/Vazir-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* هدر */
header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.logo i {
    margin-left: 10px;
    font-size: 28px;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-right: 20px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 4px;
}

nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    margin-left: 20px;
}

.search-box input {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    width: 200px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box button {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.cart-icon {
    position: relative;
    margin-right: 15px;
    font-size: 20px;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* بخش هیرو */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 0;
    text-align: center;
}

.hero h1 {
    font-size: 42px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 18px;
    max-width: 700px;
    margin: 0 auto 30px;
}

.btn {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* بخش دسته‌بندی‌ها */
.categories {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title h2 {
    font-size: 32px;
    color: #2c3e50;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 3px;
    background-color: #3498db;
    bottom: -10px;
    right: 50%;
    transform: translateX(50%);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.category-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    padding: 30px 20px;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.category-icon {
    font-size: 50px;
    color: #3498db;
    margin-bottom: 20px;
}

.category-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.category-card p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

/* بخش محصولات ویژه */
.featured-products {
    padding: 80px 0;
    background-color: #f1f2f6;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 200px;
    background-color: #ecf0f1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.product-image img {
    max-width: 80%;
    max-height: 80%;
    transition: transform 0.5s ease;
    loading: lazy;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

/* Optimized image loading */
.product-image img,
.search-result-image img {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 15px;
}

.product-rating {
    color: #f39c12;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    justify-content: space-between;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #3498db;
    color: #3498db;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: #3498db;
    color: white;
}

/* بخش ویژگی‌ها */
.features {
    padding: 80px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.feature-item {
    text-align: center;
    padding: 30px 20px;
}

.feature-icon {
    font-size: 50px;
    color: #3498db;
    margin-bottom: 20px;
}

.feature-item h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.feature-item p {
    color: #7f8c8d;
}

/* فوتر */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-column h3 {
    font-size: 20px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-column h3::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 2px;
    background-color: #3498db;
    bottom: 0;
    right: 0;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column ul li a:hover {
    color: #3498db;
}

.footer-column p {
    color: #bdc3c7;
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: #3498db;
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
    font-size: 14px;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 32px;
    }

    .search-box input {
        width: 150px;
    }

    /* Optimized mobile performance */
    .product-card,
    .category-card {
        will-change: transform;
    }

    /* Reduce motion for mobile */
    .product-card:hover .product-image img {
        transform: none;
    }
}

/* Performance optimizations */
* {
    /* Optimize rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce paint on scroll */
html {
    scroll-behavior: smooth;
}

/* Optimize animations */
.product-card,
.category-card,
.btn {
    will-change: transform;
    transform: translateZ(0);
    /* Force hardware acceleration */
}

/* افکت‌های اضافی */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Search Results */
.search-box {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.search-results-header {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    font-size: 14px;
    color: #666;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-image {
    width: 50px;
    height: 50px;
    margin-left: 12px;
    flex-shrink: 0;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.search-result-info h6 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.search-result-info .price {
    font-size: 13px;
    color: #e74c3c;
    font-weight: 500;
}

/* Image Slider */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s;
    z-index: 2;
}

.slider-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-prev {
    right: 10px;
}

.slider-next {
    left: 10px;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}

.slider-dot.active {
    background: white;
}

.slider-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Image Zoom Modal */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-zoom-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-zoom-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.1s ease;
}

.image-zoom-img:active {
    cursor: grabbing;
}

.image-zoom-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Product Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.product-modal-container {
    position: relative;
    background: white;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.product-modal-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.product-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Form Validation */
.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.field-error {
    margin-top: 5px;
}

/* Lazy Loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy.loaded {
    opacity: 1;
}

/* Enhanced Animations */
@keyframes bounce {

    0%,
    20%,
    53%,
    80%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    40%,
    43% {
        transform: translate3d(0, -30px, 0);
    }

    70% {
        transform: translate3d(0, -15px, 0);
    }

    90% {
        transform: translate3d(0, -4px, 0);
    }
}

.bounce {
    animation: bounce 1s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.5s;
}

/* Loading States */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .search-results {
        right: -10px;
        left: -10px;
        max-height: 300px;
    }

    .image-zoom-container {
        max-width: 95%;
        max-height: 95%;
    }

    .product-modal-container {
        max-width: 95%;
        max-height: 95%;
    }

    .product-modal-content {
        padding: 15px;
    }

    .slider-arrow {
        width: 25px;
        height: 25px;
        font-size: 14px;
    }

    .slider-prev {
        right: 5px;
    }

    .slider-next {
        left: 5px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {

    .fade-in,
    .pulse,
    .bounce,
    .shake {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus States */
.slider-arrow:focus,
.slider-dot:focus,
.image-zoom-close:focus,
.product-modal-close:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .search-results,
    .image-zoom-modal,
    .product-modal,
    .slider-arrow,
    .slider-dots {
        display: none !important;
    }
}

/* Critical CSS for above-the-fold content */
.critical-css {
    /* Ensure critical styles are loaded first */
    font-family: 'Vazir', sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* Non-critical CSS - loaded asynchronously */
.non-critical-css {
    /* Animations and effects that can load later */
    animation: none;
}

/* Optimize for Core Web Vitals */
.product-card {
    contain: layout style paint;
}

.category-card {
    contain: layout style paint;
}

/* Reduce layout shifts */
.product-image img {
    aspect-ratio: 1;
    object-fit: cover;
}

/* Optimize for cumulative layout shift */
.product-info {
    min-height: 120px;
}

/* Final performance optimizations */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Report form styles */
.report-form {
    display: flex;
    justify-content: center;
    align-items: center;
}

.submit-btn {
    font-size: 14px;
    padding: 8px 16px;
}