/* ============================================================
   AUC FRONTEND ADMIN BAR — WordPress-Style Floating Editor
   ============================================================ */

:root {
  --auc-bar-h: 36px;
  --auc-bar-bg: #111827;
  --auc-bar-border: rgba(255, 184, 0, 0.25);
  --auc-gold: #FFB800;
  --auc-cyan: #00E5FF;
  --auc-green: #00FF87;
  --auc-red: #FF4757;
  --auc-text: #e2e8f0;
  --auc-muted: #94a3b8;
  --auc-edit-glow: rgba(255, 184, 0, 0.55);
  --auc-editor-bg: #1e293b;
}

/* ── Offset body so bar doesn't overlap content ── */
body.auc-admin-active {
  margin-top: var(--auc-bar-h) !important;
}

/* ════════════════════════════════════════════════
   ADMIN BAR ITSELF
   ════════════════════════════════════════════════ */
#auc-admin-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--auc-bar-h);
  background: var(--auc-bar-bg);
  border-bottom: 1px solid var(--auc-bar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 999999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
  gap: 0.5rem;
}

/* Left zone */
.auc-bar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Center zone */
.auc-bar-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

/* Right zone */
.auc-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* AUC Logo pill */
.auc-bar-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.65rem;
  height: 26px;
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.3);
  border-radius: 4px;
  color: var(--auc-gold);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.auc-bar-logo img {
  height: 18px;
  width: auto;
}

/* Divider */
.auc-bar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* Generic bar button */
.auc-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  height: 26px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.06);
  color: var(--auc-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  font-family: inherit;
}
.auc-bar-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.auc-bar-btn i { font-size: 11px; }

/* Edit Mode ACTIVE button */
.auc-bar-btn.edit-active {
  background: rgba(255, 184, 0, 0.18);
  border-color: rgba(255, 184, 0, 0.5);
  color: var(--auc-gold);
  box-shadow: 0 0 10px rgba(255,184,0,0.25);
  animation: auc-pulse-gold 2s ease infinite;
}

@keyframes auc-pulse-gold {
  0%, 100% { box-shadow: 0 0 8px rgba(255,184,0,0.25); }
  50% { box-shadow: 0 0 16px rgba(255,184,0,0.5); }
}

/* Save button */
.auc-bar-btn.auc-save-btn {
  background: rgba(0, 255, 135, 0.15);
  border-color: rgba(0,255,135,0.4);
  color: var(--auc-green);
}
.auc-bar-btn.auc-save-btn:hover {
  background: rgba(0,255,135,0.25);
}
.auc-bar-btn.auc-save-btn.saving {
  opacity: 0.7;
  pointer-events: none;
}

/* Danger / logout button */
.auc-bar-btn.auc-danger {
  border-color: rgba(255,71,87,0.3);
  color: var(--auc-red);
}
.auc-bar-btn.auc-danger:hover {
  background: rgba(255,71,87,0.12);
}

/* Page indicator label */
.auc-page-label {
  color: var(--auc-muted);
  font-size: 11px;
  white-space: nowrap;
}
.auc-page-label span {
  color: var(--auc-cyan);
  font-weight: 600;
}

/* Change counter badge */
.auc-change-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--auc-gold);
  color: #111;
  font-size: 10px;
  font-weight: 700;
  display: none;
}
.auc-change-badge.has-changes { display: inline-flex; }

/* ════════════════════════════════════════════════
   EDITABLE ELEMENT HIGHLIGHTS
   ════════════════════════════════════════════════ */

/* In edit mode: show all editable elements */
body.auc-edit-mode [data-editable] {
  position: relative;
  outline: 1px dashed rgba(255, 184, 0, 0.35) !important;
  outline-offset: 3px;
  cursor: pointer !important;
  border-radius: 2px;
  transition: outline 0.15s ease;
}
body.auc-edit-mode [data-editable]:hover {
  outline: 2px solid var(--auc-gold) !important;
  background: rgba(255,184,0,0.05) !important;
  z-index: 2;
}
body.auc-edit-mode [data-editable].auc-focused {
  outline: 2px solid var(--auc-gold) !important;
  background: rgba(255,184,0,0.08) !important;
  outline-offset: 4px;
}
body.auc-edit-mode [data-editable][contenteditable="true"] {
  outline: 2px solid var(--auc-gold) !important;
  background: rgba(255,184,0,0.06) !important;
  cursor: text !important;
}

/* Modified elements */
[data-editable].auc-modified {
  outline: 1px solid rgba(0,255,135,0.4) !important;
}

/* Image editable overlay */
body.auc-edit-mode [data-editable-img] {
  position: relative;
  cursor: pointer !important;
}
body.auc-edit-mode [data-editable-img]::after {
  content: '\f03e  Change Image';
  font-family: 'Font Awesome 6 Free', sans-serif;
  font-weight: 900;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}
body.auc-edit-mode [data-editable-img]:hover::after { opacity: 1; }

/* ════════════════════════════════════════════════
   FLOATING INLINE EDITOR TOOLBAR
   ════════════════════════════════════════════════ */
#auc-inline-toolbar {
  position: fixed;
  z-index: 1000000;
  background: #1e293b;
  border: 1px solid rgba(255,184,0,0.3);
  border-radius: 8px;
  padding: 5px 6px;
  display: none;
  align-items: center;
  gap: 2px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,184,0,0.1);
  pointer-events: all;
  flex-wrap: wrap;
  max-width: 340px;
}
#auc-inline-toolbar.visible { display: flex; }

.auc-tb-btn {
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--auc-text);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s;
  font-family: inherit;
}
.auc-tb-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.auc-tb-btn.active {
  background: rgba(255,184,0,0.18);
  color: var(--auc-gold);
}
.auc-tb-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  margin: 0 2px;
}
.auc-tb-label {
  font-size: 10px;
  color: var(--auc-muted);
  padding: 0 4px;
  white-space: nowrap;
}
.auc-tb-done {
  padding: 0 8px;
  height: 22px;
  border-radius: 4px;
  background: rgba(0,255,135,0.15);
  border: 1px solid rgba(0,255,135,0.35);
  color: var(--auc-green);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.auc-tb-done:hover { background: rgba(0,255,135,0.25); }

/* ════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════════ */
#auc-toast-container {
  position: fixed;
  top: calc(var(--auc-bar-h) + 12px);
  right: 16px;
  z-index: 1000001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.auc-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 10px 16px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--auc-text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: all;
  animation: auc-toast-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 320px;
}
.auc-toast.success { border-color: rgba(0,255,135,0.35); }
.auc-toast.success i { color: var(--auc-green); }
.auc-toast.error { border-color: rgba(255,71,87,0.35); }
.auc-toast.error i { color: var(--auc-red); }
.auc-toast.info { border-color: rgba(0,229,255,0.35); }
.auc-toast.info i { color: var(--auc-cyan); }
.auc-toast.fade-out { animation: auc-toast-out 0.2s ease forwards; }

@keyframes auc-toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes auc-toast-out {
  to { opacity: 0; transform: translateX(110%); }
}

/* ════════════════════════════════════════════════
   ADMIN LOGIN OVERLAY (for HTML-only pages)
   ════════════════════════════════════════════════ */
#auc-admin-login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 9, 25, 0.92);
  backdrop-filter: blur(12px);
  z-index: 1000002;
  align-items: center;
  justify-content: center;
}
#auc-admin-login-overlay.open { display: flex; }

.auc-login-card {
  background: #111827;
  border: 1px solid rgba(255,184,0,0.25);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,184,0,0.1);
}
.auc-login-card img {
  height: 52px;
  margin-bottom: 1.25rem;
}
.auc-login-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.5rem 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.auc-login-card p {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0 0 1.5rem 0;
}
.auc-login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.auc-login-input:focus {
  outline: none;
  border-color: var(--auc-gold);
  box-shadow: 0 0 0 3px rgba(255,184,0,0.15);
}
.auc-login-submit {
  width: 100%;
  padding: 0.85rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #FFB800, #FF8C00);
  color: #111;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}
.auc-login-submit:hover { opacity: 0.9; }
.auc-login-error {
  color: var(--auc-red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  display: none;
}
.auc-login-error.show { display: block; }

/* ════════════════════════════════════════════════
   RESET CONFIRMATION DIALOG
   ════════════════════════════════════════════════ */
.auc-confirm-dialog {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000003;
  align-items: center;
  justify-content: center;
}
.auc-confirm-dialog.open { display: flex; }
.auc-confirm-box {
  background: #1e293b;
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: 12px;
  padding: 2rem;
  max-width: 380px;
  text-align: center;
}
.auc-confirm-box h3 { color: #fff; margin: 0 0 0.75rem; font-size: 1.1rem; }
.auc-confirm-box p { color: #94a3b8; font-size: 0.9rem; margin: 0 0 1.5rem; }
.auc-confirm-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ════════════════════════════════════════════════
   RESPONSIVE — hide labels on mobile
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .auc-bar-btn .auc-btn-label { display: none; }
  .auc-bar-center { display: none; }
  .auc-bar-logo span { display: none; }
  #auc-admin-bar { padding: 0 0.6rem; }
}
