/*
 * MimaMenu - Live Orders (Snoonu-style)
 * Keep comments in English.
 */

.mimamenu-live-orders-page .mimamenu-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.mimamenu-live-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mimamenu-restaurant-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
}

.mimamenu-restaurant-status__label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  line-height: 1.1;
}

.mimamenu-restaurant-status__value {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mimamenu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}
.mimamenu-dot.is-red { background: #ef4444; }
.mimamenu-dot.is-green { background: #22c55e; }

/* Simple switch (matches other admin toggles) */
.mimamenu-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.mimamenu-switch input { opacity: 0; width: 0; height: 0; }
.mimamenu-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #e2e8f0;
  transition: .2s;
  border-radius: 999px;
}
.mimamenu-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.mimamenu-switch input:checked + .mimamenu-switch-slider { background: #22c55e; }
.mimamenu-switch input:checked + .mimamenu-switch-slider:before { transform: translateX(18px); }

.mimamenu-live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #eef2f7;
  border-radius: 14px;
  background: #fff;
  cursor: default;
  user-select: none;
}
.mimamenu-live-toggle__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}
.mimamenu-live-toggle.is-closed .mimamenu-live-toggle__dot { background: #ef4444; }
.mimamenu-live-toggle.is-live .mimamenu-live-toggle__dot { background: #22c55e; }
.mimamenu-live-toggle__text { font-weight: 700; color: #111827; }
.mimamenu-live-toggle.is-closed .mimamenu-live-toggle__text { color: #991b1b; }

.mimamenu-live-shell {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
}

@media (max-width: 1100px){
  .mimamenu-live-shell { grid-template-columns: 1fr; }
}

.mimamenu-live-tabs {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 12px;
}

.mimamenu-live-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border: 1px solid transparent;
  background: transparent;
  padding: 12px;
  min-height: 74px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  color: #64748b;
}
.mimamenu-live-tab.is-active {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

.mimamenu-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  margin-left: 0;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  color: #ffffff;
  background: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

#mimamenu-live-count-pending {
  background: #dc2626;
  color: #ffffff;
}

#mimamenu-live-count-preparing {
  background: #f59e0b;
  color: #ffffff;
}

#mimamenu-live-count-ready {
  background: #16a34a;
  color: #ffffff;
}

#mimamenu-live-count-out-for-delivery {
  background: #2563eb;
  color: #ffffff;
}

#mimamenu-live-count-scheduled {
  background: #334155;
  color: #ffffff;
}

.mimamenu-live-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.mimamenu-live-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
.mimamenu-live-search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
}

.mimamenu-live-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 4px;
}

.em-live-order-card {
  border: 1px solid #eef2f7;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}
.em-live-order-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.em-live-order-card.is-active {
  border-color: #2563eb;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: 0 0 0 2px rgba(37,99,235,.14), 0 10px 24px rgba(37,99,235,.10);
}

.em-live-order-top-right{
  display: flex;
  align-items: center;
  gap: 8px;
}

.em-live-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
}
.em-live-pill.status-pending{ background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.em-live-pill.status-preparing{ background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.em-live-pill.status-ready{ background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.em-live-pill.status-out_for_delivery,.em-live-pill.status-delivery_in_progress,.em-live-pill.status-on_the_way{ background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

.em-live-card-actions{
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.em-live-order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.em-live-order-id { font-weight: 900; color: #0f172a; }
.em-live-order-time { font-size: 12px; color: #64748b; }
.em-live-order-customer { margin-top: 6px; font-weight: 700; color: #111827; }
.em-live-order-sub { margin-top: 2px; font-size: 12px; color: #64748b; }
.em-live-order-total { margin-top: 8px; font-weight: 900; }

.mimamenu-live-detail-card {
  min-height: 260px;
}

.em-live-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.em-live-detail-title { font-size: 18px; font-weight: 900; margin: 0; }
.em-live-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Centered pending popup */
#em-pending-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
}

#em-pending-overlay.is-open {
  display: flex;
}

#em-pending-overlay.is-open {
  display: flex;
}

#em-pending-card {
  width: min(520px, 100%);
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  padding: 16px;
  position: relative;
}

.em-pending-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* Detail split (left actions, right details) */
.em-live-detail-grid{
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
}
@media (max-width: 1100px){
  .em-live-detail-grid{ grid-template-columns: 1fr; }
}

.em-live-actions-card{ height: fit-content; }
.em-live-actions-title{ font-weight: 900; margin-bottom: 10px; }
.em-live-actions-buttons{ display: flex; flex-direction: column; gap: 8px; }

.em-live-detail-meta{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.em-label{ display: block; font-size: 12px; color: #64748b; font-weight: 800; }
.em-value{ font-weight: 800; color: #0f172a; }

.em-live-items-wrap{ margin-top: 14px; }
.em-live-section-title{ font-weight: 900; margin-bottom: 10px; }

.em-live-item-row{
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #eef2f7;
}
.em-live-item-row:first-child{ border-top: 0; padding-top: 0; }
.em-live-item-img{ width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1px solid #e2e8f0; background: #f8fafc; }
.em-live-item-img.is-empty{ display: inline-block; }
.em-live-item-name{ font-weight: 900; color: #0f172a; }
.em-live-item-qty{ font-weight: 900; color: #0f172a; }
.em-live-item-addons{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.em-live-addon{ font-size: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; padding: 2px 8px; color: #334155; font-weight: 700; }
.em-live-item-note{ margin-top: 4px; font-size: 12px; color: #64748b; }

.em-pending-title { font-size: 16px; font-weight: 900; }
.em-pending-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.em-pending-body { margin-top: 12px; }
.em-pending-items-list { margin: 10px 0 0; padding: 0; list-style: none; }
.em-pending-item{ display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid #eef2f7; }
.em-pending-item:first-child{ border-top:0; padding-top:0; }
.em-pending-item-name{ font-weight:700; color:#111827; }
.em-pending-item-prices{ margin-left:auto; display:flex; flex-direction:column; align-items:flex-end; gap:2px; min-width:100px; }
.em-pending-item-unit{ font-size:12px; color:#64748b; }
.em-pending-item-line{ font-size:13px; font-weight:800; color:#111827; }
.em-pending-item-qty{ font-weight:800; color:#111827; background:#f3f4f6; padding:4px 10px; border-radius:999px; }
.em-pending-total { margin-top: 10px; font-weight: 900; }
.em-pending-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }


/* Item price columns (Snoonu-like) */
.em-live-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.em-live-item-main {
  flex: 1;
  min-width: 0;
}

.em-live-item-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 110px;
  color: #1f2937;
  margin-left: auto;
}

.em-live-item-unit {
  font-size: 12px;
  color: #6b7280;
}

.em-live-item-line {
  font-size: 13px;
  font-weight: 600;
}

.em-live-item-qty {
  min-width: 46px;
  text-align: right;
  font-weight: 700;
  color: #111827;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 999px;
  margin-left: 12px;
}


/* Pre-order badge (subtle pulse) */
@keyframes emPreorderBlink {
  0% { opacity: 1; }
  50% { opacity: 0.72; }
  100% { opacity: 1; }
}
.em-preorder-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fee4e2;
  border: 1px solid #fecdca;
  color: #b42318;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  
}


/* Pre-order time emphasis */
.em-preorder-time-text{color:#b42318;font-weight:700;}
.em-live-order-time.em-preorder-time{color:#b42318;font-weight:700;}


/* Pre-order highlight strip (Live Orders popup) */
.em-pending-preorder{
  margin: 6px 0 0;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:10px;
  background:#fff1f2; /* mild red */
  border:1px solid #fecdd3;
}

.em-preorder-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border-radius:999px;
  background:#fee2e2;
  border:1px solid #fecaca;
  color:#b91c1c;
  font-weight:700;
  font-size:11px;
  letter-spacing:.4px;
}

.em-preorder-time-text{
  color:#b91c1c;
  font-weight:700;
}

.em-live-order-time.em-preorder-time{
  color:#b91c1c;
  font-weight:700;
}

/* Subtle pulse so staff can notice pre-orders without being annoying */
@keyframes em-preorder-pulse{
  0%,100%{opacity:1}
  50%{opacity:.6}
}

.em-preorder-badge{
  animation: em-preorder-pulse 1.6s ease-in-out infinite;
}


/* Scheduled Orders button (Snoonu-style) */
.mimamenu-live-scheduled-bar{
  padding: 12px 14px 14px;
}
.mimamenu-live-scheduled-btn{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.mimamenu-live-scheduled-btn:hover{
  background: #f1f5f9;
  transform: translateY(-1px);
}
.mimamenu-live-scheduled-btn.is-active{
  border-color: #2563eb;
  box-shadow: 0 6px 18px rgba(37,99,235,.12);
}


/* Right panel - sectioned Snoonu-like layout */
.em-live-detail-stack{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.em-section-card{
  border: 1px solid #e8eef5;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.em-order-summary-title{
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.25;
}
.em-dot-sep{ color: #94a3b8; font-weight: 900; margin: 0 6px; }
.em-order-summary-sub{
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}


/* Order summary polish */
.em-order-summary-card{
  padding: 18px 18px;
  border-color: #e2e8f0;
}
.em-order-summary-title{
  font-size: 19px;
  letter-spacing: -0.2px;
}
.em-order-summary-sub{
  font-size: 12px;
  color: #64748b;
  font-weight: 800;
}

/* Compact key/value rows in Customer/Delivery cards */
.em-kv{ gap: 6px; }

/* Payment: make Total row prominent */
.em-pay-row-total{
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}
.em-pay-row-total .em-pay-k{
  font-size: 12px;
  color: #0f172a;
}
.em-pay-row-total .em-pay-v{
  font-size: 15px;
  font-weight: 900;
}

.em-two-col{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px){
  .em-two-col{ grid-template-columns: 1fr; }
}

.em-section-title{
  font-size: 13px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}
.em-section-title-lg{
  font-size: 15px;
  margin-bottom: 10px;
}

.em-kv{ display: flex; flex-direction: column; gap: 6px; }
.em-kv-row{
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.em-kv-row:last-child{ border-bottom: 0; padding-bottom: 0; }
.em-k{
  font-size: 12px;
  color: #64748b;
  font-weight: 900;
  white-space: nowrap;
  line-height: 1.45;
}
.em-k::after{
  content: ':';
  margin-left: 2px;
  color: inherit;
}
.em-v{
  justify-self: stretch;
  min-width: 0;
  font-size: 13px;
  color: #0f172a;
  font-weight: 800;
  text-align: left;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.em-map-link{
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 800;
  position: relative;
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
}
.em-map-link:hover{
  text-decoration: none;
}
.em-field-value-text{
  text-decoration: underline;
  text-underline-offset: 2px;
}
.em-map-value-wrap{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  width:100%;
}
.em-map-value-wrap .em-map-link{
  flex:1 1 auto;
  min-width:0;
}
.em-map-link-badge--button{
  flex:0 0 auto;
  text-decoration:none;
  white-space:nowrap;
}
.em-map-link-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.em-status-pill{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
}
.em-status-pending{ background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.em-status-preparing{ background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.em-status-ready{ background:#ecfdf5; border-color:#bbf7d0; color:#047857; }
.em-status-completed{ background:#f1f5f9; border-color:#e2e8f0; color:#334155; }
.em-status-rejected{ background:#fef2f2; border-color:#fecaca; color:#b91c1c; }

.em-items-list{ margin-top: 2px; }

/* Payment UI */
.em-pay-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 900px){
  .em-pay-grid{ grid-template-columns: 1fr; }
}

.em-pay-breakdown{
  border-top: 1px solid #eef2f7;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.em-pay-row{
  display: grid;
  grid-template-columns: 74px 1fr;
  column-gap: 6px;
  align-items: baseline;
}
.em-pay-k{
  font-size: 12px;
  color: #64748b;
  font-weight: 900;
}
.em-pay-k::after{
  content: ':';
  margin-left: 2px;
  color: inherit;
}
.em-pay-v{
  justify-self: start;
  font-size: 13px;
  color: #0f172a;
  font-weight: 900;
  text-align: left;
}
.em-pay-divider{
  height: 1px;
  background: #eef2f7;
  margin: 6px 0;
}

/* Improve readability inside right panel card */
.mimamenu-live-detail-card{
  padding: 12px;
}


.em-colon{ margin-left: 2px; color: #94a3b8; font-weight: 600; }


/* Payment status pills */
.em-pay-paid{ background:#ecfdf5; border-color:#bbf7d0; color:#047857; }
.em-pay-unpaid{ background:#fef2f2; border-color:#fecaca; color:#b91c1c; }


/* Snoonu-like add-ons layout (group title + option rows + right-aligned prices) */
.em-live-item-addons{
  display: block;
  width: 100%;
  margin-top: 6px;
}
.em-addon-group{
  display: block;
  width: 100%;
  margin-top: 8px;
}
.em-addon-group:first-child{
  margin-top: 0;
}
.em-addon-group-title{
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  margin: 2px 0 4px;
  color: #1d2327;
}
.em-addon-row{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.em-addon-choice{
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: #4b5563;
}
.em-addon-price{
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.em-kv-row[data-map-url]{
  cursor: pointer;
}
.em-kv-row[data-map-url]:hover .em-field-value-text{
  text-decoration-thickness: 2px;
}

.em-map-value-wrap{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  width:100%;
  flex-wrap:wrap;
}
.em-map-link--address{
  display:inline;
  color:#1d4ed8;
  text-decoration:underline;
  text-underline-offset:2px;
}
.em-map-link--address .em-field-value-text{
  display:inline;
}
.em-map-actions{
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
}
.em-map-link-badge--button,
.em-map-link-badge--standalone{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #bfdbfe;
  background:#eff6ff;
  color:#1d4ed8;
  font-size:12px;
  font-weight:900;
  line-height:1;
  text-decoration:none;
  white-space:nowrap;
}
.em-map-link-badge--button:hover,
.em-map-link-badge--standalone:hover{
  background:#dbeafe;
  color:#1d4ed8;
  text-decoration:none;
}


/* v1553: keep map CTA visible and on its own line */
.em-map-value-wrap{
  display:block;
}
.em-map-value-wrap .em-map-link{
  display:inline;
}
.em-map-actions{
  display:block;
  margin-top:8px;
}
.em-kv-row--location .em-v{
  align-items:flex-start;
}

.em-status-out_for_delivery,.em-status-delivery_in_progress,.em-status-on_the_way{ background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
