/**
 * Daftardar Live Demo Widget Stylesheet (v1.1.0)
 * Includes Local @font-face for the 6 Arabic-subset Webfonts (Zero CDN Dependency)
 * Brand Identity: Navy (#0c2340), Gold (#d4af37), Cream (#faf7f0), Sand (#f1e9d2)
 */

/* ==========================================================================
   1. Local Webfonts Definition (woff2 Arabic Subset)
   ========================================================================== */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/cairo.woff2') format('woff2');
}

@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/amiri.woff2') format('woff2');
}

@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/almarai.woff2') format('woff2');
}

@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/tajawal.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Naskh Arabic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/noto-naskh.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/ibm-plex-mono.woff2') format('woff2');
}

/* ==========================================================================
   2. Main Demo Container
   ========================================================================== */
.daftardar-live-demo-widget {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: #faf7f0;
  border: 1.5px solid #f1e9d2;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 10px 35px rgba(12, 35, 64, 0.05);
  max-width: 1040px;
  margin: 30px auto;
  color: #0c2340;
  box-sizing: border-box;
  position: relative;
}

.daftardar-live-demo-widget * {
  box-sizing: border-box;
}

/* Header Area */
.demo-header {
  text-align: center;
  margin-bottom: 22px;
}

.demo-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0c2340;
  color: #d4af37;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 800;
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin-bottom: 12px;
}

.demo-badge-pill .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.demo-title {
  color: #0c2340;
  font-size: 26px;
  font-weight: 900;
  margin: 4px 0 8px;
}

.demo-desc {
  color: #475569;
  font-size: 14.5px;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Form Controls Grid */
.demo-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.demo-group label {
  display: block;
  font-weight: 800;
  font-size: 13.5px;
  color: #0c2340;
  margin-bottom: 6px;
}

.demo-input,
.demo-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d8cdb4;
  border-radius: 8px;
  font-family: 'Cairo', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  background: #ffffff;
  color: #0c2340;
  min-height: 44px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.demo-input:focus,
.demo-select:focus {
  border-color: #0c2340;
  box-shadow: 0 0 0 3px rgba(12, 35, 64, 0.1);
}

.demo-amount-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #d8cdb4;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.demo-amount-wrap .demo-input {
  border: none;
  font-family: 'IBM Plex Mono', monospace, sans-serif;
  font-size: 16px;
  font-weight: 800;
}

.demo-cur-tag {
  padding: 0 12px;
  background: #f8fafc;
  color: #0c2340;
  font-weight: 800;
  font-size: 13.5px;
  border-right: 1px solid #d8cdb4;
  display: flex;
  align-items: center;
  min-height: 44px;
}

/* Secondary Options Accordion */
.demo-accordion {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 18px;
  overflow: hidden;
}

.demo-accordion-toggle {
  width: 100%;
  background: #ffffff;
  border: none;
  padding: 12px 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  font-weight: 800;
  color: #0c2340;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: right;
}

.demo-accordion-content {
  padding: 14px 16px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.demo-options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.demo-currencies-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.demo-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #0c2340;
  cursor: pointer;
}

.demo-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #0c2340;
  cursor: pointer;
}

/* Appearance Panel (Mode Full / Demo Page) */
.demo-appearance-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: center;
}

.demo-appearance-panel label {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  display: block;
  margin-bottom: 4px;
}

/* Cheque Canvas Area */
.demo-preview-card {
  background: #fdfbf7;
  border: 1.5px solid #d8cdb4;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
}

.demo-canvas-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-badge-bank {
  background: #0c2340;
  color: #f3c94f;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
}

.demo-badge-dims {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.demo-hint-msg {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 700;
}

.demo-scale-board {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  display: block;
  overflow: hidden;
  position: relative;
  transition: height 0.15s ease-out;
  touch-action: pan-y pinch-zoom;
}

.demo-scale-board.mode-natural-1to1 {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.demo-cheque-canvas {
  position: absolute;
  top: 0;
  left: 0;
  background-color: #ffffff;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transform-origin: top left;
  user-select: none;
  -webkit-user-select: none;
}

/* Watermark DEMO */
.demo-watermark-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 42px;
  font-weight: 900;
  color: rgba(12, 35, 64, 0.08);
  letter-spacing: 6px;
  pointer-events: none;
  white-space: nowrap;
}

/* Canvas Draggable Fields */
.demo-canvas-field {
  position: absolute;
  font-family: 'Cairo', sans-serif;
  color: #000000;
  font-weight: 800;
  cursor: grab;
  touch-action: none;
  outline: none;
}

.demo-canvas-field:active,
.demo-canvas-field.selected {
  cursor: grabbing;
  outline: 1.5px dashed #d4af37;
  outline-offset: 2px;
  border-radius: 2px;
  background: rgba(212, 175, 55, 0.08);
}

.demo-field-date {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: right;
}

.demo-field-bearer {
  border-bottom: 2.5px solid #b91c1c;
  height: 12px;
  pointer-events: none;
  display: none;
}

.demo-field-name {
  font-size: 16px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tafqeet field with Auto-Shrink & Overflow prevention */
.demo-field-words {
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.45;
  text-align: right;
  word-wrap: break-word;
  overflow: hidden;
}

.demo-field-words.field-overflow-warning {
  border-bottom: 2px dashed #f59e0b;
}

.demo-field-amount {
  font-family: 'IBM Plex Mono', monospace, sans-serif;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: left;
  white-space: nowrap;
}

/* Liner field (Draggable) */
.demo-field-liner {
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: grab;
}

.demo-field-liner.double-line {
  border-left: 2.5px solid #000000;
  border-right: 2.5px solid #000000;
}

.demo-field-liner.single-line {
  border-left: 2.5px solid #000000;
  border-right: none;
}

.demo-field-liner.diagonal {
  transform: rotate(-30deg);
  width: 80px;
  height: 65px;
}

.demo-field-liner.horizontal {
  transform: none;
  height: 32px;
}

/* ============================================================
   Mobile D-Pad & Precision Calibration Toolbar
   ============================================================ */
/* 1) إخفاء اللوحة نهائياً على أجهزة سطح المكتب (min-width: 922px) */
@media (min-width: 922px) {
  .demo-dpad-toolbar {
    display: none !important;
  }
}
@media (min-width: 922px) and (pointer: fine) {
  .demo-dpad-toolbar {
    display: none !important;
  }
}

.demo-dpad-toolbar {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* زر التبديل القابل للطي (Collapsible Trigger) */
.demo-dpad-toggle-btn {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 14px;
  color: #0c2340;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.demo-dpad-toggle-btn:hover,
.demo-dpad-toggle-btn.active {
  background: #0c2340;
  color: #ffffff;
  border-color: #0c2340;
}

.demo-dpad-toggle-btn .dpad-toggle-arrow {
  font-size: 11px;
  transition: transform 0.2s ease;
}

.demo-dpad-toggle-btn.active .dpad-toggle-arrow {
  transform: rotate(180deg);
}

.demo-dpad-collapsible-body {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.demo-dpad-collapsible-body.open {
  display: flex;
}

.demo-dpad-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #475569;
  padding-bottom: 4px;
}

.demo-dpad-status strong {
  color: #0c2340;
  font-weight: 800;
}

.demo-dpad-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-dpad-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.demo-dpad-mid {
  display: flex;
  align-items: center;
  gap: 4px;
}

.demo-dpad-btn {
  width: 38px;
  height: 34px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0c2340;
  font-size: 13px;
  font-weight: 900;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s, transform 0.1s;
}

.demo-dpad-btn:active {
  background: #e2e8f0;
  transform: scale(0.95);
}

.dpad-dot {
  font-size: 8px;
  color: #94a3b8;
  padding: 0 3px;
}

.demo-dpad-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-btn-scale-toggle {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0c2340;
  padding: 7px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.demo-btn-scale-toggle:hover,
.demo-btn-scale-toggle.active {
  background: #0c2340;
  color: #ffffff;
  border-color: #0c2340;
}

.demo-field-liner .liner-custom-text {
  font-size: 8px;
  font-weight: 900;
  color: #000000;
  letter-spacing: 0.5px;
}

.demo-field-liner .liner-stripes {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 3px;
}

/* Actions & CTAs */
.demo-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.demo-btn-primary {
  background: linear-gradient(135deg, #0c2340 0%, #1e3a5f 100%);
  color: #f3c94f !important;
  font-weight: 900;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d4af37;
  box-shadow: 0 4px 14px rgba(12, 35, 64, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.demo-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(12, 35, 64, 0.28);
}

.demo-btn-secondary {
  background: #ffffff;
  color: #0c2340 !important;
  font-weight: 800;
  font-size: 14.5px;
  padding: 13px 22px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid #cbd5e1;
  transition: background 0.2s;
}

.demo-btn-secondary:hover {
  background: #f8fafc;
}

.demo-btn-print {
  background: transparent;
  color: #0c2340 !important;
  font-weight: 800;
  font-size: 14.5px;
  padding: 13px 20px;
  border-radius: 8px;
  border: 1.5px dashed #0c2340;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.demo-btn-print:hover {
  background: rgba(12, 35, 64, 0.05);
}

/* Toast Notification (After 10s interaction) */
.demo-lead-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #0c2340;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 10px;
  border: 1px solid #d4af37;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 99999;
  transform: translateY(120px);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.demo-lead-toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.demo-lead-toast a {
  background: #d4af37;
  color: #0c2340;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12.5px;
}

/* Responsive Rules for Mobile (< 768px) */
@media (max-width: 768px) {
  .daftardar-live-demo-widget {
    padding: 16px 12px;
    margin: 16px auto;
  }
  .demo-controls-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .demo-actions {
    flex-direction: column;
  }
  .demo-btn-primary,
  .demo-btn-secondary,
  .demo-btn-print {
    width: 100%;
    justify-content: center;
  }
  .demo-currencies-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }
}
