/* صور المنتجات */
.product-img,
.product-image,
.card img,
.product-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    border-radius: 14px;
}
/* السلة العائمة */
.cart-btn {
    position: fixed;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    z-index: 9999;

    background: #ffcc00;
    color: #111;
    padding: 12px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 17px;
    font-weight: bold;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.cart-btn:active {
    cursor: grabbing;
    transform: translateY(-50%) scale(0.95);
}
/* رقم المنتجات فوق السلة */
.cart-count {
    position: absolute;
    top: -7px;
    right: -7px;

    min-width: 20px;
    height: 20px;
    padding: 2px 5px;

    background: #111;
    color: white;
    border: 2px solid white;
    border-radius: 50%;

    font-size: 12px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
}
/* ===== Panier ===== */

body {
    max-width: 700px;
    margin: 0 auto;
    padding: 18px;
    box-sizing: border-box;
}

h1 {
    font-size: 38px;
    margin-bottom: 28px;
}

form > p {
    margin-bottom: 18px;
}

input[type="text"],
input[type="tel"],
select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
}

.product-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 18px;
    margin: 18px 0;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.product-card h3 {
    margin-top: 0;
    font-size: 24px;
}

.product-card a {
    display: inline-block;
    margin: 4px;
    padding: 7px 11px;
    border-radius: 9px;
}

button[type="submit"] {
    width: 100%;
    padding: 15px;
    border: 0;
    border-radius: 14px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
}
/* ===== تحسين أزرار السلة ===== */

.product-card p {
    margin: 14px 0;
}

/* أزرار + و - */
.product-card a[href*="increase"],
.product-card a[href*="decrease"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0 8px;
    background: #111;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
}

/* زر الحذف */
.product-card a[href*="remove"] {
    background: #e53935;
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: bold;
}

/* تصغير الفراغات داخل المنتج */
.product-card {
    padding: 18px;
}

.product-card h3 {
    margin: 0 0 15px 0;
}

.product-card select {
    margin-top: 5px;
}
/* أزرار الكمية + و - */
.qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0 8px;

    background: #111;
    color: white;
    text-decoration: none;

    border-radius: 50%;
    font-size: 22px;
    font-weight: bold;
}
/* ===== ADMIN PAGE ===== */

#orders {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#orders > div {
    background: white;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 5px 18px rgba(0,0,0,0.08);
}

body > h1 {
    font-size: 32px;
    margin: 20px 16px 10px;
}

body > h2 {
    font-size: 24px;
    margin: 10px 16px 20px;
}

#orders {
    margin: 0 16px 30px;
}

#orders h3 {
    margin-top: 0;
    font-size: 22px;
}

#orders p {
    margin: 10px 0;
    line-height: 1.45;
}

#orders button {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    margin: 5px 4px 0 0;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

@media (max-width: 600px) {
    body > h1 {
        font-size: 28px;
    }

    #orders > div {
        padding: 16px;
    }

    #orders button {
        width: 100%;
        margin: 6px 0;
    }
}
/* ===== تحسين صفحة الإدارة ===== */

body {
    background: #f5f5f5;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

body > h1 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 10px;
}

body > h2 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 25px;
    color: #555;
}

#orders {
    max-width: 800px;
    margin: 0 auto;
}

#orders > div {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

#orders button {
    border: none;
    border-radius: 10px;
    padding: 10px 15px;
    margin: 6px 4px 0 0;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    body > h1 {
        font-size: 27px;
    }

    #orders > div {
        padding: 15px;
    }

    #orders button {
        width: 100%;
        margin: 6px 0;
    }
}
/* تحسين كروت المنتجات */
.product-card {
    border-radius: 18px;
    overflow: hidden;
}

.product-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 16px;
}

/* السعر */
.product-card strong {
    font-size: 20px;
    font-weight: 800;
}

/* زر Ajouter au panier */
.product-card a {
    display: inline-block;
    background: #ffcc00;
    color: #000;
    text-decoration: none;
    font-weight: 800;
    padding: 12px 18px;
    border-radius: 12px;
}
@media (max-width: 600px) {
  .product-card strong {
    display: inline-block;
    margin-right: 12px;
    font-size: 20px;
  }

  .product-card a {
    margin-top: 10px;
  }
}
.category-title {
    width: 100%;
    font-size: 28px;
    font-weight: 800;
    margin: 30px 0 15px;
    padding-bottom: 8px;
    border-bottom: 3px solid #ffcc00;
}
/* ===== MENU CATEGORIES ===== */

#category-home {
    padding: 20px;
}

#category-home h2 {
    text-align: center;
    margin-bottom: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.category-card {
    background: white;
    border: none;
    border-radius: 18px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    cursor: pointer;
    text-align: center;
}

.category-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.category-card h3 {
    font-size: 21px;
    margin: 12px 5px 5px;
}

.category-card span {
    display: block;
    color: #666;
    padding-bottom: 14px;
    font-size: 14px;
}

#back-category {
    display: none;
    margin: 15px 20px;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    background: #ffcc00;
    font-weight: bold;
    font-size: 16px;
}
/* Retour au menu toujours accessible pendant la consultation des produits */
#back-categories:not([hidden]) {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 1px solid #dedede;
    border-radius: 999px;
    background: #198754;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .18);
    cursor: pointer;
    max-width: calc(100vw - 100px);
}
#back-categories[hidden] { display: none !important; }
