/* =====================================================
   Blog Autopilot — UI  (Poppins, clean card-based)
   ===================================================== */

/* ----------  Variables  ---------- */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #4338ca;
  --primary-light:  #ede9fe;
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --info:           #0284c7;
  --info-light:     #e0f2fe;

  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;

  --sidebar-bg:     #1e1b4b;
  --sidebar-text:   rgba(255,255,255,0.78);
  --sidebar-active: #4f46e5;
  --sidebar-hover:  rgba(255,255,255,0.08);

  --radius-sm: 0.375rem;
  --radius:    0.625rem;
  --radius-lg: 0.875rem;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.14);

  --sidebar-width: 256px;
  --topbar-height: 60px;
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ----------  Layout  ---------- */
#wrapper {
  display: flex;
  min-height: 100vh;
}

/* ----------  Sidebar  ---------- */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.875rem 1rem;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  z-index: 1040;
}

/* logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.5rem 0.75rem;
  text-decoration: none;
}

.sidebar-logo:hover { text-decoration: none; }

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.logo-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.logo-tagline {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--sidebar-text);
  display: block;
  letter-spacing: 0.02em;
}

#sidebar hr {
  border-color: rgba(255,255,255,0.1);
  margin: 0.5rem 0;
}

.nav-section-label {
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0.75rem 0.75rem 0.25rem;
  display: block;
}

#sidebar .nav { gap: 2px; }

#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 0.845rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

#sidebar .nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

#sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

#sidebar .nav-link.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

#sidebar .nav-link.active i { opacity: 1; }

/* sidebar user footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: background 0.15s;
}

.sidebar-user-btn:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ----------  Mobile overlay  ---------- */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 1035;
  backdrop-filter: blur(2px);
}

#sidebar-overlay.show { display: block; }

/* ----------  Page content  ---------- */
#page-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ----------  Topbar  ---------- */
#topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.875rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

#sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

#sidebar-toggle:hover {
  color: var(--text);
  background: var(--bg);
}

.topbar-breadcrumb {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.topbar-breadcrumb a:hover { color: var(--text); }

.topbar-sep {
  margin: 0 0.375rem;
  color: var(--border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------  Main content  ---------- */
#main-content {
  flex: 1;
  padding: 1.75rem 1.5rem;
}

/* ----------  Section headings  ---------- */
.section-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

/* ----------  Cards  ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card-header {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.card-body { padding: 1.25rem; }

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

/* ----------  Stat cards  ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ----------  Tables  ---------- */
.table { font-size: 0.855rem; margin-bottom: 0; }

.table thead th {
  font-size: 0.705rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border) !important;
  padding: 0.75rem 1rem;
  white-space: nowrap;
  background: #f8fafc;
  border-top: none;
}

.table tbody td {
  vertical-align: middle;
  padding: 0.75rem 1rem;
  border-color: var(--border);
}

.table tbody tr:hover { background: #f8fafc; }

.table-responsive { border-radius: var(--radius-lg); }

/* ----------  Buttons  ---------- */
.btn {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  border-radius: var(--radius-sm);
  font-size: 0.855rem;
  letter-spacing: 0.01em;
  transition: all 0.15s;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
}

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

.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

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

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

/* ----------  Forms  ---------- */
.form-control,
.form-select {
  font-family: 'Poppins', sans-serif;
  font-size: 0.875rem;
  border-color: var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.13);
  outline: none;
}

.form-label {
  font-weight: 500;
  font-size: 0.845rem;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.form-text {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ----------  Badges  ---------- */
.badge {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  border-radius: 100px;
  padding: 0.28em 0.7em;
}

/* ----------  Alerts  ---------- */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.alert-success  { background: var(--success-light);  color: #15803d; }
.alert-danger   { background: var(--danger-light);   color: #b91c1c; }
.alert-warning  { background: var(--warning-light);  color: #b45309; }
.alert-info     { background: var(--info-light);     color: #0369a1; }

/* ----------  Toast notifications  ---------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 3rem);
}

.wp-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  pointer-events: all;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.34,1.56,0.64,1), opacity 0.32s;
}

.wp-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.wp-toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.wp-toast-body { flex: 1; min-width: 0; }

.wp-toast-title {
  font-weight: 600;
  font-size: 0.845rem;
  color: var(--text);
  line-height: 1.3;
}

.wp-toast-message {
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.wp-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.wp-toast-close:hover { color: var(--text-muted); }

.wp-toast--success .wp-toast-icon { color: var(--success); }
.wp-toast--danger  .wp-toast-icon { color: var(--danger); }
.wp-toast--warning .wp-toast-icon { color: var(--warning); }
.wp-toast--info    .wp-toast-icon { color: var(--info); }

.wp-toast--success { border-left: 3px solid var(--success); }
.wp-toast--danger  { border-left: 3px solid var(--danger); }
.wp-toast--warning { border-left: 3px solid var(--warning); }
.wp-toast--info    { border-left: 3px solid var(--info); }

/* ----------  Confirm dialog  ---------- */
#wp-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  backdrop-filter: blur(4px);
}

#wp-confirm-overlay.show {
  opacity: 1;
  pointer-events: all;
}

#wp-confirm-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.75rem 1.75rem;
  max-width: 400px;
  width: 100%;
  transform: scale(0.93) translateY(-10px);
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
}

#wp-confirm-overlay.show #wp-confirm-dialog {
  transform: scale(1) translateY(0);
}

.confirm-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1.25rem;
}

.confirm-icon-wrap--danger  { background: var(--danger-light);  color: var(--danger); }
.confirm-icon-wrap--warning { background: var(--warning-light); color: var(--warning); }
.confirm-icon-wrap--info    { background: var(--primary-light); color: var(--primary); }

#wp-confirm-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.5rem;
}

#wp-confirm-message {
  font-size: 0.87rem;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.55;
}

#wp-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

#wp-confirm-actions .btn {
  min-width: 110px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* ----------  Code  ---------- */
code {
  font-size: 0.82em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--primary-dark);
}

/* ----------  Severity bar  ---------- */
.severity-bar { width: 80px; }

/* ----------  Dropdown  ---------- */
.dropdown-menu {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.855rem;
}

.dropdown-item {
  font-size: 0.855rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1px 4px;
  width: calc(100% - 8px);
}

.dropdown-divider { margin: 0.25rem 0; }

/* ----------  Responsive  ---------- */
@media (max-width: 991.98px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  #sidebar-toggle {
    display: flex;
  }

  #main-content {
    padding: 1.25rem 1rem;
  }
}

@media (max-width: 575.98px) {
  #main-content { padding: 1rem 0.875rem; }
  .stat-value   { font-size: 1.5rem; }
  #topbar       { padding: 0 1rem; }
  #toast-container { bottom: 1rem; right: 1rem; width: calc(100vw - 2rem); }
  #wp-confirm-dialog { padding: 1.5rem 1.25rem 1.25rem; }
}

/* ----------  Shared responsive helpers  ---------- */

/* Breadcrumb separator in topbar */
.topbar-sep { color: var(--border); margin: 0 0.25rem; }

/* Topbar breadcrumb links */
.topbar-breadcrumb a:hover { color: var(--text); text-decoration: underline; }

/* Modal improvements */
.modal-content {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border) !important;
}

.modal-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1rem 1.25rem;
}

.modal-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
}

.modal-body { padding: 1.25rem; }

/* Form switch styling */
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Table inside a card — remove top border on first row */
.card .table thead th:first-child { border-radius: 0; }
.card > .table-responsive { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Empty state icon circles */
.empty-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  color: var(--primary);
}

/* Scrollable filter row */
.filter-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar { display: none; }

/* Danger zone card border */
.danger-zone-card {
  border-color: rgba(220,38,38,0.3) !important;
}

.danger-zone-header {
  background: var(--danger-light);
  color: var(--danger);
}

/* Better focus rings */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Responsive width utility — full-width on XS, auto on SM+ */
@media (min-width: 576px) {
  .w-sm-auto { width: auto !important; }
}

/* GSC chart — taller on larger screens */
@media (min-width: 576px) {
  .gsc-chart-wrap { height: 300px !important; }
}
