/* ================================================ */
/* == ملف style.css النهائي والمنظم == */
/* ================================================ */

/* --- متغيرات الألوان والخطوط --- */
:root {
    --primary-color: #007BFF;
    --secondary-color: #FFC107;
    --accent-color: #28A745;
    --text-color: #343A40;
    --light-text-color: #f8f9fa;
    --background-color: #f8f9fa;
    --card-background-color: #ffffff;
    --border-color: #dee2e6;
    --danger-color: #DC3545;

    --font-primary: 'Cairo', 'Tajawal', sans-serif;
    --font-headings: 'Cairo', 'Tajawal', sans-serif;

    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
    --border-radius: 8px;
}

/* --- إعادة تعيين أساسية وتحسينات عامة --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    line-height: 1.7;
    background-color: var(--background-color);
    color: var(--text-color);
    direction: rtl;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

h1, h2, h3, h4 {
    font-family: var(--font-headings);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.75em;
}

h1.logo-text,
h2.section-title,
h2.restaurant-specific-name,
h1.page-title-main,
.admin-main-title {
    color: var(--primary-color);
}

h2.section-title::after {
    content: ''; position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%); width: 80px; height: 3px;
    background-color: var(--secondary-color); border-radius: 2px;
}

h1.page-title-main {
     font-size: 2.2em;
     text-align: center;
     margin-top: 30px;
     margin-bottom: 40px;
}

h2.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 10px;
}


p { margin-bottom: 1em; }
a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--secondary-color); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* --- الهيدر العام (لجميع الصفحات) --- */
header {
    background-color: var(--card-background-color);
    padding: 0.8rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 20px;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .site-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

header #site-logo {
    height: 45px;
    width: auto;
    margin-left: 12px; 
}

header .logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

/* --- تنسيق احترافي لروابط الهيدر --- */
/* --- تنسيق حاوية الروابط --- */
header nav {
    background-color: #e9ecef; /* لون خلفية الإطار */
    border-radius: 50px; /* لجعل الحواف دائرية بالكامل */
    padding: 5px; /* حشو داخلي بسيط */
    display: flex;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
/* --- تنسيق الروابط داخل الإطار الموحد --- */
header nav a {
    color: #343A40;
    margin: 0; /* إزالة الهوامش الخارجية */
    font-size: 1.05rem;
    font-weight: 700;
    padding: 10px 22px;
    border-radius: 50px; /* لجعل كل رابط دائري أيضاً */
    text-decoration: none;
    transition: all 0.3s ease;
    border: none; /* لا نحتاج إطار حول كل رابط */
}

/* التأثير عند مرور الفأرة أو إذا كان الرابط نشطاً */
header nav a:hover, header nav a.active {
    color: var(--light-text-color); /* لون النص أبيض */
    background-color: var(--primary-color); /* خلفية باللون الأساسي */
    transform: scale(1.05); /* تكبير بسيط للرابط */
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

/* تنسيق خاص لعداد عربة التسوق */
header nav a #cart-count {
    background-color: rgba(255, 255, 255, 0.2); /* خلفية شفافة للعداد */
    color: var(--light-text-color);
    padding: 3px 8px;
    border-radius: 50px;
    font-size: 0.85em;
    margin-right: 5px;
    vertical-align: middle;
    transition: background-color 0.3s ease;
}

/* تغيير لون العداد عند تفعيل الرابط */
header nav a:hover #cart-count,
header nav a.active #cart-count {
    background-color: var(--danger-color); /* يظهر باللون الأحمر عند التفعيل */
}

/* --- الصفحة الرئيسية (index.html) --- */
.restaurants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
    gap: 30px; padding: 20px 0; justify-content: center;
}
.restaurant-card {
    background-color: var(--card-background-color);
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    overflow: hidden; text-decoration: none; color: var(--text-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column;
}
.restaurant-card:hover { transform: translateY(-5px); box-shadow: var(--box-shadow-hover); }
.restaurant-card img { width: 100%; height: 180px; object-fit: cover; }
.restaurant-card-content { padding: 20px; flex-grow: 1; text-align: right; }
.restaurant-card h3 { margin-top: 0; color: var(--primary-color); font-size: 1.5em; }
.restaurant-card p { font-size: 0.95em; color: #6c757d; margin-bottom: 0; }


/* --- صفحات المحلات الفردية --- */

#status-banner {
    padding: 12px; text-align: center; font-size: 1.1em;
    font-weight: bold; color: white;
}
#status-banner.status-open { background-color: var(--accent-color); }
#status-banner.status-closed { background-color: var(--secondary-color); }

.restaurant-identity {
    padding: 25px 0; margin-bottom: 25px;
    background-color: var(--card-background-color);
    text-align: center; border-radius: var(--border-radius); box-shadow: var(--box-shadow);
}
.restaurant-identity-content { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.restaurant-specific-logo {
    max-height: 80px;
    width: auto; border-radius: 8px;
}
.restaurant-specific-name { font-size: 2em; margin: 0; }
.restaurant-tagline { font-size: 1.1em; color: var(--secondary-color); margin-top: 5px; }

#menu { padding: 30px 0; }
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 320px)); 
    gap: 25px;
    justify-content: center;
}
.menu-item {
    background-color: var(--card-background-color);
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    overflow: hidden; display: flex; flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.menu-item:hover { transform: translateY(-5px); box-shadow: var(--box-shadow-hover); }
.menu-item img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;   
    display: block;
}
.menu-item.out-of-stock {
    opacity: 0.6;
    position: relative;
}
.menu-item.out-of-stock::after {
    content: 'نفد من المخزون';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(108, 117, 125, 0.7);
    color: white; display: flex; justify-content: center;
    align-items: center; font-size: 1.8em; font-weight: bold; z-index: 5;
}
.menu-item-content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.menu-item h3 { font-size: 1.3rem; margin-top: 0; margin-bottom: 0.5em; }
.menu-item .description { font-size: 0.9rem; color: #6c757d; flex-grow: 1; margin-bottom: 1em; }
.menu-item .price { font-size: 1.25rem; font-weight: 700; color: var(--accent-color); margin-bottom: 1em; }

.customizations, .variation-options {
    margin-top: 15px; margin-bottom: 15px;
}
.customizations h4, .variation-options h4 {
    margin-top: 0; margin-bottom: 10px; font-size: 0.95rem; font-weight: 700; text-align: right;
}
.customizations label, .variation-group label {
    display: block; margin-bottom: 6px; font-size: 0.85rem; color: #495057; cursor: pointer;
}
.customizations label:hover, .variation-group label:hover { color: var(--primary-color); }
.customizations label input[type="checkbox"] { margin-left: 8px; vertical-align: middle; accent-color: var(--primary-color); }

.variation-group { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
.variation-group input[type="radio"] { display: none; }
.variation-group label {
    padding: 8px 15px; border: 1px solid var(--border-color);
    border-radius: 20px; transition: all 0.2s ease-in-out;
}
.variation-group input[type="radio"]:checked + label {
    background-color: var(--primary-color); color: white;
    border-color: var(--primary-color); font-weight: bold;
}
.variation-group label.out-of-stock {
    opacity: 0.5; text-decoration: line-through; cursor: not-allowed;
    background-color: #e9ecef !important; color: #6c757d !important;
    border-color: var(--border-color) !important;
}

.add-to-cart-btn, #checkout-btn {
    background-color: var(--primary-color); color: var(--light-text-color); border: none;
    padding: 12px 20px; text-align: center; font-size: 1rem; font-weight: 700;
    border-radius: var(--border-radius); cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: block; width: 100%; margin-top: auto;
}
.add-to-cart-btn:hover, #checkout-btn:hover:not(:disabled) { background-color: #0056b3; transform: scale(1.02); }
.add-to-cart-btn:disabled, #checkout-btn:disabled {
    background-color: #6c757d; cursor: not-allowed; transform: none;
}
#checkout-btn { background-color: var(--accent-color); }
#checkout-btn:hover:not(:disabled) { background-color: #1e7e34; }

#cart {
    padding: 30px 0; background-color: var(--card-background-color); 
    border-radius: var(--border-radius); box-shadow: var(--box-shadow); margin-bottom: 30px; 
}
#cart-content-wrapper { display: flex; flex-wrap: wrap; gap: 30px; }
#cart-items-container { flex: 2; min-width: 300px; }
#checkout-form { flex: 1; min-width: 280px; background-color: #f8f9fa; padding: 25px; border-radius: var(--border-radius); border: 1px solid var(--border-color); }
#checkout-form h3 { font-size: 1.3rem; text-align: center; color: var(--primary-color); }

#cart-items { list-style: none; padding: 0; margin-bottom: 20px; }
#cart-items li { padding: 15px 10px; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 5px; }
#cart-items li:last-child { border-bottom: none; }
#cart-items .cart-item-main-line { display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
#cart-items .cart-item-main-line span { flex-grow: 1; }
#cart-items .cart-item-customizations { font-size: 0.85em; color: #6c757d; margin-right: 15px; padding-right: 10px; border-right: 2px solid var(--secondary-color); }
.empty-cart-message { text-align: center; padding: 20px; color: #6c757d; font-style: italic; }
#cart-items li button { background-color: transparent; color: var(--danger-color); border: 1px solid var(--danger-color); padding: 4px 8px; border-radius: var(--border-radius); cursor: pointer; font-size: 0.8rem; transition: background-color 0.3s ease, color 0.3s ease; }
#cart-items li button:hover { background-color: var(--danger-color); color: var(--light-text-color); }

.cart-summary { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.cart-summary p { display: flex; justify-content: space-between; font-size: 1rem; margin-bottom: 8px; }
.cart-summary p span { font-weight: 700; }
.cart-summary hr { border: 0; border-top: 1px dashed var(--border-color); margin: 10px 0; }
.cart-summary .cart-grand-total { font-size: 1.3rem; font-weight: 700; }
.cart-summary .cart-grand-total span { color: var(--accent-color); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.95rem; }
.form-group input[type="tel"], .form-group select {
    width: 100%; padding: 12px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); font-family: var(--font-primary);
    font-size: 1rem; transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-group input[type="tel"]:focus, .form-group select:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#order-confirmation { 
    background-color: #e6ffed; border: 1px solid var(--accent-color); color: #1d6430; 
    padding: 25px; border-radius: var(--border-radius); margin-top: 30px; text-align: center; 
}
#order-confirmation .order-summary-box { margin: 20px 0; padding: 15px; border: 1px dashed var(--border-color); background-color: #f8f9fa; border-radius: var(--border-radius); text-align: right; }
#order-confirmation .order-summary-box h4 { margin-top: 0; margin-bottom: 10px; color: var(--text-color); border-bottom: 2px solid var(--accent-color); padding-bottom: 5px; }
#order-confirmation #confirmed-items-list { list-style: none; padding: 0; margin: 0; }
#order-confirmation #confirmed-items-list li { padding: 8px 0; border-bottom: 1px solid #e9ecef; font-size: 0.95em; }
#order-confirmation #confirmed-items-list li:last-child { border-bottom: none; }
#order-confirmation #confirmed-items-list em { display: block; font-size: 0.9em; color: #6c757d; margin-right: 15px; }
#order-confirmation h3 { color: var(--accent-color); font-size: 1.5rem; margin-bottom: 15px; }
#order-confirmation p { margin-bottom: 8px; font-size: 1.05rem; }
#order-confirmation strong { font-weight: 700; }
#order-confirmation p strong#confirmed-grand-total { color: var(--accent-color); font-size: 1.15em; }

/* --- صفحة الأدمن (admin.html) --- */
.admin-main-title {
    text-align: center; color: var(--primary-color);
    margin-bottom: 30px; font-size: 2rem;
}
.restaurant-status-management, .product-availability-management {
    margin-bottom: 40px; padding: 20px; background-color: #f0f4f8;
    border-radius: var(--border-radius); border: 1px solid var(--border-color);
}
.restaurant-status-management h2, .product-availability-management h2 {
    text-align: center; color: var(--primary-color);
    margin-top: 0; margin-bottom: 20px;
}
#restaurant-status-table, #product-availability-table, #orders-table {
    width: 100%; border-collapse: collapse;
    margin-top: 20px;
}
#restaurant-status-table th, #restaurant-status-table td,
#product-availability-table th, #product-availability-table td,
#orders-table th, #orders-table td {
    padding: 10px 12px; border: 1px solid var(--border-color);
    text-align: right; vertical-align: middle;
}
#orders-table thead { background-color: var(--primary-color); color: white; }
#restaurant-status-table thead { background-color: #5a6268; color: white; }
#product-availability-table thead { background-color: var(--secondary-color); color: var(--text-color); }
#orders-table td, #product-availability-table td, #restaurant-status-table td { font-size: 0.95em; }

.status-text-open, .confirmed-text { color: var(--accent-color); font-weight: bold; }
.status-text-closed { color: var(--danger-color); font-weight: bold; }
.action-btn {
    padding: 6px 10px; border: none; border-radius: 4px; color: white;
    font-size: 0.85em; cursor: pointer; margin: 0 4px; transition: opacity 0.2s ease;
}
.action-btn:hover { opacity: 0.8; }
.action-btn.open { background-color: var(--accent-color); }
.action-btn.close { background-color: var(--danger-color); }
.action-btn:disabled { background-color: #adb5bd; cursor: not-allowed; opacity: 0.7; }
#orders-table .details {
    max-width: 300px; font-size: 0.9em; white-space: pre-wrap;
    word-break: break-word; background-color: #fdfdfd;
}
#orders-table .details pre { font-size: 1em; }
.confirm-btn {
    padding: 5px 10px; background-color: var(--accent-color); color: white;
    border: none; border-radius: 4px; cursor: pointer; font-size: 0.85em;
    transition: background-color 0.2s ease;
}
.confirm-btn:hover { background-color: #218838; }

/* --- التذييل العام --- */
footer {
    background-color: #343a40; color: var(--light-text-color);
    text-align: center; padding: 25px 0; margin-top: 50px;
}
footer p { margin-bottom: 0; font-size: 0.9rem; }

/* --- استعلامات الوسائط للتجاوب (Responsive) --- */
@media (max-width: 768px) {
    header .container { flex-direction: column; gap: 10px; }
    header nav { margin-top: 10px; }
    header nav a { margin: 0 5px; font-size: 0.9rem; padding: 6px 8px; }
    
    .restaurants-grid,
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    #cart-content-wrapper { flex-direction: column; }
    #cart-items-container, #checkout-form { flex: none; width: 100%; }
    
    h1.logo-text { font-size: 1.6rem; }
    h2.section-title, .restaurant-specific-name, h1.page-title-main, .admin-main-title { font-size: 1.5em; }

    #restaurant-status-table th, #restaurant-status-table td,
    #product-availability-table th, #product-availability-table td,
    #orders-table th, #orders-table td {
        font-size: 0.8em; padding: 8px 6px;
    }
    #orders-table .details { max-width: 150px; }
    .action-btn, .confirm-btn { font-size: 0.75em; padding: 4px 8px; }
}



/* --- تنسيقات جدولة الطلبات --- */
.schedule-options {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.schedule-options input[type="radio"] {
    display: none;
}

.schedule-options .schedule-label {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.schedule-options input[type="radio"]:checked + .schedule-label {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#schedule-time-container input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-primary);
    font-size: 1rem;
}

/* --- تنسيقات الفوتر --- */
footer .footer-links {
    margin-bottom: 15px;
}
footer .footer-links a {
    color: #a9c1d8; /* لون أفتح قليلاً */
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.95em;
}
footer .footer-links a:hover {
    color: var(--light-text-color);
    text-decoration: underline;
}

/* ================================================ */
/* ==   تنسيقات خانة عربة التسوق العائمة   == */
/* ================================================ */

/* ================================================ */
/* ==   التصميم 2: البسيط والفعال   == */
/* ================================================ */

.floating-cart-btn {
    position: fixed;
    bottom: 25px;
    left: 25px; /* أو right: 25px; */
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, #007BFF, #0056b3); /* خلفية متدرجة */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    text-decoration: none;
    color: white;
}

.floating-cart-btn:hover {
    transform: scale(1.1) rotate(10deg); /* تكبير ودوران بسيط */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.floating-cart-btn .cart-icon-container {
    font-size: 1.8rem;
    transition: transform 0.3s ease;
}

.floating-cart-btn .cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50px;
    padding: 4px 9px;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* إخفاء السعر بشكل افتراضي */
.floating-cart-btn .cart-total-price {
    position: absolute;
    bottom: 110%; /* يظهر فوق الزر */
    left: 50%;
    transform: translateX(-50%);
    background-color: #343A40;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap; /* يمنع نزول النص لسطر جديد */
    opacity: 0; /* مخفي */
    visibility: hidden;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}

/* إظهار السعر عند المرور بالفأرة */
.floating-cart-btn:hover .cart-total-price {
    opacity: 1;
    visibility: visible;
    bottom: 120%; /* يرتفع للأعلى قليلاً */
}

/* سهم صغير يشير للأسفل */
.floating-cart-btn:hover .cart-total-price::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #343A40 transparent transparent transparent;
}


/* إخفاء الخانة عندما تكون عربة التسوق فارغة */
.floating-cart-btn.hidden {
    transform: scale(0);
    opacity: 0;
}

/* --- تنسيقات زر تحديد الموقع (GPS) --- */
.location-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-primary);
    color: var(--primary-color);
    background-color: transparent;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.location-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.location-status {
    text-align: center;
    font-weight: 500;
    margin-top: 10px;
    font-size: 0.9rem;
    padding: 8px;
    border-radius: var(--border-radius);
    display: none; /* مخفي بشكل افتراضي */
}

.location-status.success {
    color: #1d6430;
    background-color: #e6ffed;
    display: block;
}

.location-status.error {
    color: #721c24;
    background-color: #f8d7da;
    display: block;
}

/* --- تنسيق شارة حالة المطعم --- */
.restaurant-card-content {
    position: relative; /* ضروري لتحديد موقع الشارة */
    padding-bottom: 30px; /* إضافة مساحة للشارة في الأسفل */
}

.status-badge {
    position: absolute;
    bottom: 15px;
    right: 20px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.status-badge.open {
    background-color: var(--accent-color); /* أخضر */
}

.status-badge.closed {
    background-color: var(--danger-color); /* أحمر */
}