/* admin.css — SSMM Master Admin Panel — Glassmorphism Design System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Dynamic Frost Glass Tint */
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-bg-hover: rgba(255, 255, 255, 0.18);
  --glass-bg-active: rgba(255, 255, 255, 0.25);
  
  /* Specular Light Borders (Highlight Top/Left, Soft Bottom/Right) */
  --glass-border-light: rgba(255, 255, 255, 0.45);
  --glass-border-dark: rgba(255, 255, 255, 0.1);
  
  /* Depth & Atmospheric Specular Shadows */
  --glass-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.25),
    0 10px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -1px 2px rgba(0, 0, 0, 0.2);

  /* Apple Heavy Diffusion Blur & Color Saturation */
  --glass-blur: blur(40px) saturate(210%);

  /* UI Color Tokens */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: rgba(255, 255, 255, 0.45);

  --accent-blue: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.4);

  --radius-sm: 16px;
  --radius-md: 28px;
  --radius-pill: 9999px;

  --transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);

  /* Original Background & Roles (Retained) */
  --bg-image: url('assets/bg-liquid.png') center/cover no-repeat;
  --bg-gradient: radial-gradient(circle at 15% 50%, #4c4177, #2a2254 40%, #0f0c29 100%);
  --accent: #7c6ff7;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --role-admin-bg: rgba(249, 115, 22, 0.2);
  --role-admin-text: #fb923c;
  --role-admin-border: rgba(249, 115, 22, 0.4);
  --role-op-bg: rgba(59, 130, 246, 0.2);
  --role-op-text: #60a5fa;
  --role-op-border: rgba(59, 130, 246, 0.4);
  --role-other-bg: rgba(148, 163, 184, 0.15);
  --role-other-text: rgba(255,255,255,0.6);
  --role-other-border: rgba(148, 163, 184, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Improve text readability on bright backgrounds */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-gradient); /* fallback/underlay */
}

body::before {
  content: "";
  position: fixed;
  inset: -10%;
  width: 120%;
  height: 120%;
  background: var(--bg-image);
  z-index: -1;
  filter: url(#liquid-glass-filter);
  opacity: 0.85; /* blend with dark gradient slightly */
  
  /* Prevent flickering/repainting in WebKit/Blink */
  transform: translateZ(0);
  will-change: transform, filter;
  backface-visibility: hidden;
}
input, button, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: #fff; text-shadow: 0 0 8px var(--accent-glow); }

/* Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-light);
  border-bottom-color: var(--glass-border-dark);
  border-right-color: var(--glass-border-dark);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: var(--transition);
}

.glass:hover {
  background: var(--glass-bg-hover);
}

/* ── Floating Pill / Dock (VisionOS Navigation Bar) ──────────── */
.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.5);
}

/* ── Active Liquid Selection Bulb ───────────────────────────── */
.glass-active-bulb {
  background: var(--accent-blue);
  border-radius: var(--radius-pill);
  box-shadow: 
    0 0 20px var(--accent-glow),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  transition: var(--transition);
}

/* ── Glass Widget Cards ─────────────────────────────────────── */
.glass-card {
  padding: 24px;
  background: rgba(30, 30, 35, 0.35);
  backdrop-filter: blur(45px) saturate(200%);
  -webkit-backdrop-filter: blur(45px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
}








.full-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 41, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

/* ── Typography & Forms ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
input[type="text"], input[type="password"], input[type="url"], input[type="tel"], input[type="email"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 14px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}
select option { background: #24243e; color: #fff; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ── Buttons ─────────────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  transition: var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 30px;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover {
  background: #6a5ce3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-glass {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 30px;
}
.btn-glass:hover { background: rgba(255,255,255,0.15); transform: translateY(-1px); }
.btn-glass:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger-ghost { background: rgba(239, 68, 68, 0.85); color: #fff; border: 1px solid rgba(239, 68, 68, 0.4); box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3), inset 0 1px 1px rgba(255,255,255,0.2); backdrop-filter: blur(8px); text-shadow: none; }
.btn-danger-ghost:hover { background: rgba(239, 68, 68, 1); border-color: rgba(239, 68, 68, 0.8); transform: translateY(-1px); }
.btn-danger-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* Authentication */
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.brand { text-align: center; margin-bottom: 24px; }
.brand-logo { font-size: 40px; }
.brand h1 { color: #fff; font-size: 24px; margin-top: 8px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-muted); font-size: 14px; }

/* ── Admin Header ────────────────────────────────────────────── */
.admin-header {
  height: auto;
  padding: 12px 24px;
  background: rgba(20, 16, 50, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-light);
  border: 1px solid rgba(124,111,247,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-user {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Main content ─────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Section header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.section-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.section-actions { display: flex; gap: 10px; align-items: center; }

/* ── Glass Table ─────────────────────────────────────────────── */
.glass-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.glass-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.glass-table thead tr {
  background: rgba(124, 111, 247, 0.1);
  border-bottom: 1px solid var(--glass-border);
}
.glass-table th {
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.glass-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: var(--transition);
}
.glass-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.glass-table td {
  padding: 14px 16px;
  vertical-align: middle;
}

/* ── User cell ───────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6ff7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-name { font-weight: 500; font-size: 14px; }
.user-id { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }

/* ── Role Tags ───────────────────────────────────────────────── */
.role-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-shadow: 0 0 6px currentColor;
}
.role-tag.admin   { background: var(--role-admin-bg); color: var(--role-admin-text); border: 1px solid var(--role-admin-border); }
.role-tag.operator{ background: var(--role-op-bg);    color: var(--role-op-text);    border: 1px solid var(--role-op-border); }
.role-tag.other   { background: var(--role-other-bg); color: var(--role-other-text); border: 1px solid var(--role-other-border); }
.role-tag.none    { color: var(--text-muted); }

/* ── Skeleton ────────────────────────────────────────────────── */
.skeleton-rows { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.skeleton-row {
  height: 52px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 12, 41, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%; max-width: 480px; padding: 32px; max-height: 90vh; overflow-y: auto;
  position: relative; animation: modalIn 0.22s cubic-bezier(.4,0,.2,1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { color: #fff; font-size: 18px; font-weight: 700; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  padding: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Access Denied card ───────────────────────────────────────── */
.denied-icon { font-size: 48px; text-align: center; }
.denied-card {
  text-align: center;
  max-width: 400px;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.denied-card h2 { font-size: 20px; font-weight: 700; color: var(--danger); }
.denied-card p  { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
#accessDeniedEmail { color: var(--text-primary); font-weight: 500; font-size: 13px; }

/* ── Notification Toast ──────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100000;
  pointer-events: none;
}

.toast {
  min-width: 380px;
  max-width: 480px;
  padding: 18px 24px;
  border-radius: 14px;
  background: #E0E5EC;
  box-shadow: -6px -6px 12px rgba(255,255,255,.85), 6px 6px 12px rgba(0,0,0,.12);
  color: #4A5568;
  font-size: 16px;
  font-weight: 600;
  pointer-events: auto;
  animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  display: flex;
  align-items: center;
  gap: 14px;
}

.toast.toast-closing {
  animation: slideOutRight 0.4s ease forwards;
}

.toast.success { border-left: 6px solid var(--success); }
.toast.warning { border-left: 6px solid var(--warning); }
.toast.info { border-left: 6px solid var(--accent); }
.toast.danger, .toast.error { border-left: 6px solid var(--danger); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(120%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); height: auto; margin-bottom: 0; padding-top: 18px; padding-bottom: 18px; }
  to { opacity: 0; transform: translateX(120%); height: 0; margin-bottom: -12px; padding-top: 0; padding-bottom: 0; border: none; overflow: hidden; }
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-secondary); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.stat-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .admin-header { padding: 0 16px; }
  .admin-main   { padding: 16px; }
  .modal-card   { padding: 24px 18px; }
  .section-header { flex-direction: column; align-items: stretch; }
  .section-actions { flex-wrap: wrap; }
}
/* ── Custom Scrollbars ───────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Placeholders & Custom Select Arrows */
::placeholder {
  color: rgba(255, 255, 255, 0.35) !important;
  font-style: italic;
  font-weight: 300;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px !important;
}
