/* Products Page Styles */
.products-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    direction: rtl;
}

.products-header {
    text-align: center;
    margin-bottom: 28px;
    background: #2f4550;
    color: #f5f3ee;
    padding: 44px 40px 34px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(47, 69, 80, 0.22);
}

.products-header h1 {
    font-size: 2.65rem;
    margin-bottom: 10px;
    color: #f5f3ee;
    text-shadow: none;
}

.products-header p {
    font-size: 1.15rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.add-product-btn {
    background: #c99971;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(201, 153, 113, 0.28);
}

.add-product-btn:hover {
    transform: translateY(-2px);
    background: #bd8b63;
    box-shadow: 0 6px 20px rgba(201, 153, 113, 0.36);
}

.filters-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.advanced-filters {
    width: 100%;
    max-width: 900px;
}

.price-filter-card {
    background: #fff;
    border: 1px solid #d3cbc6;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.price-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.price-filter-title {
    font-weight: 700;
    color: #2f4550;
}

.price-filter-values {
    font-weight: 700;
    color: #2f4550;
    background: #f5f3ee;
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.price-filter-sliders {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.price-filter-sliders input[type="range"] {
    width: 100%;
    accent-color: #c99971;
}

.price-filter-hints {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 0.9rem;
    margin-top: 6px;
}

.free-shipping-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: #2f4550;
    white-space: nowrap;
}

.free-shipping-toggle input {
    width: 18px;
    height: 18px;
}

.search-bar {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 22px auto 0;
}

.search-bar input {
    width: 100%;
    padding: 13px 50px 13px 20px;
    border: 1px solid #d3cbc6;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: #f5f3ee;
    color: #2f4550;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.search-bar input:focus {
    border-color: #c99971;
    box-shadow: 0 4px 18px rgba(201, 153, 113, 0.22);
}

.search-bar i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #2f4550;
    font-size: 1.2rem;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid #d3cbc6;
    background: #fffdf9;
    color: #2f4550;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.filter-btn:hover {
    background: #f5f3ee;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 69, 80, 0.12);
}

.filter-btn.active {
    background: #2f4550;
    border-color: #2f4550;
    color: white;
    box-shadow: 0 4px 14px rgba(47, 69, 80, 0.22);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}

.product-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 175px;
    height: 190px;
    max-height: 210px;
}

.images-count {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.product-admin-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.edit-btn {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
}

.edit-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.product-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 210px;
    object-fit: contain;
    transition: transform 0.3s ease;
    transform: scale(1);
    transform-origin: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    display: block;
    padding: 10px;
    box-sizing: border-box;
}

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

.product-info {
    padding: 14px;
}

.product-name {
    font-size: 1.05rem;
    font-weight: bold;
    color: #2f4550;
    margin-bottom: 8px;
    text-align: right;
}

.product-description {
    color: #666;
    line-height: 1.45;
    margin-bottom: 12px;
    text-align: right;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating-stars {
    color: #ffc107;
    font-size: 1.1rem;
}

.rating-number {
    color: #666;
    font-weight: 600;
}

.product-price {
    color: #2f4550;
    padding: 0;
    font-weight: bold;
    font-size: 1.18rem;
}

.product-categories {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-category {
    background: #d3cbc6;
    color: #2f4550;
    padding: 4px 9px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.sub-category {
    background: #f5f3ee;
    color: #2f4550;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.product-shipping {
    margin-top: 10px;
}

.shipping-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.85rem;
}

.shipping-badge.free {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.shipping-badge.conditional {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

.shipping-badge.paid {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.view-btn {
    flex: 1;
    background: #2f4550;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-btn:hover {
    transform: translateY(-2px);
    background: #263942;
    box-shadow: 0 6px 18px rgba(47, 69, 80, 0.28);
    color: white;
    text-decoration: none;
}

.aliexpress-btn {
    flex: 1;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.aliexpress-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
    color: white;
    text-decoration: none;
}

.delete-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    direction: rtl;
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #dc3545;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

/* תיקון לבעיות עם תמונות שלא נטענו */
.product-image[src=""], .product-image:not([src]) {
    background-image: url('/static/images/placeholder-product.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Responsive Design */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .products-header {
        padding: 34px 20px 28px;
    }

    .products-header h1 {
        font-size: 2.15rem;
    }

    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }

    .advanced-filters {
        width: 100%;
    }

    .free-shipping-toggle {
        width: 100%;
        white-space: normal;
    }

    .product-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }

    .product-image-container {
        min-height: 140px;
        height: 150px;
        max-height: 170px;
    }

    .product-image {
        max-height: 170px;
        padding: 8px;
    }

    .product-info {
        padding: 12px;
    }

    .product-name {
        font-size: 0.98rem;
    }

    .product-description {
        display: none;
    }
}
