/* ==========================================================================
   المسار: /v3/store/assets/css/style.css
   التنسيقات الرئيسية لمتجر المنصة - متوافق كلياً مع الجوال والتابلت
   ========================================================================== */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --header-height: 70px;
    --bottom-nav-height: 65px;
}

/* 1. Reset Base & Typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    direction: rtl;
    line-height: 1.5;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    outline: none;
}

/* 2. Intro Screen (الواجهة الترحيبية) */
#intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#intro-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.intro-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
}

.intro-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 6px;
}

.intro-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin-top: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 3. Main Header */
.main-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.header-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.store-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.store-logo-placeholder {
    width: 42px;
    height: 42px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.store-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.nav-links {
    display: none;
    gap: 20px;
}

.nav-item {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary-color);
}

.cart-trigger-btn {
    position: relative;
    background: var(--primary-light);
    color: var(--primary-color);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.cart-trigger-btn:hover {
    background: #dbeafe;
}

.cart-badge {
    background: var(--danger-color);
    color: #ffffff;
    border-radius: var(--radius-full);
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* 4. Products Layout & Cards */
.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
}

.product-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 80%;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 10px;
    cursor: pointer;
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 4px 0 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
    cursor: pointer;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: auto;
}

.product-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-color);
}

.old-price {
    font-size: 0.8rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.add-to-cart-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-to-cart-btn:hover {
    background: var(--primary-hover);
}

/* 5. Slide Cart Drawer */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9998;
    display: none;
}

.cart-overlay.active {
    display: block;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    left: -420px;
    width: 100%;
    max-width: 380px;
    height: 100%;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    left: 0;
}

.cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title-wrap h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.cart-items-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 700;
}

.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    border: 1px solid var(--border-color);
}

.qty-btn {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    width: 22px;
    height: 22px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--success-color);
    color: #ffffff;
    text-align: center;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.checkout-btn:hover {
    opacity: 0.9;
}

/* 6. Footer & Bottom Nav */
.main-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 30px 16px 20px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
}

.footer-links {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.footer-bottom {
    max-width: 1200px;
    margin: 20px auto 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    width: 33%;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-icon {
    font-size: 1.2rem;
}

.bottom-nav-cart-wrapper {
    position: relative;
    display: inline-block;
}

.nav-badge {
    position: absolute;
    top: -6px;
    left: -10px;
    font-size: 0.65rem;
    padding: 1px 4px;
}

/* 7. Responsive Media Queries */
@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    body {
        padding-bottom: 0;
    }
    .nav-links {
        display: flex;
    }
    .bottom-nav {
        display: none;
    }
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    .cart-btn-text {
        display: inline;
    }
    .footer-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}