footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ff5722;
    color: #fff;
    padding: 20px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
    z-index: 1000;
    padding-bottom: 80px;
}

/* إعدادات أساسية */
body {
    font-family: 'Cairo', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f7f7f7;
    color: #222;
    direction: rtl;
}

/* الوضع الليلي */
.dark-mode {
    background-color: #1e1e1e;
    color: #eee;
}

/* ========== الشريط العلوي ========== */
.top-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    /* ترتيب RTL */
    background-color: #ff5722;
    color: white;
    padding: 8px 16px;
}

.top-banner .back-icon img {
    width: 28px;
    height: 28px;
}

.top-banner p {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

/* زر اللغة */
.top-banner #langToggle {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: bold;
    background-color: #ffffff00;
    color: #ffffff;
    border: 2px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.top-banner #langToggle:hover {
    background-color: #ff5722;
    color: #fff;
}

/* زر اللغة في الوضع الليلي */
.dark-mode .top-banner #langToggle {
    background-color: transparent;
    color: #ffffff;
    border-color: #ffffff;
}

.dark-mode .top-banner #langToggle:hover {
    background-color: #ff9800;
    color: #1e1e1e;
}

/* ترتيب زر اللغة حسب اتجاه الصفحة */
body[dir="rtl"] .top-banner #langToggle {
    order: -1;
    margin-inline-start: auto;
}

body[dir="ltr"] .top-banner #langToggle {
    order: 2;
    margin-inline-end: auto;
}

/* ========== حاوية المنتج ========== */
.product-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 20px;
    gap: 20px;
}

.images,
.details {
    flex: 1;
    min-width: 300px;
}

/* ========== الصورة الرئيسية ========== */
.main-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.main-image img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
}

/* ========== الصور المصغرة ========== */
.thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.thumbnails img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border 0.3s;
}

.thumbnails img.active,
.thumbnails img:hover {
    border-color: #ff5722;
}

/* ========== تفاصيل المنتج ========== */
.details {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.05);
}

.details p {
    margin: 10px 0;
    font-size: 16px;
}

.details p span {
    font-weight: bold;
}

.details button {
    background-color: #ff5722;
    color: white;
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.details button:hover:not(:disabled) {
    background-color: #00684a;
}

.details button:disabled {
    cursor: not-allowed;
}

/* ========== نافذة الطلب ========== */
#order-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 85%;
    max-width: 450px;
    position: relative;
    z-index: 1000;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 20px;
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    margin-top: 10px;
    font-weight: 600;
}

.modal-content input {
    width: 95%;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.modal-content button {
    margin-top: 10px;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    margin-inline-end: 10px;
}

.modal-content button[type="submit"] {
    background-color: #ff5722;
    color: white;
}

.modal-content button#close-modal {
    background-color: #bbb;
    color: #111;
}

.modal-content button:hover {
    opacity: 0.9;
}

/* ========== الوضع الداكن (التفاصيل + النموذج) ========== */
.dark-mode .details,
.dark-mode .modal-content {
    background-color: #2b2b2b;
    color: #eee;
}

.dark-mode input {
    background-color: #444;
    color: #fff;
    border-color: #555;
}

.dark-mode .modal-content button#close-modal {
    background-color: #666;
}

/* ========== استجابة (Responsive) ========== */
@media (max-width: 768px) {
    .top-banner p {
        font-size: 16px;
    }

    .product-container {
        flex-direction: column;
        padding: 10px 10px 10px 10px;
    }

    .details button {
        width: 100%;
    }
}

/* حاوية النموذج */
form {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
}

/* تنسيق حقل select */
select[name="state"] {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Cairo', sans-serif;
    background-color: #fff;
    color: #333;
    appearance: none;
    /* إزالة السهم الافتراضي في بعض المتصفحات */
    background-image: url('data:image/svg+xml;utf8,<svg fill="gray" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 18px;
}

/* عند الوضع الليلي */
body.dark-mode select[name="state"] {
    background-color: #333;
    color: #fff;
    border-color: #555;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
}

/* تخصيص زر الإرسال ليكون متناسقًا */
form button[type="submit"],
form button[type="button"] {
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
}

form button[type="submit"] {
    background-color: #28a745;
    color: white;
}

form button[type="button"] {
    background-color: #dc3545;
    color: white;
}

.related-products {
    margin: 40px auto;
    max-width: 1200px;
    padding: 0 15px 100px;
    font-family: 'Cairo', sans-serif;
}

.related-products h3 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #ff5722;
    /* نفس لون الفوتر */
}

.related-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.related-item {
    display: flex;
    flex-direction: column;
    width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.related-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.related-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.related-item .name {
    font-weight: 700;
    font-size: 16px;
    padding: 10px 8px 4px;
    min-height: 44px;
    /* عشان النص ما يأثر على ارتفاع البطاقة */
}

.related-item .price {
    color: #ff5722;
    font-weight: 600;
    font-size: 14px;
    padding-bottom: 12px;
}

/* للعرض على الشاشات الصغيرة */
@media (max-width: 600px) {
    .related-item {
        width: 45%;
    }
}

@media (max-width: 400px) {
    .related-item {
        width: 100%;
    }
}