/* admin-dashboard-panel/css/main.css */
/* Mandatory: All @imports must be at the very top */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Inter:wght@400;500;600&display=swap');
@import './variables.css';
@import './components/sidebar.css';
@import './components/header.css';
@import './components/tables.css';
@import './components/forms.css';
@import './components/cms-editor.css';
@import './pages/login.css';

/* ── Baseline Reset ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100vh;
  overflow: hidden;
}

body {
  background: var(--gradient-page);
  color: var(--text-body);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-strong);
  font-weight: 700;
  line-height: 1.3;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--purple-500); }

img { display: block; max-width: 100%; }

/* ── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Layout ─────────────────────────────────────────────────── */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

.admin-content {
  flex-grow: 1;
  padding: 1.75rem 2rem;
  overflow-y: auto;
}

/* ── Dashboard Grid ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* ── Stat Card ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-royal);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--purple-200);
}

.stat-card:hover::after { opacity: 1; }

.stat-card__label {
  display: block;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.stat-card__val {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-strong);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
}

.stat-card__trend--up   { background: var(--color-success-soft); color: var(--color-success); }
.stat-card__trend--down { background: var(--color-error-soft);   color: var(--color-error); }

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon svg {
  width: 22px;
  height: 22px;
}

/* Icon color variants */
.stat-card__icon--purple { background: var(--purple-100); color: var(--purple-600); }
.stat-card__icon--green  { background: var(--color-success-soft); color: var(--color-success); }
.stat-card__icon--amber  { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-card__icon--blue   { background: var(--color-info-soft); color: var(--color-info); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn--primary {
  background: var(--gradient-royal);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(61,15,94,0.25);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(61,15,94,0.35);
  color: #fff;
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--border-medium);
}

.btn--outline:hover {
  background: var(--purple-50);
  border-color: var(--purple-300);
  color: var(--color-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn--ghost:hover {
  background: var(--bg-page);
  color: var(--text-strong);
}

.btn--danger {
  background: var(--color-error);
  color: #fff;
  border-color: transparent;
}

.btn--danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn--sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.76rem;
}

.btn--lg {
  padding: 0.75rem 1.75rem;
  font-size: 0.9rem;
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-heading);
  white-space: nowrap;
}

.badge--on-campus { background: var(--purple-100); color: var(--purple-700); }
.badge--online    { background: var(--color-success-soft); color: var(--color-success); }
.badge--hybrid    { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--published { background: var(--color-success-soft); color: var(--color-success); }
.badge--draft     { background: var(--color-warning-soft); color: var(--color-warning); }

/* ── Panel Card ─────────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel__header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
}

.panel__title svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

.panel__body {
  padding: 1.5rem;
}

/* ── Table Container ─────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  margin-bottom: 1rem;
}

/* ── Search Bar (leads.html / courses.html) ──────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--purple-400);
  box-shadow: 0 0 0 3px rgba(123,47,190,0.09);
}

.search-bar svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-strong);
  min-width: 0;
}

.search-bar input::placeholder {
  color: var(--text-faint);
}

/* ── Table Controls / Pagination ─────────────────────────── */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.table-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  font-family: var(--font-heading);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-page {
  padding: 0.42rem 0.9rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-body);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
  background: var(--purple-50);
  border-color: var(--purple-300);
  color: var(--color-primary);
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-page.is-active {
  background: var(--gradient-royal);
  color: #fff;
  border-color: transparent;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── WordPress / Doc Style WYSIWYG Editor ─────────────────── */
.wp-editor-wrap {
  border: 1.5px solid var(--border-soft, #cbd5e1);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.wp-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border-soft, #cbd5e1);
}

.wp-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wp-tb-btn:hover,
.wp-tb-btn.is-active {
  background: #6b21a8;
  color: #ffffff;
  border-color: #6b21a8;
}

.wp-tb-divider {
  width: 1px;
  height: 20px;
  background: #cbd5e1;
  margin: 0 0.25rem;
}

.wp-wysiwyg-editor {
  min-height: 280px;
  max-height: 520px;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #1e293b;
  outline: none;
  background: #ffffff;
}

.wp-wysiwyg-editor h1,
.wp-wysiwyg-editor h2,
.wp-wysiwyg-editor h3 {
  font-family: 'Outfit', sans-serif;
  color: #4c1d95;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.wp-wysiwyg-editor h2 { font-size: 1.35rem; }
.wp-wysiwyg-editor h3 { font-size: 1.15rem; }

.wp-wysiwyg-editor blockquote {
  border-left: 4px solid #8b5cf6;
  padding-left: 0.85rem;
  margin: 1rem 0;
  color: #475569;
  font-style: italic;
  background: #f5f3ff;
  border-radius: 0 8px 8px 0;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.wp-wysiwyg-editor .legal-callout {
  background: #f3e8ff;
  border-left: 4px solid #d8a640;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.wp-code-editor {
  width: 100%;
  min-height: 280px;
  padding: 1rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  background: #0f172a;
  color: #38bdf8;
  border: none;
  outline: none;
  resize: vertical;
}




/* ==========================================
   CMS Toast Notification System
   ========================================== */
#cms-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.cms-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(20, 16, 31, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(147, 51, 234, 0.4);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(147, 51, 234, 0.25);
  color: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  animation: cmsToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.cms-toast--leaving {
  animation: cmsToastOut 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes cmsToastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cmsToastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-16px) scale(0.94); }
}

.cms-toast__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.cms-toast--success .cms-toast__icon {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(16, 185, 129, 0.35));
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

.cms-toast--error .cms-toast__icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(225, 29, 72, 0.35));
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.cms-toast--info .cms-toast__icon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(147, 51, 234, 0.35));
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #c084fc;
}

.cms-toast__body {
  flex: 1;
  min-width: 0;
}

.cms-toast__title {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.3;
  margin-bottom: 2px;
  color: #f8fafc;
}

.cms-toast__message {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #cbd5e1;
  word-break: break-word;
}

.cms-toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
  margin-left: 4px;
}

.cms-toast__close:hover {
  color: #ffffff;
}

.cms-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #a855f7, #ec4899);
  width: 100%;
  animation: cmsToastProgress 4s linear forwards;
}

@keyframes cmsToastProgress {
  from { width: 100%; }
  to { width: 0%; }
}
