@import url('colorpalette.css');

/* Container Styling */
.branch-products-container {
    background-color: var(--bg-light);
    min-height: 100vh;
    padding: 1rem;
}

@media (min-width: 768px) {
    .branch-products-container {
        padding: 2rem;
    }
}

/* ==================== بخش فیلترها (مشابه category_products) ==================== */

/* Sidebar Filters */
.category-section {
    background-color: var(--bg-white);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.category-section:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.category-header {
    background: linear-gradient(135deg, var(--primary-red), var(--light-red));
    padding: 1.5rem;
    position: relative;
}

.category-header h3,
.category-header h1 {
    color: white;
    margin: 0;
}

.products-count {
    font-size: 0.875rem;
    opacity: 0.9;
    color: white;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-content {
    padding: 1.5rem;
}

/* Branch Info Box */
.branch-info-box {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.05), rgba(184, 134, 11, 0.05));
    border: 1px solid rgba(139, 0, 0, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.branch-info-box:hover {
    border-color: var(--primary-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.1);
}

.branch-info-box h4 {
    color: var(--primary-red);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.branch-info-box p {
    color: var(--text-dark);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.branch-info-box i {
    color: var(--primary-red);
    font-size: 0.875rem;
    min-width: 16px;
}

/* Form Elements Styling - مشابه category_products */
label.block {
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label.block i {
    color: var(--primary-red);
}

select.w-full,
input.w-1\\/2 {
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: var(--bg-white);
    color: var(--text-dark);
}

select.w-full:focus,
input.w-1\\/2:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Filter Buttons - مشابه category_products */
.product-action {
    background: linear-gradient(135deg, var(--primary-red), var(--light-red));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.product-action:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--light-red), var(--primary-red));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.2);
}

.product-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* حذف فیلتر دکمه */
a.px-4.border {
    background-color: var(--bg-white);
    border: 1px solid var(--border-medium);
    color: var(--text-dark);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

a.px-4.border:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-red);
    color: var(--primary-red);
    transform: translateY(-2px);
}

/* ==================== بخش محصولات (متفاوت از category_products) ==================== */

/* Products Grid */
.grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-3 {
    gap: 1.5rem;
    animation: slideInUp 0.6s ease-out;
}

/* Product Card - متفاوت از category_products */
.branch-product-card {
    background-color: var(--bg-white);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.4s ease-out;
}

.branch-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(139, 0, 0, 0.15);
    border-color: var(--primary-red);
}

.branch-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary-red), var(--golden-yellow));
    z-index: 2;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.branch-product-card:hover::before {
    opacity: 1;
    height: 4px;
}

/* Product Image Container */
.branch-product-image-container {
    height: 200px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}

@media (max-width: 767px) {
    .branch-product-image-container {
        height: 180px;
    }
}

@media (min-width: 1280px) {
    .branch-product-image-container {
        height: 220px;
    }
}

.branch-product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 1rem;
    box-sizing: border-box;
    transition: transform 0.4s ease;
}

.branch-product-card:hover .branch-product-image {
    transform: scale(1.08);
}

/* No Image Placeholder */
.branch-no-image {
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.branch-no-image i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.branch-no-image span {
    font-size: 0.875rem;
}

/* Category Badge */
.branch-category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary-red), var(--light-red));
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 3;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* برای نمایش gradient به صورت راست به چپ */
.bg-gradient-to-r {
    background: linear-gradient(to right, var(--primary-red), var(--light-red));
}

/* Out of Stock Overlay */
.branch-out-of-stock {
    position: absolute;
    inset: 0;
    background: rgba(139, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.branch-out-of-stock-text {
    background: linear-gradient(135deg, var(--primary-red), #ff3333);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
    animation: pulse 2s infinite;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* Product Info */
.branch-product-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.branch-product-name {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8rem;
    flex-shrink: 0;
}

.branch-product-price {
    color: var(--primary-red);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* دکمه آفیش در محصول */
.branch-product-info .product-action {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
}

/* Empty State - مشابه category_products */
.col-span-full {
    grid-column: 1 / -1;
}

.no-products {
    padding: 3rem 0;
}

.no-products-content {
    max-width: 500px;
    margin: 0 auto;
    padding: 2.5rem;
    text-align: center;
}

.no-products-icon {
    color: var(--border-medium);
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.no-products-title {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.no-products-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.reset-products-filter {
    background-color: var(--bg-white);
    border: 1px solid var(--border-medium);
    color: var(--text-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.reset-products-filter:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

/* Pagination - مشابه category_products */
.flex.justify-center.mt-8 {
    margin-top: 3rem;
}

nav.flex.items-center {
    gap: 0.5rem;
}

nav.flex.items-center a,
nav.flex.items-center span {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

nav.flex.items-center a {
    background-color: var(--bg-white);
    border: 1px solid var(--border-medium);
    color: var(--text-dark);
    text-decoration: none;
}

nav.flex.items-center a:hover {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: var(--white);
    transform: translateY(-2px);
}

nav.flex.items-center span {
    background: linear-gradient(135deg, var(--primary-red), var(--light-red));
    color: var(--white);
    border: 1px solid var(--primary-red);
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Responsive Design ==================== */

@media (max-width: 767px) {
    .flex.flex-col.lg\\:flex-row {
        flex-direction: column;
    }
    
    .lg\\:w-1\\/4,
    .lg\\:w-3\\/4 {
        width: 100%;
    }
    
    .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-3 {
        gap: 1rem;
    }
    
    .branch-category-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        max-width: 70%;
    }
    
    .branch-product-info {
        padding: 1rem;
    }
    
    .branch-product-name {
        font-size: 1rem;
        height: 2.4rem;
    }
    
    .branch-product-price {
        font-size: 1.1rem;
    }
    
    .no-products {
        padding: 2rem 0;
    }
    
    .no-products-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .branch-products-container {
        padding: 0.75rem;
    }
    
    .branch-product-image-container {
        height: 160px;
    }
    
    .branch-category-badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
        max-width: 65%;
    }
    
    .flex.space-x-2.space-x-reverse {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .product-action,
    a.px-4.border {
        padding: 0.625rem 1rem;
    }
    
    .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

/* Tablet Portrait Mode */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .grid.grid-cols-1.md\\:grid-cols-2.xl\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .branch-category-badge {
        max-width: 75%;
    }
}

/* تنظیم ارتفاع کارت محصولات برای یکنواختی */
.branch-product-card {
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 767px) {
    .branch-product-card {
        min-height: 380px;
    }
}

@media (min-width: 1280px) {
    .branch-product-card {
        min-height: 450px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .branch-products-container {
        background-color: var(--bg-dark-primary);
    }
    
    .category-section,
    .branch-product-card,
    .no-products-content {
        background-color: var(--bg-dark-secondary);
        border-color: var(--border-dark);
    }
    
    .branch-product-name,
    .no-products-title {
        color: var(--text-dark-light);
    }
    
    .branch-product-price,
    .no-products-description,
    .branch-info-box p {
        color: var(--text-dark-light-secondary);
    }
    
    select.w-full,
    input.w-1\\/2 {
        background-color: var(--bg-dark-secondary);
        border-color: var(--border-dark);
        color: var(--text-dark-light);
    }
    
    .branch-info-box {
        background: linear-gradient(135deg, rgba(139, 0, 0, 0.1), rgba(184, 134, 11, 0.1));
        border-color: var(--border-dark);
    }
    
    a.px-4.border,
    .reset-products-filter {
        background-color: var(--bg-dark-secondary);
        border-color: var(--border-dark);
        color: var(--text-dark-light);
    }
    
    a.px-4.border:hover,
    .reset-products-filter:hover {
        background-color: var(--bg-dark-primary);
        color: var(--primary-red);
    }
    
    .branch-product-image-container {
        background: linear-gradient(135deg, var(--bg-dark-primary), var(--bg-dark-secondary));
    }
}