/* Scope hide utility to order-sidebar nodes only — a global `.hidden` breaks
   Chatwoot Tailwind menus (context-menu priority/labels submenus use
   `.hidden` + `:hover { display:block }`, which loses to `!important`). */
#eldalil-os-backdrop.hidden,
#eldalil-os-drawer.hidden,
#eldalil-os-toast.hidden {
  display: none !important;
}

#eldalil-order-sidebar-root {
  margin: 8px 8px 12px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff5f7 0%, #fff 100%);
  border: 2px solid #EB5F7D;
  box-shadow: 0 4px 14px rgba(235, 95, 125, 0.15);
  font-family: 'Tajawal', system-ui, sans-serif;
  direction: rtl;
}

.eldalil-os-title {
  font-size: 15px;
  font-weight: 800;
  color: #EB5F7D;
  margin: 0 0 8px;
}

.eldalil-os-sub {
  font-size: 11px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.4;
}

.eldalil-os-status {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 8px;
}

.eldalil-os-error {
  font-size: 11px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px;
  margin: 0 0 10px;
}

.eldalil-os-contact {
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 10px;
}

.eldalil-os-contact .mono {
  font-family: 'IBM Plex Mono', monospace;
  direction: ltr;
  display: inline-block;
}

.eldalil-os-btn {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.eldalil-os-btn-primary {
  background: linear-gradient(135deg, #EB5F7D, #d94f6d);
  color: #fff;
}

.eldalil-os-btn-secondary {
  background: #fff;
  color: #EB5F7D;
  border: 1px solid #fad4de;
}

.eldalil-os-btn-gold {
  background: #E8B876;
  color: #3d2f0a;
}

.eldalil-os-iframe-wrap {
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #f1e4e8;
  background: #fff;
}

.eldalil-os-iframe-wrap iframe {
  width: 100%;
  height: 420px;
  border: 0;
  display: block;
}

/* Order FAB — inline above reply composer (not fixed to viewport corner) */
.eldalil-os-fab-slot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 10px 2px;
  background: rgb(var(--n-surface-1, 255 255 255));
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  z-index: 12;
}

body.dark .eldalil-os-fab-slot {
  background: rgb(var(--n-surface-1, 30 30 30));
  border-top-color: rgba(255, 255, 255, 0.06);
}

.eldalil-os-fab-slot .eldalil-os-fab {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(235, 95, 125, 0.35);
  animation: eldalil-os-pulse 2.5s ease-in-out infinite;
}

/* Legacy: if FAB ever on body (should not happen) */
.eldalil-os-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #EB5F7D, #d94f6d);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 6px 24px rgba(235, 95, 125, 0.5);
  cursor: pointer;
  animation: eldalil-os-pulse 2.5s ease-in-out infinite;
}

.eldalil-os-fab.open {
  animation: none;
  opacity: 0.85;
}

.eldalil-os-fab-icon {
  font-size: 18px;
  line-height: 1;
}

.eldalil-os-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99998;
}

.eldalil-os-drawer-form {
  display: flex;
  flex-direction: column;
}

.eldalil-os-form-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fffafb;
}

.eldalil-os-form-wrap iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 0;
  display: block;
}

.eldalil-os-drawer-hd small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

.eldalil-os-toast {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 14px;
  background: #ecfdf5;
  color: #047857;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid #a7f3d0;
}

.eldalil-os-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 99999;
  background: #fff;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  font-family: 'Tajawal', system-ui, sans-serif;
  direction: rtl;
  display: flex;
  flex-direction: column;
}

.eldalil-os-drawer.eldalil-os-drawer-form {
  width: min(560px, 44vw);
  max-width: 640px;
}

.eldalil-os-drawer-hd {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 10px;
  padding-left: 44px;
  border-bottom: 1px solid #f1e4e8;
  background: linear-gradient(145deg, #fff5f7 0%, #fff 100%);
  color: #EB5F7D;
  font-size: 16px;
}

.eldalil-os-drawer-hd-main strong {
  display: block;
  color: #EB5F7D;
  font-size: 15px;
  margin-bottom: 2px;
}

.eldalil-os-drawer-hd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: #475569;
}

.eldalil-os-drawer-hd-meta span {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 3px 8px;
}

.eldalil-os-draft-pill {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
  font-weight: 800;
}

.eldalil-os-ad-pill {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  font-weight: 800;
  direction: ltr;
  unicode-bidi: embed;
}

.eldalil-os-ad-headline {
  background: #f0fdf4 !important;
  color: #166534 !important;
  border-color: #86efac !important;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eldalil-os-chat-link {
  background: #fff !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
  font-weight: 800;
  text-decoration: none;
}

.eldalil-os-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #047857;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.eldalil-os-fab {
  position: relative;
}

.eldalil-os-close-float {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 60;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.eldalil-os-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 24px;
}

@keyframes eldalil-os-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@media (max-width: 768px) {
  .eldalil-os-fab-slot {
    padding: 3px 8px 2px;
  }

  .eldalil-os-fab-slot .eldalil-os-fab {
    padding: 7px 12px;
    font-size: 12px;
  }

  .eldalil-os-fab-txt {
    display: inline;
  }

  .eldalil-os-drawer.eldalil-os-drawer-form {
    width: 100vw;
    max-width: 100vw;
  }

  .eldalil-os-iframe-wrap iframe {
    height: 360px;
  }
}

/* ── Dark mode ── */
body.dark #eldalil-order-sidebar-root {
  background: linear-gradient(145deg, #1e1620 0%, #1a1c1f 100%);
  border-color: rgba(235, 95, 125, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

body.dark .eldalil-os-sub,
body.dark .eldalil-os-status {
  color: #64748b;
}

body.dark .eldalil-os-contact {
  color: #cbd5e1;
}

body.dark .eldalil-os-error {
  background: rgba(180, 83, 9, 0.15);
  border-color: rgba(253, 230, 138, 0.2);
  color: #fbbf24;
}

body.dark .eldalil-os-btn-secondary {
  background: #252830;
  color: #eb5f7d;
  border-color: rgba(235, 95, 125, 0.25);
}

body.dark .eldalil-os-iframe-wrap {
  background: #1a1c1f;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark .eldalil-os-form-wrap {
  background: #1a1c1f;
}

body.dark .eldalil-os-drawer {
  background: #1a1c1f;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
}

body.dark .eldalil-os-drawer-hd {
  background: linear-gradient(145deg, #1e1620 0%, #1a1c1f 100%);
  border-bottom-color: rgba(235, 95, 125, 0.15);
}

body.dark .eldalil-os-drawer-hd small {
  color: #64748b;
}

body.dark .eldalil-os-drawer-hd-meta span {
  background: #252830;
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

body.dark .eldalil-os-toast {
  background: rgba(4, 120, 87, 0.2);
  color: #34d399;
  border-bottom-color: rgba(167, 243, 208, 0.15);
}

body.dark .eldalil-os-close-float {
  background: rgba(30, 30, 35, 0.95);
  color: #94a3b8;
}

body.dark .eldalil-os-draft-pill {
  background: rgba(4, 120, 87, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(167, 243, 208, 0.2) !important;
}

body.dark .eldalil-os-chat-link {
  background: rgba(4, 120, 87, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(167, 243, 208, 0.2) !important;
}

body.dark .eldalil-os-fab-badge {
  background: #1a1c1f;
  color: #34d399;
}
