/* --- Global Styles & Vazirmatn Font --- */
body { 
    font-family: 'Vazirmatn', sans-serif; /* Use the Vazirmatn font */
    margin: 0; 
    padding: 0; 
    background-color: #f6f7f8;
    direction: rtl; 
    text-align: right;
    color: #333;
}

/* --- Content Wrapper --- */
.content-wrapper {
    max-width: 1300px; /* Adjusted to better match the typical e-commerce width */
    margin: 0 auto;
    padding: 0 15px;
}

/* === HEADER & NAVIGATION (مطابق تصاویر ۴ و ۱) === */
.main-header {
    background-color: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.header-top-bar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee; /* Separator line */
    font-size: 0.85em;
}

.top-nav-links a {
    color: #555;
    text-decoration: none;
    padding: 5px 10px;
    margin-left: 15px;
}

/* Actions (Cart/User) */
.user-actions {
    display: flex;
    align-items: center;
}

.cart-icon-container {
    position: relative;
    font-size: 1.2em; /* Smaller icons for the top bar */
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
}

.cart-badge {
    position: absolute;
    top: -5px;
    left: -5px; /* RTL position adjustment */
    background-color: #007bff; 
    color: white;
    border-radius: 50%;
    padding: 1px 5px;
    font-size: 0.6em;
    font-weight: bold;
    border: 1px solid white;
}

.icon-user {
    font-size: 1.2em;
    padding: 5px;
    cursor: pointer;
}

/* Main Content (Search and Menu) */
.header-main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Search Bar (مطابق تصویر ۴) */
.search-bar-container {
    flex-grow: 1;
    max-width: 700px;
    position: relative;
    background-color: #f0f0f0; 
    border-radius: 6px;
    height: 38px;
    display: flex;
    align-items: center;
    order: 2; /* Move to the middle */
}

.search-input {
    flex-grow: 1;
    border: none;
    background: none;
    padding: 0 10px;
    font-size: 0.9em;
    outline: none;
    color: #555;
}

.search-icon {
    font-size: 1.1em;
    color: #999;
    padding: 0 10px;
}

/* Main Menu (مطابق تصویر ۴) */
.main-menu-nav {
    display: flex;
    align-items: center;
    order: 1; /* Keep menu links to the right */
    white-space: nowrap;
}

.main-menu-nav a {
    color: #007bff; 
    text-decoration: none;
    padding: 8px 12px;
    margin-left: 5px; 
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.main-menu-nav a:hover {
    background-color: #f8f8f8;
    border-radius: 4px;
}

/* === SORT BAR (مطابق تصویر ۱) === */
.sort-bar {
    background-color: white;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
}

.sort-options {
    display: flex;
    align-items: center;
    font-size: 0.85em;
    color: #555;
}

.sort-label {
    margin-left: 15px;
    font-weight: 500;
}

.filter-toggle {
    background: none;
    border: 1px solid #ccc;
    color: #555;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    margin-left: 20px; /* Space between toggle and sort label */
    font-size: 1.1em;
}

.sort-button {
    background: none;
    border: none;
    padding: 4px 10px;
    margin-left: 5px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 400;
    color: #777;
}

.sort-button.active {
    background-color: #e3f2fd; 
    color: #007bff; 
    border: 1px solid #bbdefb;
    font-weight: 500;
}

/* --- Product List Grid (مطابق تصویر ۱) --- */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 15px;
}

.product-card {
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); 
    overflow: hidden; 
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.product-card img {
    width: 100%;
    height: 200px; /* Fixed height for image area */
    object-fit: contain; 
    background-color: #f7f7f7;
    border-bottom: 1px solid #eee;
}

.product-info {
    padding: 10px;
    text-align: center; /* Center product text */
}

.product-info h3 {
    font-size: 0.95em;
    font-weight: 500;
    color: #444;
    margin: 5px 0;
}

.product-info .brand {
    color: #888;
    font-size: 0.85em;
    margin: 0 0 5px 0;
}

.product-price {
    color: #d32f2f; 
    font-weight: 700;
    font-size: 1.1em;
    margin: 10px 0;
}

.add-to-cart {
    width: 90%;
    display: block;
    margin: 10px auto 15px;
    background-color: #4CAF50; /* Green for Add to Cart */
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-weight: 500;
    font-size: 0.9em;
}

.add-to-cart:hover {
    background-color: #45a049;
}

/* === FOOTER STYLES (مطابق تصویر ۳) === */
footer { 
    background-color: white; 
    border-top: 1px solid #eee;
    padding: 25px 0; 
    margin-top: 40px; 
}

.footer-content-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: flex-end; /* Align content to the right */
    align-items: center;
    gap: 80px;
}

.footer-section {
    line-height: 1.8;
}

.footer-section h4 {
    color: #555;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
}

.footer-section p {
    color: #007bff; 
    font-size: 1em;
    font-weight: 700;
}

.footer-section.social {
    text-align: center;
}
.footer-section.social .social-icons {
    display: flex;
    justify-content: center;
    font-size: 1.5em;
    margin-top: 5px;
}

.footer-section.social .social-icons i {
    margin: 0 5px;
    color: #007bff;
}

.footer-section.designer {
    margin-right: auto; /* Pushes designer section to the far left (in RTL) */
    text-align: left;
}
.designer-text {
    font-size: 0.9em !important;
    font-weight: 500 !important;
}
/* === MEDIA QUERIES FOR MOBILE (Max Width 768px) === */
@media (max-width: 768px) {
    /* 1. Header Changes */
    .header-main-content {
        flex-direction: column; /* Stack elements vertically */
        align-items: stretch;
    }
    
    /* Search bar takes full width */
    .search-bar-container {
        max-width: 100%; 
        order: 1; /* Move search bar to the top of this section */
        margin-bottom: 10px;
    }

    /* Menu links should stack or scroll */
    .main-menu-nav {
        flex-wrap: wrap; /* Wrap links if screen is too narrow */
        justify-content: flex-start; 
        order: 2;
    }
    .main-menu-nav a {
        padding: 5px 8px; 
        font-size: 0.8em;
    }

    /* 2. Sort Bar Changes */
    .sort-bar {
        padding: 8px 10px;
    }
    .sort-options {
        flex-wrap: wrap; 
    }
    .sort-label {
        width: 100%; /* Label takes full width */
        margin-bottom: 5px;
        margin-left: 0;
    }
    .filter-toggle {
        display: block; /* Ensure the menu toggle button is visible */
    }

    /* 3. Product List (Changes grid to 1 column on small screens) */
    .product-list {
        grid-template-columns: 1fr; /* Single column layout for mobile */
    }

    /* 4. Footer Changes */
    .footer-content-container {
        flex-direction: column; /* Stack sections vertically */
        align-items: flex-start;
        gap: 30px;
    }
    .footer-section.designer {
        margin-right: 0; 
        text-align: right;
    }
}

/* === MEDIA QUERIES FOR MOBILE (Max Width 768px) === */
@media (max-width: 768px) {
    
    /* Global Mobile Adjustments */
    .content-wrapper {
        padding: 0 10px; /* Reduce padding on edges */
    }

    /* 1. Header and Navigation Adjustments */
    
    .header-top-bar {
        /* Hide top auxiliary links on small screens to save space */
        display: none; 
    }

    .header-main-content {
        flex-direction: column; /* Stack logo, search, and menu vertically */
        align-items: stretch;
        padding: 10px 10px 0;
    }
    
    /* Search bar takes full width */
    .search-bar-container {
        max-width: 100%; 
        order: 1; 
        margin-bottom: 10px;
        height: 35px; /* Slightly smaller height */
    }

    /* User actions (cart/user icons) need to be visible */
    .user-actions {
        order: 2; /* Move below search */
        justify-content: flex-end; /* Align right */
        width: 100%;
        margin-right: 0;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }

    /* Main Menu (Links) */
    .main-menu-nav {
        order: 3;
        flex-wrap: wrap; 
        justify-content: center; /* Center links on mobile */
        padding-bottom: 10px;
        padding-top: 5px;
    }
    .main-menu-nav a {
        padding: 5px 8px; 
        font-size: 0.8em;
    }

    /* 2. Sort Bar Adjustments */
    .sort-bar {
        padding: 8px 10px;
        margin-top: 10px; /* Add some space after header */
    }
    .sort-options {
        flex-wrap: wrap; 
    }
    .sort-label {
        width: 100%; 
        margin-bottom: 5px;
        margin-left: 0;
    }

    .sort-button {
        padding: 4px 8px;
        font-size: 0.8em;
    }
    
    .filter-toggle {
        display: block; /* Ensure the menu toggle button is visible */
        order: -1; /* Move menu toggle to the far right */
        margin-right: 0;
    }

    /* 3. Product List (Changes grid to 1 column on small screens) */
    .product-list {
        grid-template-columns: 1fr; /* Single column layout for mobile */
        gap: 15px;
    }

    /* Product Card */
    .product-card img {
        height: 180px; /* Slightly smaller image area on mobile */
    }

    /* 4. Footer Adjustments */
    .footer-content-container {
        flex-direction: column; 
        align-items: flex-start;
        gap: 20px;
    }
    .footer-section.designer {
        margin-right: 0; 
        text-align: right;
    }
}