/* ================================================================
   GIDO Store Portal — style.css
   Theme: Premium Dark Navy & Lime Green
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');

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

:root {
  --primary: #76C82F;
  --primary-light: #8AD14D;
  --primary-dark: #5FA722;
  --navy: #0F1724;
  --navy-light: #1E293B;
  --navy-dark: #090D16;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --purple: #8B5CF6;
  
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;
  --border: #E2E8F0;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-hint: #94A3B8;
  
  --sidebar-w: 260px;
  --topbar-h: 70px;
  --radius: 18px;
  --radius-sm: 12px;
  
  --shadow: 0 4px 20px -2px rgba(15,23,42,0.06);
  --shadow-md: 0 10px 30px -3px rgba(15,23,42,0.08);
  --shadow-lg: 0 20px 40px -4px rgba(15,23,42,0.12);
}

html { font-family: 'Cairo', sans-serif; direction: rtl; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.5); }

/* ── Typography & Animations ─────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: 800; line-height: 1.3; }
a { text-decoration: none; color: inherit; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fade-in-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-2 { animation-delay: 0.1s; opacity: 0; }
.fade-in-3 { animation-delay: 0.15s; opacity: 0; }
.fade-in-4 { animation-delay: 0.2s; opacity: 0; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  background-image: 
    radial-gradient(ellipse at 10% 10%, rgba(118,200,47,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 90%, rgba(59,130,246,0.04) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  height: 100vh;
  z-index: 100;
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo img {
  max-height: 50px;
  object-fit: contain;
}

.sidebar-section-label {
  padding: 20px 24px 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: white;
  padding-right: 20px;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(118,200,47,0.15) 0%, rgba(118,200,47,0.05) 100%);
  color: var(--primary);
  border: 1px solid rgba(118,200,47,0.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  width: 4px;
  background: var(--primary);
  border-radius: 4px 0 0 4px;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-label { flex: 1; }

.badge {
  background: linear-gradient(135deg, var(--danger), #F87171);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(239,68,68,0.3);
}

.pulse-badge {
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.15);
}

.store-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}

.store-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(118,200,47,0.3);
}

.store-name-meta {
  flex: 1;
  overflow: hidden;
}

.store-name-text {
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-role-text {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background: rgba(239,68,68,0.1);
  color: #FCA5A5;
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.logout-btn:hover { background: rgba(239,68,68,0.2); color: white; }

/* ── Main Content Layout ──────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin 0.3s ease;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.menu-toggle {
  display: none;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  margin-left: 16px;
}

.topbar-title h1 {
  font-size: 20px;
  color: var(--text-primary);
}

.topbar-title .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* Live status switch */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-hint);
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.inactive {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.status-text {
  font-size: 13px;
  font-weight: 700;
}

/* Toggles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* ── Page Wrapper ────────────────────────────────────────────── */
.page-container {
  padding: 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(118,200,47,0.3);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-card.primary .stat-icon { background: rgba(118,200,47,0.12); color: var(--primary-dark); }
.stat-card.success .stat-icon { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-card.info .stat-icon { background: rgba(59,130,246,0.12); color: var(--info); }

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Content Grid ────────────────────────────────────────────── */
.content-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}

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

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 24px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Order Alert Banner ───────────────────────────────────────── */
.order-alert-banner {
  background: linear-gradient(135deg, var(--warning) 0%, #FBBF24 100%);
  color: white;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  margin-bottom: 24px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px rgba(245,158,11,0.25);
  animation: pulse-orange-shadow 1.5s infinite;
}

@keyframes pulse-orange-shadow {
  0%, 100% { box-shadow: 0 8px 20px rgba(245,158,11,0.25); }
  50% { box-shadow: 0 8px 30px rgba(245,158,11,0.45); }
}

.order-alert-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.alert-ring-icon {
  font-size: 24px;
  animation: ring-swing 1s infinite;
  transform-origin: center top;
}

@keyframes ring-swing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-15deg); }
}

.order-alert-btn {
  background: white;
  color: var(--warning);
  border: none;
  padding: 8px 18px;
  border-radius: 30px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.order-alert-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(255,255,255,0.3); }

/* ── Order Cards & Stream ────────────────────────────────────── */
.orders-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--surface-hover);
  padding: 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.filter-tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  color: var(--text-secondary);
}

.filter-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: all 0.25s ease;
}

.order-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(148, 163, 184, 0.4);
}

.order-card-header {
  padding: 16px 20px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-title {
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-vip-badge {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge.pending { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-badge.accepted { background: rgba(59,130,246,0.1); color: var(--info); }
.status-badge.preparing { background: rgba(139,92,246,0.1); color: var(--purple); }
.status-badge.ready_for_pickup { background: rgba(16,185,129,0.1); color: var(--success); }
.status-badge.delivered { background: rgba(16,185,129,0.15); color: var(--success); }
.status-badge.cancelled { background: rgba(239,68,68,0.1); color: var(--danger); }

.order-card-body {
  padding: 20px;
}

.order-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.order-info-row span.icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.order-items-list {
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 16px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 1px dashed var(--border);
}

.order-item-row:last-child {
  border-bottom: none;
}

.order-notes {
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: #B45309;
  margin-top: 12px;
  font-weight: 600;
}

.order-card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-total-price {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary-dark);
}

.order-total-price span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.order-actions {
  display: flex;
  gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(118,200,47,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(118,200,47,0.4); }

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 14px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,185,129,0.4); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── Product Grid ────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.product-img-wrapper {
  height: 160px;
  background: rgba(118,200,47,0.06);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.product-img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.product-placeholder {
  font-size: 54px;
}

.product-badge-cat {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(15,23,42,0.7);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.product-card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-title {
  font-size: 15.5px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.product-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.product-price {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary-dark);
}

.product-price span {
  font-size: 11px;
  color: var(--text-hint);
  font-weight: 600;
}

/* ── Modal / Dialog ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 500px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-hover);
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-hover);
}

/* ── Form Fields ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  background: var(--bg);
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(118,200,47,0.15);
}

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

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: inline-block;
  opacity: 0.5;
}

.empty-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}

/* ── Receipts Printing styles ────────────────────────────────── */
@media print {
  body * { visibility: hidden; }
  .print-section, .print-section * { visibility: visible; }
  .print-section { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ── Responsive breakpoints ──────────────────────────────────── */
@media (max-width: 868px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0;
  }
  .menu-toggle {
    display: block;
  }
  .topbar {
    padding: 0 20px;
  }
  .page-container {
    padding: 20px;
  }
}
