/* ═══════════════════════════════════════════════════
   AshvireNext Visual Editor v2.0 — Styles
   ═══════════════════════════════════════════════════ */

/* ── Enter Editor Button (floating) ── */
.editor-enter-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #7c5cfc 0%, #6347e0 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Segoe UI', 'Inter', sans-serif;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.45), 0 0 0 1px rgba(124, 92, 252, 0.2);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: 0.3px;
}
.editor-enter-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 32px rgba(124, 92, 252, 0.6), 0 0 0 1px rgba(124, 92, 252, 0.4);
}
.editor-enter-btn.visible { display: inline-flex; }

/* ── Editor Active ── */
body.editor-active { overflow-x: hidden; }
body.editor-active .page-wrapper,
body.editor-active .rules-wrapper {
  margin-right: 370px;
  transition: margin-right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Editable Block Highlights ── */
body.editor-active [data-editor-id] {
  position: relative;
  cursor: pointer;
  transition: outline 0.2s, box-shadow 0.2s;
}
body.editor-active [data-editor-id]:hover {
  outline: 2px dashed rgba(124, 92, 252, 0.5);
  outline-offset: 4px;
}
body.editor-active [data-editor-id].editor-selected {
  outline: 2px solid #7c5cfc !important;
  outline-offset: 4px;
  box-shadow: 0 0 20px rgba(124, 92, 252, 0.25);
}

/* ── Block Label Badge ── */
body.editor-active [data-editor-id]::after {
  content: attr(data-editor-label);
  position: absolute;
  top: -10px;
  left: 12px;
  background: #7c5cfc;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
  white-space: nowrap;
  font-family: 'Segoe UI', 'Inter', sans-serif;
}
body.editor-active [data-editor-id]:hover::after,
body.editor-active [data-editor-id].editor-selected::after {
  opacity: 1;
}

/* ── Drag Handle ── */
body.editor-active [data-editor-id] .editor-drag-handle {
  position: absolute;
  top: 50%;
  left: -28px;
  transform: translateY(-50%);
  width: 22px;
  height: 32px;
  background: rgba(124, 92, 252, 0.15);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 11;
  font-size: 12px;
  color: #7c5cfc;
}
body.editor-active [data-editor-id]:hover .editor-drag-handle,
body.editor-active [data-editor-id].editor-selected .editor-drag-handle {
  opacity: 1;
}
body.editor-active [data-editor-id] .editor-drag-handle:active {
  cursor: grabbing;
  background: rgba(124, 92, 252, 0.3);
}

/* ── Drag Ghost ── */
.editor-drag-ghost {
  outline: 2px dashed #7c5cfc;
  outline-offset: 4px;
  opacity: 0.4;
}
.editor-drop-indicator {
  height: 4px;
  background: #7c5cfc;
  border-radius: 2px;
  margin: 4px 0;
  box-shadow: 0 0 12px rgba(124, 92, 252, 0.5);
  animation: dropPulse 0.8s infinite;
}
@keyframes dropPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════
   EDITOR PANEL (Right Sidebar)
   ═══════════════════════════════════════ */
.editor-panel {
  position: fixed;
  top: 0;
  right: -370px;
  width: 360px;
  height: 100vh;
  background: linear-gradient(180deg, #12122a 0%, #0e0e20 100%);
  border-left: 1px solid rgba(124, 92, 252, 0.2);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', 'Inter', sans-serif;
  transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.editor-panel.open { right: 0; }

/* Panel Header */
.editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(124, 92, 252, 0.08);
  border-bottom: 1px solid rgba(124, 92, 252, 0.15);
  flex-shrink: 0;
}
.editor-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #e0e0ef;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-page-badge {
  background: rgba(124, 92, 252, 0.2);
  color: #a78bfa;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.editor-panel-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #888;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.editor-panel-close:hover {
  background: rgba(255, 68, 68, 0.15);
  border-color: rgba(255, 68, 68, 0.3);
  color: #ff6b6b;
}

/* Panel Tabs */
.editor-panel-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(124, 92, 252, 0.1);
  flex-shrink: 0;
}
.editor-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  border-bottom: 2px solid transparent;
}
.editor-tab:hover { color: #aaa; }
.editor-tab.active {
  color: #7c5cfc;
  border-bottom-color: #7c5cfc;
  background: rgba(124, 92, 252, 0.05);
}

/* Panel Actions */
.editor-panel-actions {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(124, 92, 252, 0.1);
  flex-shrink: 0;
}
.editor-action-btn {
  flex: 1;
  padding: 8px 8px;
  border-radius: 10px;
  border: 1px solid rgba(124, 92, 252, 0.2);
  background: rgba(124, 92, 252, 0.08);
  color: #ccc;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}
.editor-action-btn:hover {
  background: rgba(124, 92, 252, 0.15);
  border-color: rgba(124, 92, 252, 0.4);
  color: #fff;
}
.editor-action-btn.primary {
  background: linear-gradient(135deg, #7c5cfc 0%, #6347e0 100%);
  border-color: #7c5cfc;
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 92, 252, 0.3);
}
.editor-action-btn.primary:hover {
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.5);
  transform: translateY(-1px);
}
.editor-action-btn.danger {
  border-color: rgba(255, 68, 68, 0.2);
  color: #ff6b6b;
  background: rgba(255, 68, 68, 0.06);
}
.editor-action-btn.danger:hover {
  background: rgba(255, 68, 68, 0.15);
  border-color: rgba(255, 68, 68, 0.4);
}

/* Panel Body (scrollable) */
.editor-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 32px;
  scroll-behavior: smooth;
}
.editor-panel-body::-webkit-scrollbar { width: 5px; }
.editor-panel-body::-webkit-scrollbar-track { background: transparent; }
.editor-panel-body::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 252, 0.25);
  border-radius: 10px;
}

/* No selection */
.editor-no-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
}
.editor-no-selection-icon { font-size: 48px; opacity: 0.6; }
.editor-no-selection-text { font-size: 14px; color: #555; line-height: 1.6; }

/* ── Property Group ── */
.editor-group { margin-bottom: 16px; }
.editor-group-title {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Collapsible groups */
.editor-group-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color 0.2s;
  user-select: none;
}
.editor-group-toggle:hover { color: #999; }
.editor-toggle-arrow {
  transition: transform 0.3s;
  font-size: 14px;
}
.editor-collapsible.collapsed .editor-group-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
}
.editor-collapsible.collapsed .editor-toggle-arrow {
  transform: rotate(-90deg);
}
.editor-group-content {
  max-height: 1000px;
  overflow: visible;
  opacity: 1;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

/* ── Property Row ── */
.editor-prop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.editor-prop-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  white-space: nowrap;
  min-width: 72px;
}

/* Color Input */
.editor-color-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}
.editor-color-input {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  background: none;
  padding: 0;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
}
.editor-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.editor-color-input::-webkit-color-swatch { border: none; border-radius: 6px; }
.editor-color-input::-moz-color-swatch { border: none; border-radius: 6px; }
.editor-color-hex {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #aaa;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 5px 8px;
  width: 82px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.editor-color-hex:focus { border-color: rgba(124, 92, 252, 0.5); }

/* Range Slider */
.editor-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(124, 92, 252, 0.2);
  outline: none;
  flex: 1;
}
.editor-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cfc, #6347e0);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124, 92, 252, 0.4);
}
.editor-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cfc, #6347e0);
  cursor: pointer;
  border: none;
}
.editor-range-value {
  font-size: 11px;
  color: #aaa;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
  white-space: nowrap;
}

/* Select */
.editor-select {
  flex: 1;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ccc;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  max-width: 160px;
}
.editor-select:focus { border-color: rgba(124, 92, 252, 0.5); }
.editor-select option { background: #1a1a32; color: #ccc; }

/* Toggle Switch */
.editor-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.editor-toggle input { opacity: 0; width: 0; height: 0; }
.editor-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  transition: 0.3s;
}
.editor-toggle-slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #888;
  border-radius: 50%;
  transition: 0.3s;
}
.editor-toggle input:checked + .editor-toggle-slider {
  background: rgba(124, 92, 252, 0.4);
}
.editor-toggle input:checked + .editor-toggle-slider:before {
  transform: translateX(18px);
  background: #7c5cfc;
}

/* Align Buttons */
.editor-align-btns {
  display: flex;
  gap: 4px;
}
.editor-align-btn {
  width: 32px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #888;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.editor-align-btn:hover { border-color: rgba(124, 92, 252, 0.3); color: #ccc; }
.editor-align-btn.active {
  border-color: #7c5cfc;
  background: rgba(124, 92, 252, 0.2);
  color: #7c5cfc;
}

/* Textarea */
.editor-text-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #ddd;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.editor-text-input:focus { border-color: rgba(124, 92, 252, 0.5); }

/* ── Layers Panel ── */
.editor-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.editor-layer-item:hover {
  background: rgba(124, 92, 252, 0.08);
  border-color: rgba(124, 92, 252, 0.15);
}
.editor-layer-item.active {
  background: rgba(124, 92, 252, 0.15);
  border-color: rgba(124, 92, 252, 0.3);
}
.editor-layer-item.hidden { opacity: 0.4; }
.editor-layer-icon { font-size: 14px; flex-shrink: 0; }
.editor-layer-name {
  flex: 1;
  font-size: 12px;
  color: #ccc;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-layer-vis {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
}
.editor-layer-vis:hover { background: rgba(255, 255, 255, 0.1); }

/* ── Toast ── */
.editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, #1a1a36, #151530);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: 14px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 100000;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: 'Segoe UI', 'Inter', sans-serif;
}
.editor-toast.visible { transform: translateX(-50%) translateY(0); }
.editor-toast.success { border-color: rgba(0, 230, 118, 0.4); color: #00e676; }
.editor-toast.error { border-color: rgba(255, 68, 68, 0.4); color: #ff6b6b; }

/* ═══════════════════════════════════════
   ANIMATIONS — v2 expanded set (28 total)
   ═══════════════════════════════════════ */
@keyframes editorFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes editorFadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes editorFadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes editorSlideInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes editorSlideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes editorBounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes editorScaleIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes editorFlipIn {
  from { opacity: 0; transform: perspective(400px) rotateY(90deg); }
  to { opacity: 1; transform: perspective(400px) rotateY(0); }
}
@keyframes editorRotateIn {
  from { opacity: 0; transform: rotate(-200deg) scale(0.5); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}
@keyframes editorZoomIn {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes editorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}
@keyframes editorWobble {
  0% { transform: translateX(0); }
  15% { transform: translateX(-12px) rotate(-5deg); }
  30% { transform: translateX(10px) rotate(3deg); }
  45% { transform: translateX(-8px) rotate(-3deg); }
  60% { transform: translateX(6px) rotate(2deg); }
  75% { transform: translateX(-4px) rotate(-1deg); }
  100% { transform: translateX(0); }
}
@keyframes editorJello {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.25, 0.75); }
  40% { transform: scale(0.75, 1.25); }
  50% { transform: scale(1.15, 0.85); }
  65% { transform: scale(0.95, 1.05); }
  75% { transform: scale(1.05, 0.95); }
}
@keyframes editorRubberBand {
  0% { transform: scale(1); }
  30% { transform: scaleX(1.25) scaleY(0.75); }
  40% { transform: scaleX(0.75) scaleY(1.25); }
  50% { transform: scaleX(1.15) scaleY(0.85); }
  65% { transform: scaleX(0.95) scaleY(1.05); }
  75% { transform: scaleX(1.05) scaleY(0.95); }
  100% { transform: scale(1); }
}
@keyframes editorGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(124, 92, 252, 0.2); }
  50% { box-shadow: 0 0 25px rgba(124, 92, 252, 0.5), 0 0 50px rgba(124, 92, 252, 0.2); }
}
@keyframes editorFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes editorPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes editorSwing {
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}
@keyframes editorHeartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}
@keyframes editorFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
  75% { opacity: 0.8; }
}
@keyframes editorTypewriter {
  from { width: 0; overflow: hidden; white-space: nowrap; border-right: 2px solid #7c5cfc; }
  to { width: 100%; overflow: hidden; white-space: nowrap; border-right: 2px solid transparent; }
}
@keyframes editorNeon {
  0%, 100% {
    text-shadow: 0 0 7px rgba(124, 92, 252, 0.6), 0 0 10px rgba(124, 92, 252, 0.4), 0 0 21px rgba(124, 92, 252, 0.3);
    box-shadow: 0 0 7px rgba(124, 92, 252, 0.3), 0 0 10px rgba(124, 92, 252, 0.2);
  }
  50% {
    text-shadow: 0 0 4px rgba(124, 92, 252, 0.3), 0 0 7px rgba(124, 92, 252, 0.2);
    box-shadow: 0 0 4px rgba(124, 92, 252, 0.15);
  }
}

/* ── Mobile ── */
@media (max-width: 900px) {
  .editor-panel {
    width: 100%;
    right: -100%;
  }
  body.editor-active .page-wrapper,
  body.editor-active .rules-wrapper {
    margin-right: 0;
    margin-bottom: 60px;
  }
  .editor-enter-btn {
    bottom: 16px;
    right: 16px;
    padding: 12px 18px;
    font-size: 14px;
  }
}
