/* =============================================
   منصّة إدارة منيو وطلبات متعددة المطاعم
   Main Stylesheet
   ============================================= */

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: #f0f2f5;
    color: #333;
    direction: rtl;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* =============================================
   Layout - Sidebar + Content
   ============================================= */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--secondary);
    color: #fff;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    margin-top: 8px;
}

.sidebar-header small {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-right-color: var(--primary);
}

.sidebar-nav a i {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
}

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 20px 30px;
    min-height: 100vh;
}

/* =============================================
   Top Bar
   ============================================= */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar h2 {
    font-size: 1.3rem;
    color: var(--secondary);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* =============================================
   Cards & Stat Boxes
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.stat-icon.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-icon.blue { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-icon.green { background: linear-gradient(135deg, #27ae60, #219a52); }
.stat-icon.orange { background: linear-gradient(135deg, #f39c12, #e67e22); }
.stat-icon.purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); }

.stat-info h4 {
    font-size: 1.6rem;
    color: var(--secondary);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 2px;
}

/* =============================================
   Card / Panel
   ============================================= */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 18px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--secondary);
}

.card-body {
    padding: 25px;
}

/* =============================================
   Table
   ============================================= */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.table tr:hover {
    background: #fafbfc;
}

.table img.thumb {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-secondary { background: var(--gray); color: #fff; }
.btn-dark { background: var(--secondary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--secondary); }
.btn-outline:hover { background: #f8f9fa; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* =============================================
   Forms
   ============================================= */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

select.form-control {
    appearance: auto;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* =============================================
   Badge
   ============================================= */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-success { background: #d4edda; color: #155724; }
.bg-warning { background: #fff3cd; color: #856404; }
.bg-danger { background: #f8d7da; color: #721c24; }
.bg-info { background: #d1ecf1; color: #0c5460; }
.bg-primary { background: #cce5ff; color: #004085; }
.bg-secondary { background: #e2e3e5; color: #383d41; }
.bg-dark { background: #d6d8d9; color: #1b1e21; }

/* =============================================
   Alert
   ============================================= */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* =============================================
   Login Page
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, #1a252f 100%);
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 420px;
    max-width: 95%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--secondary);
}

.login-box p.subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* =============================================
   Public Menu Styles
   ============================================= */
.menu-page {
    background: #f5f5f5;
    min-height: 100vh;
}

.menu-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 30px 20px;
    text-align: center;
}

.menu-header .logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
    margin-bottom: 12px;
}

.menu-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.menu-header .status-badge {
    display: inline-block;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-top: 8px;
}

.status-open { background: rgba(39,174,96,0.9); }
.status-closed { background: rgba(231,76,60,0.9); }
.status-busy { background: rgba(243,156,18,0.9); }

.menu-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0 20px;
    -webkit-overflow-scrolling: touch;
}

.category-tab {
    flex-shrink: 0;
    padding: 8px 20px;
    background: #fff;
    border-radius: 25px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-family: inherit;
}

.category-tab.active,
.category-tab:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    display: flex;
    gap: 15px;
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.product-card img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-card .info {
    flex: 1;
    padding: 15px 15px 15px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card .info h4 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 4px;
}

.product-card .info .desc {
    font-size: 0.8rem;
    color: var(--gray);
    line-height: 1.4;
}

.product-card .info .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.product-card .price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.add-to-cart-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.add-to-cart-btn:hover {
    transform: scale(1.1);
}

/* Cart */
.cart-float {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 14px 30px;
    border-radius: 30px;
    box-shadow: 0 5px 25px rgba(231,76,60,0.4);
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 1rem;
    z-index: 100;
    border: none;
    font-weight: 600;
}

.cart-float.show { display: flex; }

.cart-count {
    background: #fff;
    color: var(--primary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Cart Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    padding: 25px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item .details {
    flex: 1;
}

.cart-item .details h5 {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.cart-item .details small {
    color: var(--gray);
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

/* Order form inside modal */
.order-form .form-group {
    margin-bottom: 12px;
}

.order-form .form-group label {
    font-size: 0.85rem;
}

.order-form .form-control {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Order Success */
.order-success {
    text-align: center;
    padding: 40px 20px;
}

.order-success i {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 15px;
}

.order-success h2 {
    margin-bottom: 10px;
    color: var(--secondary);
}

/* Notification popup */
.notification-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 9999;
    transition: transform 0.4s ease;
    min-width: 350px;
    border-right: 4px solid var(--primary);
}

.notification-popup.show {
    transform: translateX(-50%) translateY(0);
}

.notification-popup .order-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(260px);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
        padding: 15px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .product-card img {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Toggle button for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: var(--secondary);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 8px;
}
