/* =============================================
   UPHIX GADGETS — Admin Styles
   =============================================*/
/* ADMIN */
#admin-page { min-height: 100vh; background: #030c18; padding-top: 0; }
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(11,56,111,0.3) 0%, #030c18 70%); }
.admin-login-card { background: #0d1b2a; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px; width: 100%; max-width: 420px; }
.admin-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-sidebar { background: #030c18; border-right: 1px solid var(--border); padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.admin-sidebar-header { padding: 24px 20px; border-bottom: 1px solid var(--border); }
.admin-nav { padding: 16px 12px; flex: 1; }
.admin-nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: var(--transition); border: none; background: none; width: 100%; text-align: left; margin-bottom: 4px; }
.admin-nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.admin-nav-item.active { background: rgba(59,130,246,0.15); color: var(--accent); border-left: 3px solid var(--accent); }
.admin-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.admin-main { background: #050f1a; overflow-y: auto; }
.admin-topbar { background: #030c18; border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.admin-content { padding: 32px; }
.admin-panel { display: none; }
.admin-panel.active { display: block; animation: fadeInPage 0.25s ease; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.admin-stat-card { background: #0d1b2a; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.admin-stat-card .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 8px; }
.admin-stat-card .value { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; }
.admin-stats-2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.admin-table-wrap { background: #0d1b2a; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 12px 16px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); background: rgba(0,0,0,0.2); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.875rem; color: var(--text-secondary); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.admin-table img { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; }
.table-actions { display: flex; gap: 6px; }
.action-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); }
.action-btn.edit { background: rgba(59,130,246,0.15); color: var(--accent); }
.action-btn.edit:hover { background: var(--accent); color: #fff; }
.action-btn.delete { background: rgba(239,68,68,0.15); color: #f87171; }
.action-btn.delete:hover { background: var(--danger); color: #fff; }
.admin-form { background: #0d1b2a; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.admin-form h3 { font-size: 1.25rem; margin-bottom: 28px; }
.img-upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.img-upload-slot { aspect-ratio: 1; background: #030c18; border: 2px dashed var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); position: relative; overflow: hidden; }
.img-upload-slot:hover { border-color: var(--accent); }
.img-upload-slot .overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition); }
.img-upload-slot:hover .overlay { opacity: 1; }
.img-upload-slot input { display: none; }
.upload-icon { color: var(--text-muted); margin-bottom: 6px; }
.upload-text { font-size: 0.75rem; color: var(--text-muted); text-align: center; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
.status-active { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-draft { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* LIGHT THEME ADMIN OVERRIDES */
[data-theme="light"] #admin-page { background: var(--bg-primary); }
[data-theme="light"] .admin-login { background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, var(--bg-primary) 70%); }
[data-theme="light"] .admin-login-card { background: var(--bg-surface); border: 1px solid var(--border); }
[data-theme="light"] .admin-sidebar { background: var(--bg-surface); border-right: 1px solid var(--border); }
[data-theme="light"] .admin-nav-item { color: var(--text-secondary); }
[data-theme="light"] .admin-nav-item:hover { background: rgba(41,121,212,0.08); color: var(--text-primary); }
[data-theme="light"] .admin-nav-item.active { background: rgba(41,121,212,0.12); color: var(--accent); }
[data-theme="light"] .admin-main { background: var(--bg-primary); }
[data-theme="light"] .admin-topbar { background: var(--bg-surface); border-bottom: 1px solid var(--border); }
[data-theme="light"] .admin-stat-card { background: var(--bg-surface); border: 1px solid var(--border); }
[data-theme="light"] .admin-stat-card .label { color: var(--text-muted); }
[data-theme="light"] .admin-stat-card .value { color: var(--text-primary); }
[data-theme="light"] .admin-table-wrap { background: var(--bg-surface); border: 1px solid var(--border); }
[data-theme="light"] .admin-table-header { border-bottom: 1px solid var(--border); }
[data-theme="light"] .admin-table th { background: rgba(0,0,0,0.03); border-bottom: 1px solid var(--border); color: var(--text-muted); }
[data-theme="light"] .admin-table td { border-bottom: 1px solid var(--border); color: var(--text-secondary); }
[data-theme="light"] .admin-table tr:hover td { background: rgba(41,121,212,0.05); }
[data-theme="light"] .admin-form { background: var(--bg-surface); border: 1px solid var(--border); }
[data-theme="light"] .admin-form h3 { color: var(--text-primary); }
[data-theme="light"] .img-upload-slot { background: var(--bg-secondary); border: 2px dashed var(--border); }
[data-theme="light"] .img-upload-slot:hover { border-color: var(--accent); }
/* =============================================
   UPHIX GADGETS — Admin CSS Additions
   =============================================*/

/* ── Toast Notifications ── */
.u-phix-toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  line-height: 1.4;
}

.u-phix-toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.u-phix-toast.toast-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.u-phix-toast.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.u-phix-toast.toast-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

/* ── Button Spinner ── */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Button loading state ── */
.btn-loading {
  opacity: 0.75;
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
}

/* ── Image slot loading overlay ── */
.img-slot-loading {
  position: absolute;
  inset: 0;
  background: rgba(3, 12, 24, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  z-index: 10;
  gap: 4px;
}

/* ── Subtle hover on action buttons ── */
.action-btn {
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.action-btn:active {
  transform: scale(0.95);
}

/* ── Login error shake animation ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

#admin-login-error {
  animation: none;
}

#admin-login-error.visible {
  animation: shake 0.35s ease;
}

/* ── Stat card value pulse on update ── */
.admin-stat-card .value {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Light theme toast overrides ── */
[data-theme="light"] .u-phix-toast.toast-success {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.4);
  color: #16a34a;
}

[data-theme="light"] .u-phix-toast.toast-error {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.35);
  color: #dc2626;
}

[data-theme="light"] .u-phix-toast.toast-info {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

[data-theme="light"] .img-slot-loading {
  background: rgba(255, 255, 255, 0.8);
}

/* =============================================
   MOBILE RESPONSIVE — Admin
   =============================================*/

@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    flex-direction: column;
    z-index: 998;
    max-width: 100%;
    width: 100%;
  }
  
  .admin-sidebar.open {
    display: flex;
  }
  
  .admin-main {
    height: auto;
    overflow-y: visible;
  }
  
  .admin-topbar {
    padding: 12px 16px;
  }
  
  .admin-content {
    padding: 16px;
  }
  
  .admin-stats,
  .admin-stats-2 {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  
  .admin-stat-card {
    padding: 16px;
  }
  
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-table {
    min-width: 100%;
  }
  
  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.75rem;
  }
  
  .img-upload-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .admin-form {
    padding: 16px;
  }
  
  .action-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}