/* ============================================
   MONOCHROME BY RAHIM — INLINE ADMIN EDITOR
   Icy Chrome / Glassmorphism Theme
   ============================================ */

/* --- ADMIN MODE INDICATOR (Subtle top border) --- */
body.is-admin::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--icy-chrome) 30%, 
    var(--frost) 50%, 
    var(--icy-chrome) 70%, 
    transparent 100%);
  z-index: 999999;
  opacity: 0.6;
}

/* When preview mode is on, hide ALL admin UI */
body.is-admin.admin-preview::before { display: none; }
body.is-admin.admin-preview .admin-pin { display: none !important; }
body.is-admin.admin-preview .admin-ghost { display: none !important; }
body.is-admin.admin-preview .admin-section-toggle { display: none !important; }
body.is-admin.admin-preview .admin-bar { opacity: 0.3; }
body.is-admin.admin-preview .admin-bar:hover { opacity: 1; }

/* =============================================
   INLINE EDIT PINS (Always visible in admin)
   ============================================= */
.admin-pin {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 50;
  display: flex;
  gap: 4px;
}

.admin-pin__btn {
  width: 30px; height: 30px;
  border: 1px solid rgba(143, 159, 178, 0.4);
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--icy-chrome);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 4px;
  padding: 0;
  line-height: 1;
}

.admin-pin__btn:hover {
  background: rgba(143, 159, 178, 0.3);
  border-color: var(--icy-chrome);
  color: var(--frost);
  transform: scale(1.1);
}

.admin-pin__btn--danger:hover {
  background: rgba(255, 77, 77, 0.3);
  border-color: #ff4d4d;
  color: #ff4d4d;
}

/* =============================================
   CONTEXTUAL POPOVER — FIXED POSITION
   Renders on top of everything, never clipped
   ============================================= */
.admin-popover {
  position: fixed;
  z-index: 200000;
  width: 220px;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(143, 159, 178, 0.25);
  border-radius: 6px;
  padding: 12px;
  display: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.admin-popover.active {
  display: block;
  animation: popoverIn 0.2s ease-out;
}

@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.admin-popover__title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--icy-chrome);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(143, 159, 178, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-popover__action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--frost);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 3px;
  text-align: left;
}

.admin-popover__action:hover {
  background: rgba(143, 159, 178, 0.12);
  color: var(--icy-chrome);
}

.admin-popover__action--danger:hover {
  background: rgba(255, 77, 77, 0.12);
  color: #ff4d4d;
}

.admin-popover__icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.admin-popover__divider {
  height: 1px;
  background: rgba(143, 159, 178, 0.1);
  margin: 4px 0;
}

/* Layout indicator badge */
.admin-popover__badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--smoke-mid);
  background: rgba(143, 159, 178, 0.1);
  border: 1px solid rgba(143, 159, 178, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.1em;
  margin-left: auto;
}

/* =============================================
   GHOST "ADD" CARD (+ at end of grids)
   ============================================= */
.admin-ghost {
  display: none; /* Hidden for public */
  position: relative;
  border: 2px dashed rgba(143, 159, 178, 0.25) !important;
  background: rgba(143, 159, 178, 0.03) !important;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  overflow: visible !important;
}

body.is-admin .admin-ghost {
  display: flex;
}

body.is-admin.admin-preview .admin-ghost {
  display: none;
}

.admin-ghost:hover {
  border-color: var(--icy-chrome) !important;
  background: rgba(143, 159, 178, 0.08) !important;
}

.admin-ghost__icon {
  font-size: 2rem;
  color: rgba(143, 159, 178, 0.4);
  transition: color 0.3s;
  line-height: 1;
}

.admin-ghost:hover .admin-ghost__icon {
  color: var(--icy-chrome);
}

.admin-ghost__text {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(143, 159, 178, 0.4);
  text-transform: uppercase;
}

.admin-ghost:hover .admin-ghost__text {
  color: var(--icy-chrome);
}

/* =============================================
   SECTION TOGGLE (Inline, next to headers)
   ============================================= */
.admin-section-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

body.is-admin .admin-section-toggle {
  display: inline-flex;
}

.admin-section-toggle__btn {
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(143, 159, 178, 0.3);
  color: var(--icy-chrome);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.25s;
  border-radius: 3px;
  text-transform: uppercase;
}

.admin-section-toggle__btn:hover {
  background: rgba(143, 159, 178, 0.2);
  border-color: var(--icy-chrome);
}

.admin-section-toggle__btn.is-off {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

.admin-section-toggle__btn.is-off:hover {
  background: rgba(255, 107, 107, 0.15);
}

/* =============================================
   ADMIN BOTTOM BAR (Minimal, glassmorphism)
   ============================================= */
.admin-bar {
  display: none;
  position: fixed;
  bottom: 24px; 
  right: 24px;
  width: 220px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(143, 159, 178, 0.2);
  border-radius: 8px;
  z-index: 90000;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}

body.is-admin .admin-bar {
  display: flex;
}

.admin-bar__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  background: transparent;
  user-select: none;
}

.admin-bar__toggle svg {
  width: 14px;
  height: 14px;
  color: var(--icy-chrome);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-bar.is-expanded .admin-bar__toggle svg {
  transform: rotate(180deg);
}

.admin-bar__menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  max-height: 0;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-bar.is-expanded .admin-bar__menu {
  max-height: 300px; /* arbitrary tall enough value */
  padding: 0 16px 16px 16px;
  opacity: 1;
}

.admin-bar__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--icy-chrome);
  text-transform: uppercase;
}

.admin-bar__btn {
  background: rgba(143, 159, 178, 0.08);
  border: 1px solid rgba(143, 159, 178, 0.15);
  color: var(--silver);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 4px;
  text-align: left;
  width: 100%;
}

.admin-bar__btn:hover {
  background: rgba(143, 159, 178, 0.15);
  border-color: var(--icy-chrome);
  color: var(--frost);
}

.admin-bar__btn.active {
  background: rgba(143, 159, 178, 0.2);
  border-color: var(--icy-chrome);
  color: var(--frost);
}

.admin-bar__btn--logout {
  border-color: rgba(255, 107, 107, 0.3);
  color: rgba(255, 107, 107, 0.7);
}

.admin-bar__btn--logout:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.admin-bar__divider {
  display: none;
}

/* =============================================
   ADMIN ALERT MODAL
   ============================================= */
.admin-alert-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.admin-alert-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.admin-alert-modal__content {
  background: rgba(10, 10, 10, 0.9);
  border: 1px solid var(--smoke-mid);
  padding: 2.5rem;
  max-width: 450px;
  width: 90%;
  text-align: center;
  border-radius: 8px;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-alert-modal.is-active .admin-alert-modal__content {
  transform: translateY(0);
}

.admin-alert-modal__title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  color: var(--icy-chrome);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.admin-alert-modal__text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--frost);
  margin-bottom: 2rem;
  opacity: 0.7;
  line-height: 1.5;
}

/* =============================================
   UPLOAD MODAL (Glassmorphism overlay)
   ============================================= */
.admin-upload-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 200001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.admin-upload-modal.active {
  display: flex;
}

.admin-upload-modal__content {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(143, 159, 178, 0.2);
  border-radius: 8px;
  padding: 2rem;
  animation: popoverIn 0.3s ease-out;
}

.admin-upload-modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--frost);
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

.admin-upload-modal__row {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.admin-upload-modal__field {
  flex: 1;
}

.admin-upload-modal__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--smoke-mid);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.admin-upload-modal__input {
  width: 100%;
  background: rgba(34, 36, 41, 0.8);
  border: 1px solid rgba(143, 159, 178, 0.2);
  color: var(--frost);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  outline: none;
  transition: border-color 0.3s;
  box-sizing: border-box;
  border-radius: 3px;
}

.admin-upload-modal__input:focus {
  border-color: var(--icy-chrome);
}

.admin-upload-modal__select {
  width: 100%;
  background: rgba(34, 36, 41, 0.8);
  border: 1px solid rgba(143, 159, 178, 0.2);
  color: var(--frost);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  outline: none;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
}

.admin-upload-modal__select:focus {
  border-color: var(--icy-chrome);
}

.admin-upload-modal__dropzone {
  border: 2px dashed rgba(143, 159, 178, 0.25);
  background: rgba(143, 159, 178, 0.03);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin: 1rem 0;
  border-radius: 4px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.admin-upload-modal__dropzone:hover {
  border-color: var(--icy-chrome);
  background: rgba(143, 159, 178, 0.06);
}

.admin-upload-modal__dropzone.has-file {
  border-color: var(--icy-chrome);
  padding: 0;
  overflow: hidden;
}

.admin-upload-modal__dropzone.has-file img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.admin-upload-modal__dropzone-text {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--smoke-mid);
  letter-spacing: 0.1em;
}

.admin-upload-modal__dropzone-icon {
  font-size: 1.5rem;
  color: rgba(143, 159, 178, 0.3);
}

.admin-upload-modal__actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.admin-upload-modal__submit {
  flex: 1;
  background: rgba(143, 159, 178, 0.15);
  border: 1px solid var(--icy-chrome);
  color: var(--frost);
  padding: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
}

.admin-upload-modal__submit:hover {
  background: rgba(143, 159, 178, 0.3);
}

.admin-upload-modal__submit:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.admin-upload-modal__cancel {
  background: transparent;
  border: 1px solid rgba(143, 159, 178, 0.2);
  color: var(--smoke-mid);
  padding: 0.7rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
}

.admin-upload-modal__cancel:hover {
  border-color: var(--icy-chrome);
  color: var(--frost);
}

/* Status message */
.admin-upload-modal__status {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0.5rem;
  margin-top: 0.6rem;
  border-radius: 3px;
}

.admin-upload-modal__status.success {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.05);
}

.admin-upload-modal__status.error {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.05);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  /* Admin bar is naturally responsive as a floating capsule, so we don't need overrides here anymore! */

  .admin-pin__btn {
    width: 26px; height: 26px;
    font-size: 11px;
  }

  .admin-popover {
    width: 200px;
  }

  .admin-upload-modal {
    padding: 1rem;
  }

  .admin-upload-modal__content {
    padding: 1.2rem;
  }

  .admin-upload-modal__row {
    flex-direction: column;
  }
}

/* =============================================
   LIGHT THEME OVERRIDES (Solar Mode)
   ============================================= */
body.light-theme .admin-pin__btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(109, 124, 142, 0.3);
  color: var(--icy-chrome);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .admin-pin__btn:hover {
  background: var(--onyx);
  color: var(--frost);
  border-color: var(--icy-chrome);
}

body.light-theme .admin-popover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  border-color: rgba(109, 124, 142, 0.2);
}

body.light-theme .admin-popover__title {
  color: var(--smoke-mid);
  border-bottom-color: rgba(109, 124, 142, 0.15);
}

body.light-theme .admin-popover__action {
  color: var(--frost);
}

body.light-theme .admin-popover__action:hover {
  background: rgba(109, 124, 142, 0.1);
}

body.light-theme .admin-popover__divider {
  background: rgba(109, 124, 142, 0.1);
}

body.light-theme .admin-ghost {
  border-color: rgba(109, 124, 142, 0.25) !important;
  background: rgba(109, 124, 142, 0.03) !important;
}

body.light-theme .admin-ghost:hover {
  background: rgba(109, 124, 142, 0.08) !important;
  border-color: var(--icy-chrome) !important;
}

body.light-theme .admin-bar {
  background: rgba(240, 241, 243, 0.9);
  border-top-color: rgba(109, 124, 142, 0.2);
}

body.light-theme .admin-bar__label {
  color: var(--smoke-mid);
}

body.light-theme .admin-bar__btn {
  color: var(--smoke-mid);
  border-color: rgba(109, 124, 142, 0.3);
}

body.light-theme .admin-bar__btn:hover,
body.light-theme .admin-bar__btn.active {
  background: rgba(109, 124, 142, 0.15);
  color: var(--frost);
  border-color: var(--icy-chrome);
}

body.light-theme .admin-upload-modal {
  background: rgba(240, 241, 243, 0.85); /* Frosted glass for overlay */
}

body.light-theme .admin-upload-modal__content {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(109, 124, 142, 0.2);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.1);
}

body.light-theme .admin-upload-modal__input,
body.light-theme .admin-upload-modal__select {
  background: var(--void); /* Light gray */
  color: var(--frost); /* Dark text */
  border-color: rgba(109, 124, 142, 0.2);
}

body.light-theme .admin-upload-modal__input:focus,
body.light-theme .admin-upload-modal__select:focus {
  border-color: var(--icy-chrome);
  background: var(--onyx); /* Pure white on focus */
}

body.light-theme .admin-upload-modal__dropzone {
  background: var(--void);
  border-color: rgba(109, 124, 142, 0.25);
}

body.light-theme .admin-upload-modal__dropzone:hover {
  background: rgba(109, 124, 142, 0.08);
  border-color: var(--icy-chrome);
}

body.light-theme .admin-upload-modal__cancel {
  border-color: rgba(109, 124, 142, 0.3);
  color: var(--smoke-mid);
}

body.light-theme .admin-upload-modal__cancel:hover {
  color: var(--frost);
  border-color: var(--icy-chrome);
}

/* --- Light Theme: Admin Alert Modal --- */
body.light-theme .admin-alert-modal {
  background: rgba(240, 241, 243, 0.9);
}

body.light-theme .admin-alert-modal__content {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(109, 124, 142, 0.2);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.1);
}

body.light-theme .admin-alert-modal__title {
  color: var(--icy-chrome);
}

body.light-theme .admin-alert-modal__text {
  color: var(--frost);
}

/* --- Light Theme: Admin Bar Toggle Arrow --- */
body.light-theme .admin-bar__toggle svg {
  color: var(--icy-chrome);
}

body.light-theme .admin-bar {
  border-color: rgba(109, 124, 142, 0.2);
}
