/* ==========================================================================
   FOX CMS v4.0 ("WordPress-Lite") — Admin Bar, Visual Editor & Studio Drawer
   Zero visual footprint for public visitors; athletic dark/orange UI for Admin
   ========================================================================== */

:root {
  --fox-cms-bg: #0b0f17;
  --fox-cms-panel: #111723;
  --fox-cms-card: #161e2e;
  --fox-cms-border: rgba(255, 255, 255, 0.1);
  --fox-cms-orange: #ff7a00;
  --fox-cms-orange-hover: #ff9429;
  --fox-cms-text: #f1f5f9;
  --fox-cms-muted: #94a3b8;
  --fox-cms-danger: #ef4444;
  --fox-cms-success: #10b981;
}

/* 1. Toast Notifications */
.fox-toast {
  position: fixed;
  bottom: 86px;
  right: 24px;
  z-index: 2147483646;
  background: rgba(14, 19, 29, 0.96);
  color: #fff;
  border: 1px solid rgba(255, 122, 0, 0.45);
  border-left: 4px solid var(--fox-cms-orange);
  padding: 12px 18px;
  border-radius: 10px;
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(12px);
}
.fox-toast.success { border-left-color: var(--fox-cms-success); border-color: rgba(16, 185, 129, 0.4); }
.fox-toast.error { border-left-color: var(--fox-cms-danger); border-color: rgba(239, 68, 68, 0.45); }

/* 2. Floating Bottom Admin Dock */
#fox-admin-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483640;
  background: rgba(11, 15, 23, 0.95);
  border: 1px solid rgba(255, 122, 0, 0.42);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.78), 0 0 24px rgba(255, 122, 0, 0.14);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 20px);
  backdrop-filter: blur(16px);
  font-family: 'Barlow', system-ui, sans-serif;
}

.fox-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fox-cms-orange);
  padding: 4px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.fox-admin-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fox-cms-success);
  box-shadow: 0 0 10px var(--fox-cms-success);
}

.fox-dirty-pill {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  display: none;
}
.fox-dirty-pill.visible {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fox-admin-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.fox-admin-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 122, 0, 0.5);
  color: #fff;
}
.fox-admin-btn.active {
  background: rgba(255, 122, 0, 0.2);
  border-color: var(--fox-cms-orange);
  color: #ffb366;
}
.fox-admin-btn.studio {
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.22), rgba(255, 122, 0, 0.08));
  border-color: rgba(255, 122, 0, 0.55);
  color: #fff;
}
.fox-admin-btn.primary {
  background: var(--fox-cms-orange);
  border-color: var(--fox-cms-orange);
  color: #000;
  font-weight: 900;
}
.fox-admin-btn.primary:hover {
  background: var(--fox-cms-orange-hover);
  border-color: var(--fox-cms-orange-hover);
  box-shadow: 0 4px 16px rgba(255, 122, 0, 0.4);
}
.fox-admin-btn.danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.fox-admin-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

/* 3. In-Place Visual Editing Highlights & Card Toolbars */
body.fox-edit-mode {
  padding-bottom: 84px !important;
}

body.fox-edit-mode [data-fox-id] {
  outline: 1px dashed rgba(255, 122, 0, 0.55) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
  cursor: text !important;
  transition: outline-color 0.15s ease, background-color 0.15s ease;
}

body.fox-edit-mode [data-fox-id]:hover,
body.fox-edit-mode [data-fox-id]:focus {
  outline: 2px solid var(--fox-cms-orange) !important;
  background-color: rgba(255, 122, 0, 0.08) !important;
}

/* Card Overlay Action Toolbar (Edit / Move / Delete) */
.fox-card-actions-bar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 30;
  display: none !important;
  gap: 4px;
  background: rgba(8, 11, 18, 0.9);
  border: 1px solid rgba(255, 122, 0, 0.45);
  padding: 4px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

body.fox-edit-mode .fox-card-actions-bar {
  display: inline-flex !important;
}

.fox-act-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
}
.fox-act-icon:hover {
  background: var(--fox-cms-orange);
  border-color: var(--fox-cms-orange);
  color: #000;
}
.fox-act-icon.del:hover {
  background: var(--fox-cms-danger);
  border-color: var(--fox-cms-danger);
  color: #fff;
}

/* Inline Tools on Trophy / Match / Standings Rows */
.fox-item-inline-tools {
  display: none !important;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  flex-shrink: 0;
}
body.fox-edit-mode .fox-item-inline-tools {
  display: inline-flex !important;
}

/* Add Item CTA Buttons Under Collections */
.fox-add-player-btn,
.fox-add-trophy-btn,
.fox-add-match-btn,
.fox-add-team-btn {
  background: rgba(255, 122, 0, 0.14) !important;
  border: 1px dashed rgba(255, 122, 0, 0.65) !important;
  color: #ff9d42 !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s ease !important;
}
.fox-add-player-btn:hover,
.fox-add-trophy-btn:hover,
.fox-add-match-btn:hover,
.fox-add-team-btn:hover {
  background: var(--fox-cms-orange) !important;
  border-style: solid !important;
  color: #000 !important;
}

/* 4. Modals (Login Modal & Item Editor Modal) */
.fox-cms-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483644;
  background: rgba(4, 7, 13, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

.fox-cms-modal {
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--fox-cms-panel);
  border: 1px solid rgba(255, 122, 0, 0.35);
  border-radius: 16px;
  padding: 24px;
  color: var(--fox-cms-text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  font-family: 'Barlow', system-ui, sans-serif;
}
.fox-cms-modal.narrow {
  max-width: 410px;
}

.fox-cms-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--fox-cms-border);
}
.fox-cms-modal-head h3 {
  margin: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
}
.fox-cms-modal-head h3 span {
  color: var(--fox-cms-orange);
}

.fox-cms-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--fox-cms-border);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fox-cms-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
}

.fox-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fox-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.fox-form-field.full {
  grid-column: 1 / -1;
}
.fox-form-field label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbd5e1;
}
.fox-form-field input,
.fox-form-field select,
.fox-form-field textarea {
  width: 100%;
  box-sizing: border-box;
  background: #0b0f17;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-family: 'Barlow', system-ui, sans-serif;
  font-size: 0.92rem;
  outline: none;
}
.fox-form-field input:focus,
.fox-form-field select:focus,
.fox-form-field textarea:focus {
  border-color: var(--fox-cms-orange);
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.18);
}

/* Drag & Drop Photo Uploader Box */
.fox-upload-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #0b0f17;
  border: 1px dashed rgba(255, 122, 0, 0.45);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.fox-upload-zone.dragover {
  border-color: var(--fox-cms-orange);
  background: rgba(255, 122, 0, 0.1);
}
.fox-upload-preview {
  width: 64px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
  background: #161e2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}
.fox-upload-preview.square {
  width: 68px;
  height: 68px;
}
.fox-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.fox-upload-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fox-cms-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--fox-cms-border);
}

/* 5. Centralized Slide-Over Studio ("FOX CMS Studio") */
#fox-cms-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483642;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  display: none;
}
#fox-cms-drawer-backdrop.open {
  display: block;
}

#fox-cms-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(920px, 100vw);
  z-index: 2147483643;
  background: var(--fox-cms-bg);
  border-left: 1px solid rgba(255, 122, 0, 0.35);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Barlow', system-ui, sans-serif;
  color: var(--fox-cms-text);
}
#fox-cms-drawer.open {
  transform: translateX(0);
}

.fox-studio-header {
  padding: 16px 22px;
  background: var(--fox-cms-panel);
  border-bottom: 1px solid var(--fox-cms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.fox-studio-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fox-studio-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.fox-studio-brand h2 {
  margin: 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}
.fox-studio-brand h2 span {
  color: var(--fox-cms-orange);
}

.fox-studio-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 22px;
  background: #0d121c;
  border-bottom: 1px solid var(--fox-cms-border);
  overflow-x: auto;
}
.fox-studio-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.fox-studio-tab:hover {
  color: #fff;
  border-color: rgba(255, 122, 0, 0.4);
}
.fox-studio-tab.active {
  background: var(--fox-cms-orange);
  border-color: var(--fox-cms-orange);
  color: #000;
}

.fox-studio-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 96px;
}

.fox-studio-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.fox-studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--fox-cms-panel);
  border: 1px solid var(--fox-cms-border);
  padding: 12px 14px;
  border-radius: 12px;
}

.fox-studio-select {
  background: #0b0f17;
  border: 1px solid rgba(255, 122, 0, 0.45);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  border-radius: 8px;
  min-width: 240px;
}

.fox-studio-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 12px;
}
.fox-studio-list.rows {
  grid-template-columns: 1fr;
}

.fox-studio-item {
  background: var(--fox-cms-card);
  border: 1px solid var(--fox-cms-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.fox-studio-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: #0b0f17;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.fox-studio-meta {
  flex: 1;
  min-width: 0;
}
.fox-studio-meta strong {
  display: block;
  font-size: 0.96rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fox-studio-meta span {
  display: block;
  font-size: 0.8rem;
  color: var(--fox-cms-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fox-studio-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.fox-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.fox-kpi-box {
  background: var(--fox-cms-panel);
  border: 1px solid var(--fox-cms-border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.fox-kpi-box .num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--fox-cms-orange);
}
.fox-kpi-box .lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fox-cms-muted);
}

@media (max-width: 640px) {
  .fox-form-grid {
    grid-template-columns: 1fr;
  }
  #fox-admin-bar {
    bottom: 8px;
    padding: 6px 8px;
    gap: 5px;
  }
  .fox-admin-btn {
    font-size: 0.8rem;
    padding: 6px 9px;
  }
}
