/**
 * Medi Blues Blog - Modern Admin Dashboard Design System
 * Premium healthcare aesthetic with glassmorphism, responsive grid,
 * smooth micro-animations, and accessible form controls.
 */

:root {
  /* Brand color tokens from mediblues.com */
  --mb-primary: #136dec;
  --mb-primary-hover: #0d55bc;
  --mb-primary-light: #eff6ff;
  --mb-primary-border: #bfdbfe;
  --mb-accent: #10b981;
  --mb-accent-hover: #059669;
  --mb-accent-light: #ecfdf5;
  --mb-heading: #0f172a;
  --mb-text: #334155;
  --mb-muted: #64748b;
  --mb-subtle: #94a3b8;
  --mb-line: #e2e8f0;
  --mb-line-hover: #cbd5e1;
  --mb-bg: #f8fafc;
  --mb-surface: #ffffff;
  --mb-danger: #ef4444;
  --mb-danger-hover: #dc2626;
  --mb-danger-light: #fef2f2;
  --mb-warning: #f59e0b;
  --mb-warning-light: #fffbeb;

  /* Elevation shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 38px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(15, 23, 42, 0.08);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--mb-bg);
  color: var(--mb-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Admin Header with Glassmorphism
   ========================================================================== */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(16, 24, 34, 0.94);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.admin-header-inner {
  width: min(100% - 2.5rem, 1220px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1.5rem;
}

.admin-brand-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-brand-link {
  display: flex;
  align-items: center;
  background: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.admin-brand-link:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

.admin-brand-logo {
  height: 34px;
  width: auto;
  max-width: 145px;
  object-fit: contain;
  display: block;
}

.admin-title-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-title-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.admin-pill-tag {
  background: rgba(19, 109, 236, 0.35);
  border: 1px solid rgba(19, 109, 236, 0.6);
  color: #93c5fd;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.backend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.db-indicator {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
}

.backend-indicator.offline {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
}

.backend-indicator.offline .backend-pulse-dot {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: none;
}

.backend-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-ghost-light {
  color: #cbd5e1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 500;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--mb-primary), #0284c7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Login Experience (No GitHub Token Required!)
   ========================================================================== */
.login-container {
  min-height: calc(100vh - 75px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background: radial-gradient(circle at 50% 20%, rgba(19, 109, 236, 0.08), transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.05), transparent 50%),
              #f8fafc;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--mb-line);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  transition: transform var(--transition-normal);
}

.login-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon-badge {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--mb-primary-light), #e0f2fe);
  border: 1px solid var(--mb-primary-border);
  color: var(--mb-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.login-card-header h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--mb-heading);
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}

.login-card-header p {
  font-size: 0.92rem;
  color: var(--mb-muted);
  margin: 0;
}

.login-notice {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: #166534;
}

.login-notice-icon {
  flex-shrink: 0;
  color: #16a34a;
  margin-top: 1px;
}

.backend-offline-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 2rem 0.5rem 2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #991b1b;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.08);
}

.backend-offline-banner svg {
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 2px;
}

.backend-offline-content strong {
  display: block;
  font-weight: 700;
  color: #b91c1c;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.backend-offline-content p {
  margin: 0;
  line-height: 1.45;
  color: #7f1d1d;
}

.backend-offline-content .offline-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

.backend-offline-content .offline-link:hover {
  color: #1e40af;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mb-heading);
  margin-bottom: 0.45rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--mb-subtle);
  pointer-events: none;
}

.form-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.72rem 1rem;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--mb-heading);
  transition: all var(--transition-fast);
}

.input-with-icon .form-input {
  padding-left: 42px;
}

.form-input:focus {
  outline: none;
  border-color: var(--mb-primary);
  box-shadow: 0 0 0 3px rgba(19, 109, 236, 0.18);
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--mb-subtle);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.password-toggle-btn:hover {
  color: var(--mb-text);
}

.form-row-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--mb-muted);
  user-select: none;
}

.custom-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--mb-primary);
  cursor: pointer;
}

/* ==========================================================================
   Primary Buttons & CTA
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--mb-primary), var(--mb-primary-hover));
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.72rem 1.4rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(19, 109, 236, 0.3);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(19, 109, 236, 0.4);
  background: linear-gradient(135deg, #1d7af8, var(--mb-primary-hover));
}

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

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.w-full {
  width: 100%;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #ffffff;
  color: var(--mb-heading);
  border: 1px solid var(--mb-line);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--mb-bg);
  border-color: var(--mb-line-hover);
  color: var(--mb-heading);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #ffffff;
  color: var(--mb-danger);
  border: 1px solid #fecaca;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  background: var(--mb-danger-light);
  border-color: var(--mb-danger);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
}

/* ==========================================================================
   Admin Main Dashboard Layout
   ========================================================================== */
.admin-container {
  width: min(100% - 2.5rem, 1220px);
  margin: 2rem auto 4rem;
}

/* Top Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-info h3 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--mb-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--mb-heading);
  margin: 0.2rem 0 0;
  line-height: 1.2;
}

.stat-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-blue {
  background: var(--mb-primary-light);
  color: var(--mb-primary);
}

.stat-icon-green {
  background: var(--mb-accent-light);
  color: var(--mb-accent);
}

.stat-icon-amber {
  background: var(--mb-warning-light);
  color: var(--mb-warning);
}

.stat-icon-purple {
  background: #f3e8ff;
  color: #9333ea;
}

/* Content Controls / Filter Bar */
.controls-card {
  background: #ffffff;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.controls-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.search-box {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 380px;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 38px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  background: var(--mb-bg);
  transition: all var(--transition-fast);
}

.search-input:focus {
  background: #ffffff;
  outline: none;
  border-color: var(--mb-primary);
  box-shadow: 0 0 0 3px rgba(19, 109, 236, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mb-subtle);
  pointer-events: none;
}

.filter-select {
  padding: 0.65rem 2rem 0.65rem 1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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") no-repeat right 0.75rem center;
  background-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  color: var(--mb-heading);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--mb-primary);
}

/* ==========================================================================
   Article Grid & Cards
   ========================================================================== */
.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.article-card {
  background: #ffffff;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  transition: all var(--transition-fast);
}

.article-card:hover {
  border-color: var(--mb-primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.article-card-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  min-width: 0;
}

.article-thumb-wrapper {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
  border: 1px solid var(--mb-line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-thumb-placeholder {
  color: var(--mb-subtle);
}

.article-content-details {
  flex: 1;
  min-width: 0;
}

.article-badges-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--mb-primary-light);
  color: var(--mb-primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.status-badge.published {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.draft {
  background: #fef3c7;
  color: #b45309;
}

.article-title-link {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mb-heading);
  margin: 0 0 0.3rem;
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.article-title-link:hover {
  color: var(--mb-primary);
}

.article-excerpt-text {
  font-size: 0.88rem;
  color: var(--mb-muted);
  margin: 0 0 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-meta-info {
  font-size: 0.8rem;
  color: var(--mb-subtle);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.article-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: #ffffff;
  border: 1px dashed var(--mb-line);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--mb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mb-subtle);
  margin: 0 auto 1.25rem;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: var(--mb-heading);
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--mb-muted);
  max-width: 440px;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

/* ==========================================================================
   Slide-Over Editor Drawer & Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-content {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 780px);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  z-index: 250;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.drawer-content.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--mb-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mb-heading);
}

.btn-close {
  background: none;
  border: none;
  color: var(--mb-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background: var(--mb-bg);
  color: var(--mb-heading);
}

.drawer-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--mb-line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--mb-bg);
}

/* Category Suggestions Chips */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chip-btn {
  background: var(--mb-bg);
  border: 1px solid var(--mb-line);
  color: var(--mb-text);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  background: var(--mb-primary-light);
  border-color: var(--mb-primary-border);
  color: var(--mb-primary);
}

/* Direct Drag and Drop Image Dropzone */
.image-dropzone-box {
  border: 2px dashed var(--mb-line-hover);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--mb-bg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.image-dropzone-box:hover,
.image-dropzone-box.drag-over {
  border-color: var(--mb-primary);
  background: var(--mb-primary-light);
}

.dropzone-icon-circle {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: var(--mb-primary);
  box-shadow: var(--shadow-xs);
}

.dropzone-label-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mb-heading);
  margin-bottom: 0.25rem;
}

.dropzone-label-sub {
  font-size: 0.8rem;
  color: var(--mb-muted);
}

.image-preview-box {
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: #ffffff;
}

.image-preview-thumb-lg {
  width: 100px;
  height: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}

.image-preview-thumb-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-details {
  flex: 1;
  min-width: 0;
}

.image-preview-filename {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--mb-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-preview-meta {
  font-size: 0.8rem;
  color: #10b981;
  font-weight: 500;
}

/* Markdown / Content Editor Toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--mb-bg);
  border: 1px solid var(--mb-line);
  border-bottom: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.toolbar-btn {
  background: none;
  border: none;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mb-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: #e2e8f0;
  color: var(--mb-heading);
}

.body-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 1rem;
  border: 1px solid var(--mb-line);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  min-height: 260px;
  resize: vertical;
}

.body-textarea:focus {
  outline: none;
  border-color: var(--mb-primary);
}

/* Editor Tabs (Write vs Preview) */
.editor-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mb-muted);
  padding: 4px 8px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--mb-primary);
  border-color: var(--mb-primary);
}

.preview-rendered-box {
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: #ffffff;
  min-height: 260px;
  max-height: 500px;
  overflow-y: auto;
}

/* Switch Toggle for Published */
.toggle-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 34px;
  transition: .3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
  background-color: var(--mb-accent);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--mb-heading);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--mb-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(20px);
  opacity: 0;
  animation: toast-in 0.3s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  border-left-color: var(--mb-accent);
}

.toast.toast-error {
  border-left-color: var(--mb-danger);
}

@keyframes toast-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Utility & Form Layout Classes (Zero Inline Styles)
   ========================================================================== */
.login-default-hint {
  font-size: 0.78rem;
  color: var(--mb-subtle);
}

.req-star {
  color: var(--mb-danger);
}

.slug-preview-bar {
  font-size: 0.78rem;
  color: var(--mb-subtle);
  margin-top: 4px;
}

.slug-code {
  color: var(--mb-primary);
  font-family: monospace;
}

.grid-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toggle-wrap-outer {
  margin-top: 0.85rem;
}

.toggle-label-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mb-heading);
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.char-count-text {
  font-size: 0.78rem;
  color: var(--mb-subtle);
}

.preview-actions-row {
  display: flex;
  gap: 0.5rem;
}

.manual-url-toggle-bar {
  margin-top: 0.5rem;
  text-align: right;
}

.btn-link-underline {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--mb-primary);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link-underline:hover {
  color: var(--mb-primary-hover);
}

.manual-url-container {
  margin-top: 0.5rem;
}

.form-label-flush {
  margin-bottom: 0;
}

.reader-preview-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: min(100%, 820px);
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  box-shadow: var(--shadow-xl);
}

.btn-close-absolute {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}

.password-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: min(100%, 420px);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
}

.modal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-card-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--mb-heading);
}

.modal-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.toast-msg-text {
  flex: 1;
}

.status-dot {
  font-size: 0.6rem;
}

/* Reader Preview Inside Modal */
.reader-preview-meta-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.reader-preview-date {
  font-size: 0.82rem;
  color: #64748b;
}

.reader-preview-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 1rem;
  line-height: 1.3;
}

.reader-preview-excerpt {
  font-size: 1.1rem;
  color: #475569;
  font-weight: 500;
  line-height: 1.6;
  border-left: 3px solid #136dec;
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

.reader-preview-hero {
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  max-height: 400px;
  background: #f1f5f9;
}

.reader-preview-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reader-preview-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #334155;
  margin-top: 1.5rem;
}

/* Markdown Rendered Content Styles */
.preview-empty-text {
  color: #94a3b8;
  font-style: italic;
}

.preview-h2 {
  font-size: 1.45rem;
  color: #0f172a;
  margin: 1.8rem 0 0.6rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3rem;
}

.preview-h3 {
  font-size: 1.2rem;
  color: #0f172a;
  margin: 1.5rem 0 0.5rem;
}

.preview-blockquote {
  border-left: 4px solid #136dec;
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: #f0f4fc;
  color: #334155;
}

.preview-li {
  margin-left: 1.5rem;
  list-style-type: disc;
}

.preview-p {
  line-height: 1.7;
  margin-bottom: 1rem;
  color: #334155;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .admin-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .article-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--mb-line);
  }

  .controls-card {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-left {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .drawer-content {
    width: 100%;
  }
}

/* ==========================================================================
   User Profile Pill & Header Menu
   ========================================================================== */
.user-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: all var(--transition-fast);
}

.user-info-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.user-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.user-pill-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill-role {
  font-size: 0.68rem;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* ==========================================================================
   Auth Card & Tab Switcher (Sign In / Sign Up)
   ========================================================================== */
.auth-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--mb-line);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transition: transform var(--transition-normal);
}

.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--mb-line);
}

.auth-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 0.75rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--mb-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab-btn:hover {
  color: var(--mb-heading);
  background: rgba(255, 255, 255, 0.5);
}

.auth-tab-btn.active {
  color: var(--mb-primary);
  background: #ffffff;
  border-bottom-color: var(--mb-primary);
}

.auth-tab-content {
  padding: 2.25rem;
}

.auth-steps-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.5rem;
}

.auth-step-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--mb-muted);
}

.auth-step-item.active {
  color: var(--mb-primary);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.auth-step-item.active .step-num {
  background: var(--mb-primary);
  color: #ffffff;
}

.auth-step-arrow {
  color: var(--mb-subtle);
  font-size: 0.85rem;
  font-weight: 700;
}

.signup-badge {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5) !important;
  border-color: #a7f3d0 !important;
  color: #059669 !important;
}

.field-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--mb-subtle);
  margin-top: 0.35rem;
}

.auth-card-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--mb-line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--mb-muted);
}

.btn-link-action {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mb-primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.btn-link-action:hover {
  color: var(--mb-primary-hover);
}

/* ==========================================================================
   User Profile Modal
   ========================================================================== */
.profile-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: min(100%, 580px);
  padding: 2.25rem;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--mb-primary);
}

.profile-hero-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.profile-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mb-primary), #0284c7);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(19, 109, 236, 0.25);
  flex-shrink: 0;
}

.profile-hero-info {
  flex: 1;
}

.profile-hero-name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.profile-hero-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--mb-heading);
}

.profile-hero-username {
  font-size: 0.88rem;
  color: var(--mb-muted);
  margin-top: 0.2rem;
  font-weight: 500;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.role-admin {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.role-editor {
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

/* User ID Card */
.user-id-box {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  color: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.user-id-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.user-id-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.user-id-storage-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #a7f3d0;
}

.user-id-storage-tag code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: #e2e8f0;
}

.storage-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

.user-id-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.user-id-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.btn-copy-id {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-copy-id:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-copy-id.copied {
  background: #059669;
  border-color: #10b981;
}

.user-id-subtext {
  margin: 0.5rem 0 0;
  font-size: 0.74rem;
  color: #94a3b8;
}

/* Profile Tabs */
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--mb-line);
  margin-bottom: 1.25rem;
}

.profile-tab-btn {
  background: none;
  border: none;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mb-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-tab-btn:hover {
  color: var(--mb-heading);
}

.profile-tab-btn.active {
  color: var(--mb-primary);
  border-bottom-color: var(--mb-primary);
}

/* Profile Meta Grid */
.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.profile-meta-item {
  background: var(--mb-bg);
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--mb-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.meta-val {
  font-size: 0.95rem;
  color: var(--mb-heading);
  font-weight: 600;
  word-break: break-all;
}

.profile-security-callout {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: #166534;
}

.security-callout-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.input-readonly {
  background-color: #f1f5f9;
  cursor: not-allowed;
  color: var(--mb-muted);
}

/* Stored Users Table */
.stored-users-intro {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--mb-text);
}

.stored-users-table-wrapper {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--mb-line);
  border-radius: var(--radius-md);
}

.stored-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.stored-users-table th {
  background: #f8fafc;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  color: var(--mb-muted);
  border-bottom: 1px solid var(--mb-line);
  position: sticky;
  top: 0;
}

.stored-users-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--mb-line);
  color: var(--mb-heading);
}

.stored-users-table tr:last-child td {
  border-bottom: none;
}
