/* Degania Bet Dining Hall - Premium RTL Design System */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&family=Rubik:wght@400;500;600;700&display=swap');

:root {
  --primary-olive: #29402D;
  --primary-olive-dark: #1E3022;
  --primary-olive-light: #E9EFEA;
  --accent-terracotta: #C85A32;
  --accent-terracotta-hover: #AF4A25;
  --accent-amber: #D97706;
  --accent-amber-light: #FEF3C7;
  
  --bg-page: #F7F5F0;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FAF9F6;
  --border-color: #E5E2DC;
  --border-subtle: #EDEAE4;
  
  --text-main: #1C241D;
  --text-muted: #657065;
  --text-light: #8E998E;
  
  --status-submitted: #F59E0B;
  --status-approved: #10B981;
  --status-prep: #3B82F6;
  --status-ready: #8B5CF6;
  --status-cancelled: #EF4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px rgba(28, 36, 29, 0.08);
  --shadow-lg: 0 10px 30px rgba(28, 36, 29, 0.12);
  --shadow-glow: 0 0 20px rgba(200, 90, 50, 0.25);
}

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

body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-olive), var(--accent-terracotta));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-olive-dark);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  background: var(--bg-page);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary-olive-dark);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-reset {
  background: var(--primary-olive-light);
  color: var(--primary-olive-dark);
  border: 1px solid rgba(41, 64, 45, 0.2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-reset:hover {
  background: #dfe6e1;
}

/* Layout Container */
.main-container {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  flex: 1;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Customer View Grid */
.customer-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  flex: 1;
  min-height: calc(100vh - 120px);
}

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

/* Chat Card */
.chat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 120px);
}

.chat-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(to left, #FFFFFF, var(--primary-olive-light));
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-family: 'Rubik', sans-serif;
  font-size: 1.05rem;
  color: var(--primary-olive-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #D1FAE5;
  color: #065F46;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

/* Quick Chips */
.quick-chips-wrapper {
  padding: 0.75rem 1.25rem;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.chip-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.quick-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--primary-olive-dark);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-chip:hover {
  background: var(--primary-olive);
  color: white;
  border-color: var(--primary-olive);
}

/* Chat Log */
.chat-log {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg-row {
  display: flex;
  gap: 10px;
  max-width: 82%;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.assistant {
  align-self: flex-start;
}

.msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.avatar.bot {
  background: var(--primary-olive-light);
  color: var(--primary-olive);
  border: 1px solid rgba(41, 64, 45, 0.2);
}

.avatar.user {
  background: var(--accent-terracotta);
  color: white;
}

.msg-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row.assistant .msg-bubble {
  background: #F4F6F3;
  color: var(--text-main);
  border-bottom-right-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.msg-row.user .msg-bubble {
  background: var(--primary-olive);
  color: white;
  border-bottom-left-radius: 4px;
}

/* Chat Input */
.chat-input-bar {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  background: var(--bg-card);
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  background: var(--bg-page);
  transition: all 0.2s;
}

.chat-input:focus {
  border-color: var(--primary-olive);
  background: white;
  box-shadow: 0 0 0 3px rgba(41, 64, 45, 0.1);
}

.btn-send {
  background: var(--primary-olive);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 0 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-send:hover {
  background: var(--primary-olive-dark);
}

/* Order Summary Side Panel */
.order-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.order-panel-header {
  padding: 1rem 1.25rem;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
}

.order-panel-header h3 {
  font-family: 'Rubik', sans-serif;
  font-size: 1.05rem;
  color: var(--primary-olive-dark);
}

.order-panel-content {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.details-card {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-subtle);
}

.details-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
}

.details-label {
  color: var(--text-muted);
}

.details-val {
  font-weight: 600;
  color: var(--text-main);
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.order-item-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.item-qty-badge {
  background: var(--primary-olive-light);
  color: var(--primary-olive-dark);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

.price-lock-banner {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: #92400E;
}

.price-total-box {
  background: var(--primary-olive-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-olive-dark);
}

.total-amount {
  font-family: 'Rubik', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-olive-dark);
}

.order-panel-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.btn-sign {
  width: 100%;
  background: var(--accent-terracotta);
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s;
}

.btn-sign:hover {
  background: var(--accent-terracotta-hover);
  transform: translateY(-1px);
}

.btn-sign:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Dashboard View */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Watchdog Banner */
.watchdog-banner {
  background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
  border: 1px solid #FDBA74;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.watchdog-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.watchdog-icon {
  font-size: 2.2rem;
}

.watchdog-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #9A3412;
}

.watchdog-desc {
  font-size: 0.88rem;
  color: #C2410C;
}

.btn-watchdog {
  background: #EA580C;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

.btn-watchdog:hover {
  background: #C2410C;
}

/* Management Tables */
.orders-table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.table-header-title {
  padding: 1.1rem 1.5rem;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-header-title h3 {
  font-family: 'Rubik', sans-serif;
  font-size: 1.1rem;
  color: var(--primary-olive-dark);
}

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

.orders-table th {
  background: #FBF9F5;
  padding: 12px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-align: right;
}

.orders-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.badge-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-submitted {
  background: #FEF3C7;
  color: #92400E;
}

.badge-approved {
  background: #D1FAE5;
  color: #065F46;
}

.badge-attention {
  background: #FEE2E2;
  color: #991B1B;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.action-btns {
  display: flex;
  gap: 8px;
}

.btn-approve {
  background: #10B981;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-approve:hover {
  background: #059669;
}

.btn-reject {
  background: #F3F4F6;
  color: #4B5563;
  border: 1px solid #D1D5DB;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-reject:hover {
  background: #E5E7EB;
}

.btn-pdf {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-pdf:hover {
  background: #DBEAFE;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 25, 20, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal-title {
  font-family: 'Rubik', sans-serif;
  font-size: 1.25rem;
  color: var(--primary-olive-dark);
  margin-bottom: 0.5rem;
}

.sig-canvas-container {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  background: #FAFBF9;
  position: relative;
}

#signature-canvas {
  width: 100%;
  height: 180px;
  display: block;
  cursor: crosshair;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.btn-clear {
  background: none;
  border: 1px solid #CBD5E1;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-confirm-sign {
  background: var(--accent-terracotta);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
}
