/* 44 STUFF – Lua Menu Customizer (Premium Glassmorphism Redesign) */

/* ── Layout ─────────────────────────────────────────────── */
.lua-layout { display: flex; flex: 1; min-height: calc(100vh - 56px); animation: fadeInUp .4s ease; }

.lua-sidebar {
  width: 340px;
  min-width: 340px;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(16px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}
.lua-sidebar::-webkit-scrollbar { width: 5px; }
.lua-sidebar::-webkit-scrollbar-track { background: transparent; }
.lua-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.lua-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 28px; gap: 28px; }

@media (max-width: 900px) {
  .lua-layout { flex-direction: column; }
  .lua-sidebar { width: 100%; min-width: 0; max-height: none; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Sidebar Sections ───────────────────────────────────── */
.lua-sidebar h2 {
  font-size: 11px;
  margin-bottom: 14px;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lua-sidebar h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(229,37,33,.2), transparent);
}

.lua-sidebar .opt-group {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .2s ease;
}
.lua-sidebar .opt-group:last-of-type { border-bottom: none; }

/* ── Form Elements ──────────────────────────────────────── */
.lua-sidebar label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.lua-sidebar .field { margin-bottom: 16px; }
.lua-sidebar .field:last-child { margin-bottom: 0; }

.lua-sidebar input[type="text"],
.lua-sidebar input[type="number"],
.lua-sidebar input[type="url"],
.lua-sidebar select {
  width: 100%;
  margin-bottom: 0;
  padding: 10px 12px;
  font-size: 13px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  transition: all .2s ease;
}
.lua-sidebar input:focus,
.lua-sidebar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229,37,33,.08);
  background: rgba(0,0,0,.35);
}

.lua-sidebar .hint {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 6px;
  margin-bottom: 0;
  line-height: 1.5;
  padding-left: 2px;
}

/* ── Color Grid ─────────────────────────────────────────── */
.lua-sidebar .color-grid {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
}
.lua-sidebar .color-grid input[type="color"] {
  width: 38px;
  height: 32px;
  padding: 3px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(0,0,0,.2);
  transition: border-color .2s ease;
}
.lua-sidebar .color-grid input[type="color"]:hover { border-color: var(--primary); }
.lua-sidebar .color-grid input[type="text"].rgba {
  font-size: 11px;
  padding: 7px 10px;
  background: rgba(0,0,0,.25);
  border-radius: 8px;
}
.lua-sidebar .color-grid + label {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 12px;
  margin-top: -4px;
}

/* ── Keybind Button ─────────────────────────────────────── */
.lua-keybind-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}
.lua-keybind-btn:hover {
  border-color: var(--primary);
  background: rgba(229,37,33,.06);
  box-shadow: 0 0 20px rgba(229,37,33,.08);
}
.lua-keybind-btn i { color: var(--primary); font-size: 16px; }

/* ── Keybind Overlay ────────────────────────────────────── */
.lua-keybind-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
}
.lua-keybind-overlay.active { display: flex; }
.lua-keybind-popup {
  text-align: center;
  padding: 40px 48px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--glass-blur));
  animation: fadeInUp .25s ease;
}
.lua-keybind-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: linear-gradient(135deg, rgba(229,37,33,.15), rgba(229,37,33,.05));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 30px rgba(229,37,33,.1);
}
.lua-keybind-icon i { font-size: 28px; color: var(--primary); animation: pulse-glow 2s ease-in-out infinite; }
.lua-keybind-popup h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.lua-keybind-popup p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ── Items List (Menu Items + Triggers) ─────────────────── */
.items-list { margin-top: 14px; }

.item-row {
  display: grid;
  grid-template-columns: 22px 1fr 110px 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 8px;
  transition: background .15s ease;
}
.item-row:hover { background: rgba(255,255,255,.02); }
.item-row[draggable="true"] { cursor: grab; }
.item-row.dragging { opacity: 0.55; }

.drag-handle {
  width: 22px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 6px;
  background: rgba(0,0,0,.2);
  color: var(--text-dim);
  user-select: none;
  transition: all .15s ease;
}
.drag-handle:hover { border-color: var(--primary); color: var(--primary); }
.drag-handle:active { cursor: grabbing; }

.item-row input { min-width: 0; padding: 9px 11px; font-size: 13px; margin-bottom: 0; border-radius: 8px; }
.item-row select { padding: 9px 11px; font-size: 12px; border-radius: 8px; }
.item-row .btn-remove {
  width: 36px; height: 36px; padding: 0;
  color: var(--text-dim);
  background: rgba(0,0,0,.15);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
}
.item-row .btn-remove:hover { color: var(--danger); background: rgba(229,37,33,.08); border-color: rgba(229,37,33,.2); }

/* ── Trigger Rows ───────────────────────────────────────── */
.trigger-row {
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(0,0,0,.2);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.05);
  transition: all .2s ease;
}
.trigger-row:hover { border-color: rgba(255,255,255,.08); background: rgba(0,0,0,.25); }
.trigger-row[draggable="true"] { cursor: grab; }
.trigger-row.dragging { opacity: 0.55; }

.trigger-row .trigger-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.trigger-row .trigger-row-head .drag-handle { flex-shrink: 0; width: 32px; height: 38px; }
.trigger-row .trigger-row-head input {
  flex: 1; min-width: 0;
  padding: 9px 12px; font-size: 13px;
  height: 38px; box-sizing: border-box;
  border-radius: 8px; margin-bottom: 0;
}
.trigger-row .trigger-row-head .btn-remove { flex-shrink: 0; width: 38px; height: 38px; padding: 0; }

.trigger-row label.trigger-label {
  font-size: 10px; color: var(--text-dim);
  margin-bottom: 4px; margin-top: 8px;
  display: block; text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600;
}
.trigger-row .trigger-code {
  width: 100%;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  min-height: 52px;
  resize: vertical;
  margin-bottom: 0;
  box-sizing: border-box;
  border-radius: 8px;
  background: rgba(0,0,0,.3);
}
.trigger-row .btn-remove {
  padding: 8px; color: var(--text-dim);
  background: rgba(0,0,0,.15);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
}
.trigger-row .btn-remove:hover { color: var(--danger); background: rgba(229,37,33,.08); border-color: rgba(229,37,33,.2); }

.trigger-hint { margin-top: 8px; font-size: 10.5px; color: var(--text-dim); line-height: 1.5; }

.btn-add-item {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 13px;
  background: rgba(0,0,0,.15);
  border: 1px dashed rgba(255,255,255,.08);
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .25s ease;
}
.btn-add-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(229,37,33,.04);
}

/* ── Preview Area ───────────────────────────────────────── */
.preview-area {
  background:
    radial-gradient(ellipse at top, rgba(229,37,33,.1), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(4,156,216,.06), transparent 50%),
    rgba(12,12,14,.8);
  border-radius: 16px;
  padding: 36px;
  min-height: 420px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 16px 48px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.03);
  position: relative;
  margin-bottom: 0;
}

.menu-preview {
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  overflow: hidden;
  transition: width 0.2s ease, border-radius 0.2s ease;
  cursor: pointer;
}
.menu-preview .logo-bar { height: 80px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: rgba(255,255,255,.5); overflow: hidden; position: relative; }
.menu-preview .logo-bar img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-preview .logo-bar > span { position: relative; z-index: 1; }
.menu-preview .title-bar { padding: 8px 14px; font-weight: 600; font-size: 14px; text-align: center; border-bottom: 2px solid; }
.menu-preview .item { padding: 8px 14px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.05); transition: background .1s ease; }
.menu-preview .item:hover { filter: brightness(1.05); }
.menu-preview .item.separator { justify-content: center; padding: 6px; color: rgba(255,255,255,.4); font-size: 11px; pointer-events: none; }
.menu-preview .item.label-only { color: rgba(255,255,255,.5); pointer-events: none; }
.menu-preview .item .arrow { opacity: .7; }
.menu-preview .footer-bar { padding: 6px 14px; font-size: 11px; color: rgba(255,255,255,.45); display: flex; justify-content: space-between; }

/* ── Toasts ─────────────────────────────────────────────── */
.lua-toasts { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; flex-direction: column-reverse; gap: 8px; max-width: 90%; pointer-events: none; }
.lua-toast {
  padding: 10px 16px; font-size: 12px;
  border-radius: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
}
.lua-toast.success { border-left-color: var(--success); }
.lua-toast.warning { border-left-color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Generate Button ────────────────────────────────────── */
.gen-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.gen-actions button {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  font-size: 14px;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}
.btn-generate {
  background: linear-gradient(135deg, var(--primary), #c41e1b);
  color: #fff;
  box-shadow: 0 4px 16px rgba(229,37,33,.3);
}
.btn-generate:hover {
  background: linear-gradient(135deg, #ff4b47, var(--primary));
  box-shadow: 0 6px 24px rgba(229,37,33,.4);
  transform: translateY(-2px);
}

/* ── Output Area ────────────────────────────────────────── */
.output-area {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  width: 100%;
  backdrop-filter: blur(12px);
}
.output-area .output-placeholder {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  background: linear-gradient(to right, rgba(229,37,33,.12), transparent);
}
.output-header-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.output-header-title i { color: var(--primary); }
.output-header .btn-copy {
  padding: 7px 14px; border-radius: 8px;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 12px; font-weight: 500;
  transition: all .2s ease;
}
.output-header .btn-copy:hover { background: rgba(0,0,0,.3); border-color: var(--primary); color: var(--primary); }

/* ── Code Output ────────────────────────────────────────── */
.output-code-wrap {
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 420px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}
.output-code-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.output-code-table td { vertical-align: top; padding: 0; }
.output-code-table td.ln {
  width: 4em; min-width: 4em;
  padding: 2px 12px 2px 16px;
  text-align: right; color: var(--text-dim);
  user-select: none;
  background: rgba(0,0,0,.2);
  border-right: 1px solid rgba(255,255,255,.04);
  white-space: nowrap;
}
.output-code-table td.code { padding: 2px 16px 2px 12px; overflow-wrap: break-word; word-break: break-all; }
.output-code-body {
  margin: 0; padding: 0;
  font-family: inherit; font-size: inherit; line-height: inherit;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Context Menu ───────────────────────────────────────── */
.lua-context-menu {
  position: fixed; z-index: 400;
  min-width: 180px; padding: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}
.lua-context-menu button {
  display: block; width: 100%;
  padding: 9px 14px; text-align: left;
  font-size: 13px; border: none; background: none;
  color: var(--text); cursor: pointer;
  border-radius: 6px;
  transition: background .15s ease;
}
.lua-context-menu button:hover { background: rgba(255,255,255,.05); }
.lua-context-menu .ctx-sep { height: 1px; background: rgba(255,255,255,.04); margin: 4px 6px; }
.lua-context-menu button.danger { color: var(--danger); }
.lua-context-menu button.danger:hover { background: rgba(229,37,33,.08); }
