/* Restaurant System - Theme: Red/Orange */
:root {
    --primary: #dc2626;
    --primary-light: #f87171;
    --primary-dark: #991b1b;
    --secondary: #f59e0b;
    --secondary-light: #fbbf24;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #a855f7;
    --pink: #ec4899;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-darker: #f1f5f9;
    --bg-darkest: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-md: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-md: 14px;
    --gradient-primary: linear-gradient(135deg, #dc2626 0%, #f59e0b 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Cairo', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #dc2626 0%, #f59e0b 100%); }
.login-card { background: white; padding: 40px 32px; border-radius: 20px; box-shadow: 0 25px 50px rgba(0,0,0,0.15); width: 100%; max-width: 420px; text-align: center; }
.login-card h1 { color: var(--primary); font-size: 1.7rem; margin-bottom: 4px; }
.login-hint { margin-top: 18px; padding: 14px; background: #fef2f2; border-radius: 10px; font-size: 0.85rem; text-align: right; }
.login-hint code { background: #fff; padding: 2px 8px; border-radius: 4px; color: var(--primary); font-size: 0.85rem; }

.form-group { margin-bottom: 16px; text-align: right; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
textarea { resize: vertical; min-height: 80px; }

.btn { padding: 10px 20px; border: none; border-radius: var(--radius); font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn-primary { background: var(--gradient-primary); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-secondary { background: var(--bg-darker); color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; justify-content: center; padding: 13px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 64px 1fr; grid-template-areas: "topbar topbar" "sidebar main"; min-height: 100vh; }
.app-shell.hidden { display: none; }

.topbar { grid-area: topbar; background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 16px; box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }
.topbar-brand { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-sub { font-size: 0.8rem; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: none; background: var(--bg-darker); cursor: pointer; position: relative; }
.badge { position: absolute; top: -4px; left: -4px; background: var(--danger); color: white; border-radius: 10px; padding: 2px 6px; font-size: 0.7rem; font-weight: 700; min-width: 18px; text-align: center; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-darker); border: none; border-radius: 10px; cursor: pointer; font-family: inherit; font-weight: 600; }
.user-dropdown { position: absolute; top: calc(100% + 8px); left: 0; background: white; border-radius: var(--radius); box-shadow: var(--shadow-md); min-width: 180px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s; z-index: 1000; }
.user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text); text-decoration: none; }
.user-dropdown a:hover { background: var(--bg-darker); }
.menu-toggle { width: 40px; height: 40px; border-radius: 10px; border: none; background: var(--bg-darker); cursor: pointer; }

.sidebar { grid-area: sidebar; background: white; border-left: 1px solid var(--border); padding: 16px 12px; overflow-y: auto; height: calc(100vh - 64px); position: sticky; top: 64px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); color: var(--text-muted); text-decoration: none; cursor: pointer; font-weight: 500; }
.nav-item:hover { background: var(--bg-darker); color: var(--primary); }
.nav-item.active { background: var(--gradient-primary); color: white; }

.main-content { grid-area: main; padding: 24px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 1.6rem; font-weight: 800; }
.page-title small { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-top: 4px; }

.toolbar { background: white; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.search-box { flex: 1; min-width: 200px; position: relative; }
.search-box i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { width: 100%; padding: 10px 40px 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-family: inherit; }
.search-box input:focus { outline: none; border-color: var(--primary); }

.card { background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 18px; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg-darker); display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 1.05rem; font-weight: 700; }
.card-body { padding: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; padding: 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--gradient-primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-card.success .stat-icon { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #a855f7, #ec4899); }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.data-table { background: white; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); overflow-x: auto; }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--bg-darker); padding: 12px 14px; text-align: right; font-weight: 700; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.data-table tr:hover td { background: var(--bg-darker); }

.status { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.status.active, .status.paid, .status.ready { background: #dcfce7; color: #16a34a; }
.status.pending, .status.preparing { background: #fef3c7; color: #b45309; }
.status.closed, .status.served { background: #e2e8f0; color: #475569; }
.status.cancelled, .status.overdue { background: #fee2e2; color: #dc2626; }
.status.available { background: #dcfce7; color: #16a34a; }
.status.occupied { background: #fee2e2; color: #dc2626; }
.status.reserved { background: #fef3c7; color: #b45309; }

.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: white; border-radius: var(--radius-md); width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-md); animation: modalSlide 0.3s ease; }
@keyframes modalSlide { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-lg { max-width: 900px; }
.modal-header { padding: 18px 22px; background: var(--gradient-primary); color: white; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: rgba(255,255,255,0.2); border: none; color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-darker); }

#toastContainer { position: fixed; top: 80px; left: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: white; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-md); border-right: 4px solid var(--primary); animation: toastSlide 0.3s ease; min-width: 280px; font-weight: 600; }
.toast.success { border-color: var(--success); color: #16a34a; }
.toast.warning { border-color: var(--warning); color: #b45309; }
.toast.error { border-color: var(--danger); color: #dc2626; }
@keyframes toastSlide { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 14px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.detail-item { background: var(--bg-darker); padding: 12px 14px; border-radius: var(--radius); border-right: 3px solid var(--primary); }
.detail-item .lbl { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.detail-item .val { font-weight: 700; font-size: 1rem; }

/* Tables grid */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.table-card { background: white; border: 2px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; }
.table-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.table-card.available { border-color: #22c55e; background: #f0fdf4; }
.table-card.occupied { border-color: #dc2626; background: #fef2f2; }
.table-card.reserved { border-color: #f59e0b; background: #fffbeb; }
.table-number { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.table-status { font-size: 0.85rem; font-weight: 600; }
.table-icon { font-size: 1.8rem; margin-bottom: 8px; opacity: 0.6; }

/* Menu grid */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.menu-item-card { background: white; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); transition: all 0.2s; cursor: pointer; }
.menu-item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.menu-img { height: 120px; background: var(--gradient-warm); display: flex; align-items: center; justify-content: center; font-size: 3rem; position: relative; }
.menu-info { padding: 14px; }
.menu-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.menu-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 8px; }
.menu-price { color: var(--primary); font-weight: 800; font-size: 1.2rem; }
.menu-cat { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: white; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; }

/* Order */
.order-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.menu-section { background: white; border-radius: var(--radius-md); padding: 18px; max-height: 600px; overflow-y: auto; }
.cart-section { background: white; border-radius: var(--radius-md); padding: 18px; }
.cart-items { max-height: 300px; overflow-y: auto; margin: 14px 0; }
.cart-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item-info strong { display: block; }
.cart-item-info small { color: var(--text-muted); }

@media (max-width: 968px) {
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
    .sidebar { position: fixed; right: -260px; top: 64px; height: calc(100vh - 64px); z-index: 99; transition: right 0.3s; width: 260px; background: white; }
    .sidebar.open { right: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .order-grid { grid-template-columns: 1fr; }
}

/* KDS */
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.kds-card { background: white; border-radius: var(--radius-md); padding: 16px; border-top: 6px solid var(--warning); }
.kds-card.urgent { border-top-color: var(--danger); animation: pulseBorder 2s infinite; }
.kds-card.ready { border-top-color: var(--success); }
@keyframes pulseBorder { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); } 50% { box-shadow: 0 0 0 10px rgba(220,38,38,0); } }
.kds-header { display: flex; justify-content: space-between; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.kds-time { font-size: 0.85rem; color: var(--text-muted); }
.kds-items { list-style: none; padding: 0; margin-bottom: 12px; }
.kds-items li { padding: 6px 0; display: flex; justify-content: space-between; }
.kds-actions { display: flex; gap: 8px; }

.text-gold { color: var(--primary); }
.mb-1 { margin-bottom: 10px; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.hidden { display: none !important; }
.flex { display: flex; }
.gap-1 { gap: 10px; }
.chart-container { background: white; padding: 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); height: 320px; }