/* ============================================================
   QR Master Plugin — Premium Stylesheet
   ============================================================ */

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

:root {
  --qrm-bg:       #0d0d0d;
  --qrm-surface:  #161616;
  --qrm-surface2: #1e1e1e;
  --qrm-border:   #2a2a2a;
  --qrm-accent:   #f0ff00;
  --qrm-accent2:  #00ffcc;
  --qrm-text:     #f0f0f0;
  --qrm-muted:    #888;
  --qrm-radius:   12px;
  --qrm-radius-sm:7px;
  --qrm-font-ar:  'Cairo', sans-serif;
  --qrm-font-en:  'Space Grotesk', sans-serif;
  --qrm-shadow:   0 8px 32px rgba(0,0,0,0.5);
  --qrm-tab-h:    42px;
}

/* ── Wrapper ── */
#qrmaster-wrap {
  font-family: var(--qrm-font-ar);
  background: var(--qrm-bg);
  border-radius: 20px;
  border: 1px solid var(--qrm-border);
  padding: 28px;
  max-width: 1000px;
  margin: 32px auto;
  box-shadow: var(--qrm-shadow);
  color: var(--qrm-text);
  direction: rtl;
}

/* ── Header ── */
.qrm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.qrm-header-icon {
  font-size: 2.2rem;
  background: var(--qrm-accent);
  color: #000;
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(240,255,0,0.3);
}
.qrm-title {
  font-size: 1.6rem;
  font-weight: 900;
  margin: 0 0 2px;
  line-height: 1.2;
}
.qrm-title span { color: var(--qrm-accent); }
.qrm-subtitle {
  font-size: 0.78rem;
  color: var(--qrm-muted);
  margin: 0;
}
.qrm-lang-toggle {
  margin-right: auto;
  background: var(--qrm-surface2);
  border: 1px solid var(--qrm-border);
  color: var(--qrm-text);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--qrm-font-en);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.qrm-lang-toggle:hover {
  background: var(--qrm-accent);
  color: #000;
  border-color: var(--qrm-accent);
}

/* ── Tabs ── */
.qrm-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  background: var(--qrm-surface);
  padding: 6px;
  border-radius: var(--qrm-radius);
  border: 1px solid var(--qrm-border);
}
.qrm-tab {
  background: none;
  border: none;
  color: var(--qrm-muted);
  padding: 8px 14px;
  border-radius: var(--qrm-radius-sm);
  cursor: pointer;
  font-family: var(--qrm-font-ar);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.qrm-tab:hover  { color: var(--qrm-text); background: var(--qrm-surface2); }
.qrm-tab.active { background: var(--qrm-accent); color: #000; box-shadow: 0 2px 12px rgba(240,255,0,0.3); }

/* ── Body Layout ── */
.qrm-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* ── Panels ── */
.qrm-panel {
  background: var(--qrm-surface);
  border-radius: var(--qrm-radius);
  border: 1px solid var(--qrm-border);
  padding: 20px;
}

/* ── Labels & Inputs ── */
.qrm-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--qrm-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.qrm-input {
  width: 100%;
  background: var(--qrm-surface2);
  border: 1px solid var(--qrm-border);
  border-radius: var(--qrm-radius-sm);
  color: var(--qrm-text);
  padding: 10px 14px;
  font-family: var(--qrm-font-ar);
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.qrm-input:focus {
  border-color: var(--qrm-accent);
  box-shadow: 0 0 0 3px rgba(240,255,0,0.12);
}
.qrm-textarea { min-height: 90px; resize: vertical; }
.qrm-input option { background: var(--qrm-surface2); }

/* ── Grid ── */
.qrm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Section Accordions ── */
.qrm-section { margin-top: 16px; border-top: 1px solid var(--qrm-border); padding-top: 14px; }
.qrm-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 4px 0;
  user-select: none;
  transition: color 0.2s;
}
.qrm-section-title:hover { color: var(--qrm-accent); }
.qrm-section-body { margin-top: 14px; }
.qrm-chevron { font-size: 0.75rem; transition: transform 0.3s; color: var(--qrm-muted); }
.qrm-chevron.up { transform: rotate(180deg); }

/* ── Color Controls ── */
.qrm-color-row { display: flex; gap: 16px; flex-wrap: wrap; }
.qrm-color-item { flex: 1; min-width: 80px; }
.qrm-color-preview-wrap { position: relative; display: inline-block; }
.qrm-color-input {
  position: absolute; opacity: 0; width: 100%; height: 100%;
  cursor: pointer; top: 0; left: 0; padding: 0; border: none;
}
.qrm-color-swatch {
  width: 48px; height: 48px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.qrm-color-swatch:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }

/* ── Presets ── */
.qrm-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.qrm-preset {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.qrm-preset:hover { transform: scale(1.15); border-color: var(--qrm-accent); }

/* ── Dot Styles ── */
.qrm-dot-styles { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.qrm-dot-btn {
  background: var(--qrm-surface2);
  border: 1px solid var(--qrm-border);
  color: var(--qrm-muted);
  width: 42px; height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.qrm-dot-btn:hover  { border-color: var(--qrm-accent); color: var(--qrm-text); }
.qrm-dot-btn.active { background: var(--qrm-accent); color: #000; border-color: var(--qrm-accent); }

/* ── Toggle ── */
.qrm-toggle { position: relative; display: inline-block; width: 44px; height: 24px; margin-top: 4px; }
.qrm-toggle input { opacity: 0; width: 0; height: 0; }
.qrm-toggle-slider {
  position: absolute; inset: 0;
  background: var(--qrm-surface2);
  border: 1px solid var(--qrm-border);
  border-radius: 24px;
  cursor: pointer;
  transition: 0.3s;
}
.qrm-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--qrm-muted);
  border-radius: 50%;
  transition: 0.3s;
}
.qrm-toggle input:checked + .qrm-toggle-slider { background: var(--qrm-accent); border-color: var(--qrm-accent); }
.qrm-toggle input:checked + .qrm-toggle-slider::before { transform: translateX(20px); background: #000; }

/* ── Range Slider ── */
.qrm-range {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--qrm-surface2);
  border-radius: 4px;
  outline: none;
  border: none;
  padding: 0;
}
.qrm-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--qrm-accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(240,255,0,0.4);
}

/* ── Logo Drop Zone ── */
.qrm-logo-drop {
  border: 2px dashed var(--qrm-border);
  border-radius: var(--qrm-radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  color: var(--qrm-muted);
  font-size: 0.85rem;
  transition: border-color 0.2s, background 0.2s;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.qrm-logo-drop:hover {
  border-color: var(--qrm-accent);
  background: rgba(240,255,0,0.03);
}

/* ── Preview Panel ── */
.qrm-panel-preview { text-align: center; }
.qrm-preview-title {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--qrm-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.qrm-canvas-wrap {
  position: relative;
  background: var(--qrm-surface2);
  border-radius: var(--qrm-radius);
  border: 1px solid var(--qrm-border);
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 16px;
  margin-bottom: 14px;
}
.qrm-canvas-placeholder { text-align: center; color: var(--qrm-muted); }
.qrm-placeholder-icon { font-size: 3rem; opacity: 0.3; }
.qrm-placeholder-icon { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:.3} 50%{opacity:.5} }

#qrmCanvas { max-width: 100%; border-radius: 8px; }

.qrm-generating { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; border-radius: var(--qrm-radius); }
.qrm-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--qrm-border);
  border-top-color: var(--qrm-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Download Row ── */
.qrm-download-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.qrm-btn {
  padding: 10px 18px;
  border-radius: var(--qrm-radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--qrm-font-ar);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
  flex: 1;
}
.qrm-btn-primary {
  background: var(--qrm-accent);
  color: #000;
  box-shadow: 0 2px 12px rgba(240,255,0,0.3);
}
.qrm-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(240,255,0,0.4); }
.qrm-btn-outline {
  background: none;
  color: var(--qrm-text);
  border: 1px solid var(--qrm-border);
}
.qrm-btn-outline:hover { border-color: var(--qrm-accent); color: var(--qrm-accent); }
.qrm-btn-danger { background: #c0392b; color: #fff; padding: 6px 12px; border: none; border-radius: var(--qrm-radius-sm); cursor: pointer; font-family: var(--qrm-font-ar); font-size: 0.8rem; }
.qrm-btn-sm { background: var(--qrm-surface2); color: var(--qrm-muted); border: 1px solid var(--qrm-border); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-family: var(--qrm-font-ar); font-size: 0.78rem; transition: all 0.2s; }
.qrm-btn-sm:hover { border-color: var(--qrm-accent); color: var(--qrm-accent); }

/* ── Info ── */
.qrm-info { font-size: 0.78rem; color: var(--qrm-muted); margin-bottom: 14px; }

/* ── History ── */
.qrm-history-wrap { text-align: right; margin-top: 18px; }
.qrm-history-list { margin-top: 10px; max-height: 200px; overflow-y: auto; }
.qrm-history-empty { color: var(--qrm-muted); font-size: 0.82rem; text-align: center; }
.qrm-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--qrm-surface2);
  border-radius: var(--qrm-radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.2s;
  font-size: 0.82rem;
  direction: ltr;
}
.qrm-history-item:hover { border-color: var(--qrm-accent); }
.qrm-history-type {
  background: var(--qrm-accent);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.qrm-history-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--qrm-muted); }

/* ── Footer ── */
.qrm-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 0.78rem;
  color: var(--qrm-muted);
  padding-top: 16px;
  border-top: 1px solid var(--qrm-border);
}
.qrm-footer-link { color: var(--qrm-accent); text-decoration: none; }
.qrm-footer-link:hover { text-decoration: underline; }

/* ── Utilities ── */
.qrm-hidden { display: none !important; }
.qrm-field-group { margin-bottom: 2px; }

/* ── Responsive ── */
@media (max-width: 700px) {
  #qrmaster-wrap { padding: 16px; }
  .qrm-body { grid-template-columns: 1fr; }
  .qrm-tabs { gap: 4px; }
  .qrm-tab { padding: 6px 10px; font-size: 0.76rem; }
  .qrm-grid2 { grid-template-columns: 1fr; }
  .qrm-color-row { gap: 10px; }
}

/* ── English mode (LTR) ── */
#qrmaster-wrap.lang-en {
  direction: ltr;
  font-family: var(--qrm-font-en);
}
#qrmaster-wrap.lang-en .qrm-input { font-family: var(--qrm-font-en); }
#qrmaster-wrap.lang-en .qrm-lang-toggle { margin-right: unset; margin-left: auto; }
#qrmaster-wrap.lang-en .qrm-history-wrap { text-align: left; }
