/**
 * استایل حرفه‌ای فروشگاه storefront
 * استفاده از فونت‌های داخلی پروژه
 */

/* ============================================================
   فونت‌ها (داخل پروژه storefront)
   ============================================================ */

@font-face {
    font-family: 'BNazanin';
    src: url('../fonts/BNazanin.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'BNazanin-Bold';
    src: url('../fonts/BNazanin-Bold.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'BTitr';
    src: url('../fonts/BTitr.ttf') format('truetype');
    font-display: swap;
}

/* ============================================================
   تنظیمات پایه
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --secondary: #FF6584;
    --gradient-main: linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 5px 25px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 15px 50px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 25px 80px rgba(0, 0, 0, 0.25);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: 'BNazanin', 'Tahoma', 'Arial', sans-serif;
    background: #f0f2f8;
    color: #2d3436;
    direction: rtl;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================================
   اسکرول بار حرفه‌ای
   ============================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6C63FF, #FF6584);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5A52D5, #e55472);
}

/* ============================================================
   لودینگ اسپلش
   ============================================================ */

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#splash-screen.hide {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

.splash-logo {
    font-family: 'BTitr', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 3rem;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

.splash-loader {
    width: 60px;
    height: 60px;
    margin-top: 30px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============================================================
   هدر فروشگاه
   ============================================================ */

.store-header {
    background: var(--gradient-main);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 0 0 40px 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(108, 99, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.store-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 10s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, -10%); }
}

.store-header h1 {
    font-family: 'BTitr', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 2.5rem;
    position: relative;
    z-index: 1;
    animation: fadeInDown 0.8s ease;
}

.store-header .shop-info {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.store-header .shop-info span {
    display: inline-block;
    margin: 0 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* ============================================================
   انیمیشن‌ها
   ============================================================ */

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   انتخاب شهر
   ============================================================ */

.city-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 35px;
    padding: 0 20px;
    animation: fadeInDown 0.8s ease 0.3s both;
}

.city-btn {
    padding: 14px 35px;
    border-radius: 50px;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'BNazanin-Bold', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.city-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-main);
    opacity: 0;
    transition: var(--transition);
    border-radius: 50px;
}

.city-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.city-btn:hover::before {
    opacity: 0.05;
}

.city-btn.active {
    background: var(--gradient-main);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.4);
    transform: translateY(-3px);
}

.city-btn .city-icon {
    margin-left: 8px;
}

/* ============================================================
   محصولات
   ============================================================ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 0 20px 40px;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeInScale 0.8s ease both;
}

.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; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.product-card .product-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 220px;
    background: #f8f9fa;
}

.product-card .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.product-card .product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--gradient-main);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    font-family: 'BNazanin-Bold', 'BNazanin', 'Tahoma', sans-serif;
    box-shadow: 0 5px 15px rgba(108, 99, 255, 0.3);
}

.product-card .product-badge.stock-warning {
    background: linear-gradient(135deg, #FF6584, #ff4757);
}

.product-card .product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-card .quick-view-btn {
    padding: 12px 30px;
    background: white;
    border: none;
    border-radius: 50px;
    font-family: 'BNazanin-Bold', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1rem;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    transform: translateY(20px);
    box-shadow: var(--shadow-md);
}

.product-card:hover .quick-view-btn {
    transform: translateY(0);
}

.product-card .quick-view-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.product-card .product-info {
    padding: 20px;
}

.product-card .product-name {
    font-family: 'BTitr', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: #2d3436;
}

.product-card .product-code {
    font-size: 0.8rem;
    color: #b2bec3;
    margin-bottom: 8px;
}

.product-card .product-desc {
    font-size: 0.85rem;
    color: #636e72;
    margin-bottom: 12px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.product-card .product-price {
    font-family: 'BTitr', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1.3rem;
    color: var(--primary);
}

.product-card .product-stock {
    font-size: 0.8rem;
    color: #00b894;
    background: #e8f8f5;
    padding: 3px 12px;
    border-radius: 20px;
}

.product-card .product-stock.low {
    color: #e17055;
    background: #fdf0ed;
}

.product-card .add-to-cart-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-main);
    color: white;
    font-family: 'BNazanin-Bold', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.product-card .add-to-cart-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.product-card .add-to-cart-btn:active::after {
    width: 300px;
    height: 300px;
}

.product-card .add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.4);
}

.product-card .add-to-cart-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   سبد خرید شناور
   ============================================================ */

.floating-cart {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--gradient-main);
    color: white;
    padding: 18px 25px;
    border-radius: 60px;
    box-shadow: 0 10px 40px rgba(108, 99, 255, 0.4);
    cursor: pointer;
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'BNazanin-Bold', 'BNazanin', 'Tahoma', sans-serif;
    animation: bounceIn 0.8s ease 1s both;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.1); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.floating-cart:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 50px rgba(108, 99, 255, 0.5);
}

.floating-cart .cart-badge {
    background: #FF6584;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.floating-cart .cart-icon {
    font-size: 1.5rem;
}

.floating-cart .cart-total {
    font-size: 1rem;
}

/* ============================================================
   پیام موفقیت (Toast)
   ============================================================ */

.toast-success {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #00b894;
    color: white;
    padding: 15px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-family: 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1rem;
    animation: slideDown 0.5s ease, fadeOut 0.5s ease 3s forwards;
}

.toast-error {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #e17055;
    color: white;
    padding: 15px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-family: 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1rem;
    animation: slideDown 0.5s ease, fadeOut 0.5s ease 3s forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-50px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

/* ============================================================
   حالت خالی (Empty State)
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInScale 0.8s ease;
}

.empty-state .empty-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.empty-state h3 {
    font-family: 'BTitr', 'BNazanin', 'Tahoma', sans-serif;
    font-size: 1.5rem;
    color: #2d3436;
    margin-bottom: 10px;
}

.empty-state p {
    color: #636e72;
    font-size: 1rem;
}

/* ============================================================
   پاسخگو (Responsive)
   ============================================================ */

@media (max-width: 992px) {
    .store-header h1 {
        font-size: 2rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .store-header {
        padding: 30px 15px;
        border-radius: 0 0 30px 30px;
    }
    
    .store-header h1 {
        font-size: 1.6rem;
    }
    
    .store-header .shop-info span {
        display: block;
        margin: 5px 0;
    }
    
    .city-selector {
        gap: 10px;
        padding: 0 10px;
    }
    
    .city-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
        padding: 0 10px 30px;
    }
    
    .product-card .product-image-wrapper {
        height: 160px;
    }
    
    .product-card .product-info {
        padding: 15px;
    }
    
    .product-card .product-name {
        font-size: 1rem;
    }
    
    .product-card .product-price {
        font-size: 1.1rem;
    }
    
    .floating-cart {
        bottom: 20px;
        left: 20px;
        padding: 14px 20px;
        font-size: 0.85rem;
    }
    
    .floating-cart .cart-icon {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .store-header h1 {
        font-size: 1.3rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .product-card .product-image-wrapper {
        height: 130px;
    }
    
    .product-card .product-info {
        padding: 12px;
    }
    
    .product-card .product-name {
        font-size: 0.9rem;
    }
    
    .product-card .product-price {
        font-size: 1rem;
    }
    
    .product-card .add-to-cart-btn {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .city-btn {
        padding: 8px 15px;
        font-size: 0.75rem;
    }
}