@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
    --primary: #2563eb;       /* لون أزرق عصري */
    --secondary: #1e293b;     /* لون داكن للنصوص */
    --accent: #ef4444;        /* لون أحمر للخصومات */
    --bg: #f8fafc;            /* خلفية رمادية فاتحة جداً */
    --card-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; font-family: 'Cairo', sans-serif; margin: 0; padding: 0; }

body { background-color: var(--bg); color: var(--secondary); direction: rtl; padding-bottom: 80px; }

/* --- Header --- */
header {
    background: var(--card-bg);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand { font-size: 1.2rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.cart-icon { position: relative; font-size: 1.5rem; cursor: pointer; }
.cart-count {
    position: absolute; top: -5px; right: -8px;
    background: var(--accent); color: white;
    font-size: 0.7rem; font-weight: bold;
    padding: 2px 6px; border-radius: 10px;
}

/* --- Container --- */
.container { width: 92%; margin: 20px auto; max-width: 1200px; }

/* --- Hero Section (إعلان بسيط) --- */
.hero {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: white;
    padding: 30px 20px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}
.hero h2 { margin-bottom: 10px; font-size: 1.5rem; }
.hero p { opacity: 0.9; font-size: 0.9rem; }

/* --- Grid System --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* عمودين للموبايل */
    gap: 15px;
}

/* --- Product Card --- */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}
.product-card:active { transform: scale(0.98); } /* تأثير عند اللمس */

.badge-sale {
    position: absolute; top: 10px; right: 10px;
    background: var(--accent); color: white;
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.7rem; font-weight: bold;
    z-index: 10;
}

.img-container {
    width: 100%;
    height: 160px; /* ارتفاع ثابت للصورة */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-details { padding: 12px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.product-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 5px; line-height: 1.4; }
.product-desc { font-size: 0.75rem; color: #64748b; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.current-price { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.was-price { text-decoration: line-through; color: #94a3b8; font-size: 0.8rem; }

.btn-add {
    width: 100%;
    background: var(--secondary);
    color: white;
    border: none;
    padding: 10px;
    margin-top: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-add:hover { background: var(--primary); }

/* --- Media Queries --- */
@media (min-width: 768px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 25px; }
    .img-container { height: 220px; }
}
@media (min-width: 1024px) {
    .products-grid { grid-template-columns: repeat(4, 1fr); }
}