/* ==========================================================================
   GPC GOSU & BÀI TỚI CỐ ĐÔ — VISUAL LIVE EDITOR V3
   Direct In-Place All-DOM Editing, Media Manager, Fonts & 1-Click Edge Publish
   ========================================================================== */

:root {
  --ve-accent: #FF6B1A;
  --ve-accent-hover: #FF8C24;
  --ve-accent-glow: rgba(255, 107, 26, 0.42);
  --ve-cyan: #24D2FF;
  --ve-bg: rgba(9, 14, 28, 0.96);
  --ve-border: rgba(255, 152, 67, 0.48);
  --ve-text: #F4F6FA;
  --ve-muted: #9BA7BE;
}

/* ---------- Discreet Footer Admin Trigger ---------- */
.gpc-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(210, 232, 255, 0.78);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gpc-admin-link:hover {
  border-color: var(--ve-accent);
  color: #FFE49E;
  background: rgba(255, 107, 26, 0.16);
}

/* ---------- Floating Launcher Pill (Bottom-Left, only when authenticated) ---------- */
#ve-Launcher {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9998;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--ve-bg);
  border: 1.5px solid var(--ve-border);
  color: #FFE08E;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.78), 0 0 18px var(--ve-accent-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  transition: all 0.22s ease;
}

#ve-Launcher:hover {
  background: linear-gradient(135deg, #FF701E, #E84A0C);
  color: #FFFFFF;
  border-color: #FFE08E;
  transform: translateY(-2px);
}

body.ve-editing #ve-Launcher {
  display: none !important;
}

/* Preview return pill */
#ve-PreviewReturn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #FF701E, #D93400);
  border: 1.5px solid #FFE49E;
  color: #FFFFFF;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.72), 0 0 22px var(--ve-accent-glow);
}

#ve-PreviewReturn.is-visible {
  display: inline-flex;
}

/* ---------- Bottom Main Editor Toolbar ---------- */
#ve-Toolbar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  z-index: 9999;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ve-bg);
  border: 1px solid var(--ve-border);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.92), 0 0 26px var(--ve-accent-glow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 14px;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.26s ease;
  opacity: 0;
  pointer-events: none;
  width: max-content;
  max-width: 96vw;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}

@media (max-width: 1160px) {
  #ve-Toolbar {
    flex-wrap: wrap;
    width: auto;
  }
}

@media (max-width: 640px) {
  #ve-Launcher {
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 12px;
    padding: 8px 13px;
    font-size: 11px;
  }
  #ve-Toolbar {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 6px 8px;
    gap: 5px;
    max-width: calc(100vw - 14px);
    border-radius: 12px;
  }
}

body.ve-editing #ve-Toolbar {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.ve-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: rgba(255, 107, 26, 0.16);
  border: 1px solid var(--ve-accent);
  color: #FFE08E;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.ve-status-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  animation: vePulse 1.6s infinite ease-in-out;
}

.ve-status-pill.is-dirty .ve-status-dot {
  background: #F59E0B;
  box-shadow: 0 0 10px #F59E0B;
}

@keyframes vePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

.ve-route-select {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(36, 210, 255, 0.38);
  color: #9CEEFF;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  max-width: 175px;
}

.ve-route-select option {
  background: #0B1226;
  color: #F4F6FA;
}

.ve-btn {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #E8EEF9;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ve-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.ve-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ve-btn-primary {
  background: linear-gradient(135deg, #FF751F 0%, #D93B08 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 224, 150, 0.55);
  box-shadow: 0 0 18px var(--ve-accent-glow);
  font-weight: 800;
}

.ve-btn-primary:hover {
  background: linear-gradient(135deg, #FF9433 0%, #F2500F 100%);
  box-shadow: 0 0 26px rgba(255, 107, 26, 0.72);
  transform: translateY(-1.5px);
}

.ve-btn-exit {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.38);
  color: #FCA5A5;
}

.ve-btn-exit:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #FFFFFF;
}

/* ---------- Floating Rich-Text Formatting Bar ---------- */
#ve-FormatBar {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: none;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--ve-bg);
  border: 1px solid var(--ve-border);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9), 0 0 20px var(--ve-accent-glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 10px;
  max-width: 96vw;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}

body.ve-editing #ve-FormatBar.is-visible {
  display: flex;
}

.ve-fmt-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 6px;
  margin-right: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.ve-fmt-group:last-child {
  border-right: 0;
  padding-right: 0;
  margin-right: 0;
}

.ve-fmt-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #E8EEF9;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.ve-fmt-btn:hover,
.ve-fmt-btn.is-active {
  background: var(--ve-accent);
  color: #FFFFFF;
  border-color: #FFE49E;
}

.ve-fmt-color-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

/* ---------- Editable Element Outlines in Edit Mode ---------- */
body.ve-editing [data-ve-editable="true"] {
  outline: 1px dashed rgba(255, 174, 52, 0.42);
  outline-offset: 3px;
  border-radius: 4px;
  transition: outline-color 0.16s ease, background-color 0.16s ease;
  cursor: text !important;
}

body.ve-editing [data-ve-editable="true"]:hover {
  outline: 1.5px dashed #FFAE34;
  background-color: rgba(255, 107, 26, 0.12);
}

body.ve-editing [data-ve-editable="true"]:focus {
  outline: 2px solid var(--ve-accent);
  background-color: rgba(9, 14, 28, 0.72);
  box-shadow: 0 0 18px var(--ve-accent-glow);
}

body.ve-editing img[data-ve-img-id] {
  outline: 2px dashed rgba(36, 210, 255, 0.62);
  outline-offset: -2px;
  cursor: pointer !important;
  transition: outline-color 0.18s ease, filter 0.18s ease;
}

body.ve-editing img[data-ve-img-id]:hover {
  outline: 2.5px solid #24D2FF;
  filter: brightness(1.09);
}

/* Floating Image Hover Badge */
#ve-ImgHoverBadge {
  position: fixed;
  z-index: 9997;
  padding: 5px 11px;
  background: rgba(9, 14, 28, 0.96);
  border: 1.5px solid #24D2FF;
  color: #FFFFFF;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.85);
  border-radius: 7px;
  display: none;
}

#ve-ImgHoverBadge:hover {
  background: #24D2FF;
  color: #041542;
}

/* ---------- Modal Backdrop & Dialog ---------- */
.ve-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(3, 7, 18, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.ve-modal-backdrop.is-open {
  display: flex;
}

.ve-modal {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: #0B1224;
  border: 1.5px solid var(--ve-border);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.95), 0 0 32px var(--ve-accent-glow);
  border-radius: 16px;
  padding: 24px 26px;
  color: var(--ve-text);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}

.ve-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 13px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ve-modal-head h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #FFE08E;
  letter-spacing: 0.01em;
}

.ve-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #CBD5E1;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.ve-close-btn:hover {
  color: #FFFFFF;
  border-color: #FFFFFF;
}

.ve-field {
  margin-bottom: 16px;
}

.ve-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #FFAE34;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.ve-input,
.ve-select,
.ve-textarea {
  width: 100%;
  padding: 10px 12px;
  background: #060B18;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  color: #F4F6FA;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}

.ve-input:focus,
.ve-select:focus,
.ve-textarea:focus {
  outline: none;
  border-color: var(--ve-accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 26, 0.24);
}

.ve-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ve-pass-wrap .ve-input {
  padding-right: 44px;
}

.ve-pass-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #9BA7BE;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
}

.ve-pass-toggle:hover {
  color: #FFFFFF;
}

.ve-file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed var(--ve-border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.ve-file-drop:hover {
  background: rgba(255, 107, 26, 0.1);
  border-color: var(--ve-accent);
}

.ve-img-preview-box {
  margin-top: 12px;
  padding: 12px;
  background: #060B18;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  text-align: center;
}

.ve-img-preview-box img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  margin: 0 auto;
}

.ve-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Media Manager Grid */
.ve-bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 4px;
}

.ve-bg-card {
  background: #060B18;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ve-bg-card:hover {
  border-color: var(--ve-accent);
}

.ve-bg-thumb {
  width: 100%;
  height: 112px;
  border-radius: 6px;
  background-color: #0E1730;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ve-bg-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.3;
  word-break: break-word;
}

/* Revert Choice Cards */
.ve-revert-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ve-revert-card {
  background: #060B18;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ve-revert-info {
  flex: 1;
  min-width: 220px;
}

.ve-revert-info h5 {
  margin: 0 0 5px;
  font-size: 14px;
  color: #FFFFFF;
}

.ve-revert-info p {
  margin: 0;
  font-size: 12px;
  color: var(--ve-muted);
  line-height: 1.45;
}

.ve-revert-danger {
  border-color: rgba(239, 68, 68, 0.35);
}

/* Toast Notification */
.ve-toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 10090;
  padding: 12px 18px;
  background: rgba(9, 14, 28, 0.98);
  border: 1px solid var(--ve-accent);
  border-left: 5px solid var(--ve-accent);
  color: #FFFFFF;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.88), 0 0 22px var(--ve-accent-glow);
  border-radius: 9px;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s ease;
  max-width: 420px;
  line-height: 1.45;
}

.ve-toast.is-shown {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 680px) {
  #ve-Toolbar {
    bottom: 10px;
    padding: 8px 10px;
    gap: 5px;
  }
  .ve-btn {
    padding: 5px 8px;
    font-size: 11px;
  }
  .ve-status-pill {
    display: none;
  }
  .ve-modal {
    padding: 18px;
  }
}
