/* Hide original header for new layout */
body:has(.main-layout) .header {
    display: none;
}

/* New integrated header */
.integrated-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.header-logo-icon {
    width: 45px;
    height: 45px;
    background: #28a8b8;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
}

.header-logo-text h1 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #333;
    margin: 0;
}

.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid #f0f0f0;
    border-radius: 25px;
    background: #fafafa;
    font-size: 0.9rem;
    direction: rtl;
}

.header-search .search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.header-cart {
    position: relative;
    width: 50px;
    height: 50px;
    background: #28a8b8;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.header-cart:hover {
    background: #1e7e88;
    transform: translateY(-2px);
}

.cart-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Modern RTL E-commerce Layout */
.main-layout {
    display: flex;
    min-height: calc(100vh - 80px);
    background: #f8f9fa;
    direction: rtl;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: white;
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 80px;
    height: fit-content;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
}

.category-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
    width: 100%;
}

.category-btn:hover {
    background: #28a8b8;
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
}

.category-btn.active {
    background: #28a8b8;
    color: white;
    border-color: #2c3e50;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4);
}

.category-btn i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border: none;
    border-radius: 10px;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-text {
    font-size: 0.9rem;
}

/* Products Container */
.products-container {
    background: white;
    border: 2px solid #3498db;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* Product Cards */
.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.product-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.wishlist-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
}

.product-card:hover .wishlist-btn {
    opacity: 1;
    transform: scale(1);
}

.wishlist-btn:hover {
    background: #ff4757;
    color: white;
    transform: scale(1.1);
}

.wishlist-btn.active {
    background: #ff4757;
    color: white;
}

/* Product Info */
.product-info {
    padding: 1rem;
}

.product-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #28a8b8;
    margin-bottom: 0.75rem;
}

/* Product Actions */
.product-actions {
    padding: 0 1rem 1rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.6rem;
    background: #28a8b8;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.add-to-cart-btn:hover {
    background: #1e7e88;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        padding: 1rem;
        border-left: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .category-buttons {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .category-btn {
        min-width: fit-content;
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .category-tabs {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .tab-icon {
        font-size: 1rem;
    }
    
    .products-container {
        padding: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .product-price {
        font-size: 1.1rem;
    }
    
    .product-actions {
        padding: 0 1rem 1rem;
    }
    
    .add-to-cart-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .category-btn span {
        display: none;
    }
    
    .category-btn {
        min-width: 50px;
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.6s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }

/* Filter Animation */
.product-card.hidden {
    display: none;
}

.product-card.show {
    display: block;
    animation: fadeInUp 0.4s ease forwards;
}

/* Product View Styles */
.product-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding: 0;
}

.product-image-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-product-image {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.main-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-view .product-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
    margin: 0;
}

.product-description p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.highlights {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.highlight {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.product-view .product-price {
    font-size: 2rem;
    font-weight: 800;
    color: #28a8b8;
    margin: 1rem 0;
}

.color-selection h3,
.quantity-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.color-options {
    display: flex;
    gap: 0.75rem;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-btn:hover,
.color-btn.active {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    transition: all 0.3s ease;
}

.qty-btn:hover {
    background: #28a8b8;
    color: white;
}

#quantity {
    width: 80px;
    height: 40px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.add-to-cart-main {
    width: 100%;
    padding: 1rem;
    background: #28a8b8;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.add-to-cart-main:hover {
    background: #28a8b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.payment-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.payment-method {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #666;
    font-size: 0.9rem;
}

.payment-method i {
    color: #28a8b8;
    font-size: 1rem;
}

.copy-link-btn {
    width: 100%;
    padding: 0.75rem;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.copy-link-btn:hover {
    background: #138496;
    transform: translateY(-1px);
}

.policy-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.policy-btn {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.policy-btn:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f8f9fa;
}

.policy-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .product-view {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .main-product-image {
        height: 300px;
    }
    
    .product-view .product-title {
        font-size: 1.4rem;
    }
    
    .product-view .product-price {
        font-size: 1.6rem;
    }
}