/* =============================================================================
   EZGatherr — Order Punching UI
   Scoped under .op-page to avoid conflicts with other pages.
   ============================================================================= */

/* ---------- Design Tokens ---------- */
.op-page {
  --op-purple:        #3E1268;
  --op-purple-hover:  #5A1E96;
  --op-red:           #FF3B30;
  --op-red-dark:      #E03030;
  --op-coral:         #FF6F61;
  --op-green:         #0EB559;
  --op-ink:           #000000;
  --op-fg-1:          #111111;
  --op-fg-2:          #333333;
  --op-fg-3:          #444444;
  --op-fg-4:          #666666;
  --op-fg-5:          #999999;
  --op-line:          #EEEEEE;
  --op-line-2:        #E0D6F0;
  --op-bg:            #FFFFFF;
  --op-bg-page:       #F9F5FC;
  --op-bg-value:      #F7F0FC;
  --op-shadow-card:   0 2px 16px rgba(62,18,104,0.06);
  --op-shadow-btn:    0 4px 7.1px 0 rgba(255,255,255,0.50) inset;
  --op-radius-pill:   40px;
  --op-font-display:  'DM Sans', system-ui, sans-serif;
  --op-font-body:     'DM Sans', system-ui, sans-serif;
  --op-dur:           0.25s;
  --op-ease:          cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Page Shell ---------- */
.op-page {
  background: var(--op-bg-page);
  min-height: calc(100vh - 64px);
  padding: 28px 24px 84px;
  font-family: var(--op-font-body);
  -webkit-font-smoothing: antialiased;
}

.op-page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 4px 28px;
  flex-wrap: wrap;
}

.op-page-title-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.op-page-title {
  font-family: var(--op-font-display);
  font-style: normal;le: normal;
  font-weight: 700;
  font-size: clamp(28px, 3vw, 40px);
  color: var(--op-fg-1);
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0;
}

.op-page-title .op-crumb {
  font-family: var(--op-font-body);
  font-style: normal;
  font-weight: 500;
  font-size: 14px;
  color: var(--op-fg-5);
  margin-right: 12px;
  letter-spacing: 0;
}

.op-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 12px;
  background: var(--op-bg-value);
  color: var(--op-purple);
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.op-draft-pill {
  margin-right: 2px;
}

.op-status-pill .op-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--op-purple);
}

/* ---------- Layout Grid ---------- */
.op-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: stretch;
  width: 100%;
  max-width: none;
}

.op-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: start;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  overflow-x: visible;
  position: sticky;
  position: -webkit-sticky;
  top: 122px;
  padding-right: 4px;
}

.op-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  align-self: start;
}

/* ---------- Cards ---------- */
.op-card {
  background: var(--op-bg);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--op-shadow-card);
}

.op-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.op-card__title {
  font-family: var(--op-font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.3px;
  color: var(--op-fg-1);
  line-height: 1.1;
  margin: 0;
}

.op-card__sub {
  font-size: 11px;
  color: var(--op-fg-5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.op-card__id {
  font-size: 20px;
  font-weight: 700;
  color: var(--op-purple);
  letter-spacing: -0.3px;
}

.op-section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--op-coral);
  margin-bottom: 4px;
}

.op-section-tag .op-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--op-coral);
}

/* ---------- Summary Rail Card ---------- */
.op-summary {
  background: var(--op-bg);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--op-shadow-card);
  z-index: 2;
}

.op-summary__head {
  font-family: var(--op-font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--op-fg-1);
}

.op-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
  color: var(--op-fg-3);
}

.op-summary__row .lbl { color: var(--op-fg-4); }
.op-summary__row .val { font-weight: 500; color: var(--op-fg-1); }
.op-summary__row--discount .val { color: var(--op-red); }
.op-summary__row--bold .lbl,
.op-summary__row--bold .val { font-weight: 700; color: var(--op-fg-1); }

.op-summary__divider {
  border: none;
  border-top: 1px dashed var(--op-line);
  margin: 2px 0;
}

.op-summary__total {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--op-bg-value);
  border-radius: 18px;
}

.op-summary__total .lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--op-purple);
}

.op-summary__total .val {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--op-fg-1);
  letter-spacing: -0.6px;
  margin-top: 4px;
}

.op-summary__balance {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--op-fg-5);
  margin-top: 8px;
}

.op-summary__balance .balance-val { color: var(--op-red); font-weight: 600; }
.op-summary__balance .paid-val { color: var(--op-green); font-weight: 600; }

.op-summary__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Add-ons Rail Card ---------- */
.op-addons-card {
  background: var(--op-bg);
  border-radius: 28px;
  padding: 16px 18px;
  box-shadow: var(--op-shadow-card);
  position: static;
  margin-bottom: 2px;
}

.op-addons-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.op-addons-card__title {
  font-family: var(--op-font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 18px;
  color: var(--op-fg-1);
}

.op-addon-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--op-bg-page);
  border-radius: 14px;
  margin-bottom: 6px;
  font-size: 13px;
}

.op-addon-row:last-child { margin-bottom: 0; }

.op-addon-row .addon-name {
  flex: 1;
  color: var(--op-fg-2);
  font-weight: 500;
}

.op-addon-row .addon-price {
  font-weight: 700;
  color: var(--op-fg-1);
}

.op-addon-empty {
  font-size: 13px;
  color: var(--op-fg-5);
  text-align: center;
  padding: 12px 0;
}

/* ---------- Buttons ---------- */
.op-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--op-radius-pill);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--op-font-body);
  letter-spacing: -0.1px;
  transition: all var(--op-dur) var(--op-ease);
  cursor: pointer;
  border: none;
  text-transform: none;
  width: 100%;
}

.op-btn--solid {
  background: var(--op-purple);
  color: #fff;
  box-shadow: var(--op-shadow-btn);
}
.op-btn--solid:hover { background: var(--op-purple-hover, #5A1E96); box-shadow: none; }

.op-btn--outline {
  background: #fff;
  border: 1.5px solid var(--op-purple);
  color: var(--op-purple);
}
.op-btn--outline:hover { background: var(--op-bg-value); }

.op-btn--ghost {
  background: transparent;
  color: var(--op-purple);
}
.op-btn--ghost:hover { background: var(--op-bg-value); }

.op-btn--danger {
  background: var(--op-red);
  color: #fff;
  box-shadow: var(--op-shadow-btn);
}
.op-btn--danger:hover { background: var(--op-red-dark); box-shadow: none; }

.op-btn--sm { height: 36px; padding: 0 14px; font-size: 13px; width: auto; }

/* ---------- Section: Guests Composite Input ---------- */
.op-guests-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.op-guests-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--op-bg-value);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--op-purple);
}

/* ---------- Payment Stat Cards ---------- */
.op-pay-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border-radius: 22px;
  border: 1px solid var(--op-line);
  box-shadow: 0 6px 18px rgba(62, 18, 104, 0.04);
}

.op-pay-stat .ic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--op-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.op-pay-stat .lbl {
  font-size: 11px;
  color: var(--op-fg-5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.op-pay-stat .val {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* FIX: Ensure green stat card is outlined (not filled) */
.op-pay-stat.green { 
  border-left: 4px solid var(--op-green);
  background: #fff !important;
  border: 1px solid var(--op-line) !important;
  border-left: 4px solid var(--op-green) !important;
}

.op-pay-stat.green .ic { 
  color: var(--op-green);
  background: rgba(14, 181, 89, 0.08);
}

.op-pay-stat.green .val { 
  color: var(--op-green);
}

/* FIX: Ensure red stat card is outlined (not filled) */
.op-pay-stat.red { 
  border-left: 4px solid var(--op-red);
  background: #fff !important;
  border: 1px solid var(--op-line) !important;
  border-left: 4px solid var(--op-red) !important;
}

.op-pay-stat.red .ic { 
  color: var(--op-red);
  background: rgba(255, 59, 48, 0.08);
}

.op-pay-stat.red .val { 
  color: var(--op-red);
}
/* ---------- Upload Zone ---------- */
.op-upload {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--op-bg-page);
  border-radius: 18px;
  border: 1px dashed var(--op-line-2);
}

.op-upload .ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--op-purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.op-upload .lbl { flex: 1; font-size: 13px; color: var(--op-fg-4); }
.op-upload .lbl b { display: block; color: var(--op-fg-2); font-weight: 600; font-size: 14px; }

/* ---------- Validation + error rows ---------- */
.op-errors {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.op-error-text { color: var(--op-red); font-size: 13px; }

/* ---------- Actions row (bottom of payment card) ---------- */
.op-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

/* ---------- Post-save action chips (View / WhatsApp / Email) ---------- */
.op-post-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* ---------- MudBlazor Overrides within .op-page ---------- */

/* Pill-shaped outlined inputs */
.op-page .mud-input-outlined fieldset.mud-input-outlined-border {
  border-radius: var(--op-radius-pill) !important;
  border-color: var(--op-line) !important;
  transition: border-color var(--op-dur), box-shadow var(--op-dur);
}

.op-page .mud-input-outlined.mud-focused fieldset.mud-input-outlined-border {
  border-color: var(--op-purple) !important;
  box-shadow: 0 0 0 4px rgba(62,18,104,0.08) !important;
}

.op-page .mud-input-outlined .mud-input-slot {
  padding-left: 22px !important;
  padding-right: 22px !important;
}

.op-page .mud-input-outlined .mud-input {
  padding-left: 22px !important;
  padding-right: 22px !important;
}

/* Label color */
.op-page .mud-input-label {
  color: var(--op-fg-4) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

/* Select arrow icon */
.op-page .mud-select-input .mud-input-adornment {
  padding-right: 12px;
}

/* NumericField */
.op-page .mud-numeric-field .mud-input-outlined fieldset.mud-input-outlined-border {
  border-radius: var(--op-radius-pill) !important;
}

/* Textarea keep rounded rect shape */
.op-page .mud-input-outlined.mud-multiline fieldset.mud-input-outlined-border {
  border-radius: 22px !important;
}

/* Pill-shaped date pickers */
.op-page .mud-picker .mud-input-outlined fieldset.mud-input-outlined-border {
  border-radius: var(--op-radius-pill) !important;
}

/* MudButton text transform */
.op-page .mud-button-root { text-transform: none !important; }

/* MudSwitch label color */
.op-page .mud-switch-label { color: var(--op-fg-3) !important; font-size: 13px !important; font-weight: 500 !important; }

/* ---------- Form Elements ---------- */
.op-field-label {
  display: block;
  font-size: 13px;
  color: var(--op-fg-4);
  margin-bottom: 8px;
  font-weight: 500;
}

.op-field-input,
.op-field-select {
  width: 100%;
  height: 52px;
  border-radius: var(--op-radius-pill);
  border: 1px solid var(--op-line);
  background: #fff;
  padding: 0 22px;
  font-size: 14px;
  color: var(--op-fg-1);
  outline: none;
  transition: border-color var(--op-dur), box-shadow var(--op-dur);
  font-weight: 500;
  appearance: none;
  font-family: inherit;
}

.op-field-input::placeholder {
  color: var(--op-fg-5);
  font-weight: 400;
}

.op-field-input:focus,
.op-field-select:focus {
  border-color: var(--op-purple);
  box-shadow: 0 0 0 4px rgba(62, 18, 104, 0.08);
}

.op-field-input:disabled {
  background: var(--op-bg-page);
  color: var(--op-fg-3);
}

.op-field-select {
  padding-right: 48px;
  cursor: pointer;
}

.op-field-select::-ms-expand {
  display: none;
}

.op-field-textarea {
  width: 100%;
  min-height: 96px;
  border-radius: 22px;
  border: 1px solid var(--op-line);
  background: #fff;
  padding: 16px 22px;
  font-size: 14px;
  color: var(--op-fg-1);
  outline: none;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color var(--op-dur), box-shadow var(--op-dur);
}

.op-field-textarea:focus {
  border-color: var(--op-purple);
  box-shadow: 0 0 0 4px rgba(62, 18, 104, 0.08);
}

/* ---------- Grid Layouts ---------- */
.op-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.op-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px 20px; }

/* ---------- Customer Add Button ---------- */
.op-customer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.op-customer-row .op-field {
  flex: 1;
}

.op-add-customer-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--op-purple);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--op-shadow-btn);
  flex-shrink: 0;
  transition: background var(--op-dur);
  border: none;
  cursor: pointer;
}

.op-add-customer-btn:hover {
  background: var(--op-purple-hover);
  box-shadow: none;
}

/* ---------- Modal Backdrop & Drawer ---------- */
.op-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 10, 58, 0.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  animation: opFadeIn 0.25s var(--op-ease);
}

.op-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 560px;
  max-width: 100vw;
  background: var(--op-bg-page);
  box-shadow: -12px 0 32px rgba(34, 10, 58, 0.18);
  z-index: 2001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: opSlideIn 0.32s var(--op-ease);
}

.op-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  background: #fff;
  border-bottom: 1px solid var(--op-line);
}

.op-drawer__head h2 {
  margin: 0;
  font-family: var(--op-font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.3px;
}

.op-drawer__head .op-sub {
  font-size: 12px;
  color: var(--op-fg-5);
  margin-top: 4px;
}

.op-drawer__close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--op-bg-page);
  color: var(--op-fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--op-dur);
}

.op-drawer__close:hover {
  background: var(--op-bg-value);
  color: var(--op-purple);
}

.op-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.op-drawer__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 18px 28px;
  background: #fff;
  border-top: 1px solid var(--op-line);
}

/* ---------- Form Section (inside drawer) ---------- */
.op-form-section {
  background: #fff;
  border-radius: 22px;
  padding: 22px;
}

.op-form-section__title {
  font-family: var(--op-font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.op-form-section__tag {
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--op-coral);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 111, 97, 0.1);
}

/* ---------- Inline Checkbox ---------- */
.op-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--op-fg-4);
  cursor: pointer;
  margin-top: 8px;
  user-select: none;
}

.op-inline-check input {
  display: none;
}

.op-inline-check .op-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--op-line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--op-dur);
}

.op-inline-check input:checked + .op-box {
  background: var(--op-purple);
  border-color: var(--op-purple);
}

.op-inline-check input:checked + .op-box::after {
  content: "";
  width: 4px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ---------- Animations ---------- */
@keyframes opFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes opSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .op-layout { grid-template-columns: 1fr; }
  .op-rail {
    position: static;
    top: auto;
    left: auto;
    width: auto;
    overflow: visible;
  }

  .op-addons-card {
    position: static;
    top: auto;
  }
}

@media (min-width: 1101px) {
  .op-summary {
    z-index: 12;
  }
}

@media (max-width: 720px) {
  .op-page { padding: 16px 16px 64px; }
  .op-card { padding: 20px; border-radius: 20px; }
  .op-page-title { font-size: 26px; }
  .op-summary { border-radius: 20px; padding: 20px; }
  .op-grid-2, .op-grid-3 { grid-template-columns: 1fr; }
  .op-drawer { width: 100%; }
}
