:root {
  --wp-dark: #0f172a;
  --wp-dark-2: #1e293b;
  --wp-dark-hover: rgba(255,255,255,.08);
  --wp-blue: #2563eb;
  --wp-blue-hover: #1d4ed8;
  --wp-bg: #f1f5f9;
  --wp-card: #ffffff;
  --wp-border: #e2e8f0;
  --wp-border-strong: #cbd5e1;
  --wp-text: #0f172a;
  --wp-muted: #475569;
  --wp-green: #16a34a;
  --wp-amber: #d97706;
  --wp-red: #dc2626;
  --wp-radius: 10px;
  --wp-shadow: 0 1px 3px rgba(15,23,42,.05), 0 4px 16px -4px rgba(15,23,42,.04);
}
@view-transition { navigation: auto; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--wp-bg);
  color: var(--wp-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--wp-blue); text-decoration: none; }
a:hover { color: var(--wp-blue-hover); }

/* Modern Top Admin Bar */
.wp-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(15,23,42,.95);
  backdrop-filter: blur(12px);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.wp-topbar-left, .wp-topbar-right { display: flex; align-items: center; gap: 10px; }
.wp-topbar a { color: #e2e8f0; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 7px; transition: background .15s, color .15s; font-weight: 500; }
.wp-topbar a:hover { background: var(--wp-dark-hover); color: #fff; }
.wp-brand-pill { font-weight: 800; letter-spacing: .02em; color: #fff; font-size: 14px; }
.wp-theme-chip { background: rgba(56,189,248,.14); color: #7dd3fc; border: 1px solid rgba(125,211,252,.22); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* Layout */
.wp-shell { display: flex; padding-top: 48px; min-height: 100vh; }
.wp-sidebar {
  width: 240px;
  background: var(--wp-dark);
  color: #e2e8f0;
  position: fixed;
  top: 48px; bottom: 0; left: 0;
  overflow-y: auto;
  padding: 14px 10px 28px;
  z-index: 90;
  border-right: 1px solid rgba(255,255,255,.06);
}
.wp-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.wp-menu-sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 8px; }
.wp-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  transition: background .14s, color .14s;
}
.wp-menu a:hover { background: var(--wp-dark-hover); color: #fff; }
.wp-menu a.active { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37,99,235,.32); }
.wp-menu .ico { width: 20px; display: inline-block; text-align: center; margin-right: 8px; }
.wp-menu-badge { background: #ef4444; color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.wp-menu-badge.info { background: rgba(99,102,241,.28); color: #c7d2fe; }

.wp-main {
  margin-left: 240px;
  flex: 1;
  padding: 24px 30px 48px;
  max-width: 1440px;
}

.wp-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.wp-header-row h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* Alerts */
.wp-notice {
  background: #fff;
  border: 1px solid var(--wp-border);
  border-left: 4px solid var(--wp-green);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  box-shadow: var(--wp-shadow);
}
.wp-notice.error { border-left-color: var(--wp-red); background: #fef2f2; }
.wp-notice.info { border-left-color: var(--wp-blue); }

/* Cards / Metaboxes */
.wp-box {
  background: var(--wp-card);
  border: 1px solid var(--wp-border);
  border-radius: var(--wp-radius);
  box-shadow: var(--wp-shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.wp-box-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--wp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
}
.wp-box-head h2, .wp-box-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.wp-box-body { padding: 16px 18px; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  background: #fff;
  border: 1px solid var(--wp-border);
  border-radius: var(--wp-radius);
  padding: 16px 18px;
  box-shadow: var(--wp-shadow);
}
.kpi-label { font-size: 11.5px; color: var(--wp-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi-val { font-size: 28px; font-weight: 800; margin-top: 4px; color: var(--wp-dark); letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--wp-muted); margin-top: 2px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--wp-border-strong);
  background: #fff;
  color: var(--wp-text);
  line-height: 1.4;
  transition: all .14s ease;
}
.btn:hover { background: #f8fafc; border-color: var(--wp-blue); color: var(--wp-blue); }
.btn-primary { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(37,99,235,.22); }
.btn-primary:hover { opacity: .94; color: #fff; transform: translateY(-1px); }
.btn-danger { background: #fff; color: var(--wp-red); border-color: #fecaca; }
.btn-danger:hover { background: var(--wp-red); color: #fff; border-color: var(--wp-red); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* Forms */
.form-grid { display: grid; gap: 14px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; color: var(--wp-text); }
.field .hint { font-size: 12px; color: var(--wp-muted); margin-top: 4px; }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="number"],
.field input[type="password"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--wp-border-strong);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--wp-text);
  transition: border-color .14s, box-shadow .14s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--wp-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--wp-blue); }

/* Editor & SERP Preview */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.title-input {
  width: 100%; font-size: 22px; font-weight: 700; padding: 12px 14px;
  border: 1px solid var(--wp-border-strong); border-radius: var(--wp-radius);
  margin-bottom: 12px; background: #fff; letter-spacing: -0.02em;
}
.title-input:focus { outline: none; border-color: var(--wp-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--wp-border-strong); border-bottom: none; border-radius: 8px 8px 0 0; }
.rte-toolbar button { padding: 5px 9px; background: #fff; border: 1px solid var(--wp-border-strong); border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--wp-text); }
.rte-toolbar button:hover { background: #eff6ff; border-color: var(--wp-blue); color: var(--wp-blue); }
.rte-area { min-height: 320px; padding: 16px; border: 1px solid var(--wp-border-strong); border-radius: 0 0 8px 8px; background: #fff; outline: none; line-height: 1.7; }
.rte-area img { max-width: 100%; height: auto; border-radius: 6px; }
.rte-code { width: 100%; min-height: 320px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; padding: 14px; border: 1px solid var(--wp-border-strong); border-radius: 0 0 8px 8px; }
.serp-preview { background: #fff; border: 1px solid var(--wp-border); border-radius: 10px; padding: 14px 16px; }
.serp-url { font-size: 12px; color: #166534; margin-bottom: 2px; word-break: break-all; }
.serp-title { font-size: 18px; color: #1a0dab; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
.serp-desc { font-size: 13px; color: #4d5156; line-height: 1.45; }

/* Tables */
.wp-table { width: 100%; border-collapse: collapse; background: #fff; }
.wp-table th, .wp-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--wp-border); vertical-align: middle; }
.wp-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--wp-muted); font-weight: 700; background: #f8fafc; }
.wp-table tr:hover td { background: #f8fafc; }
.row-actions { font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.pill-good { background: #dcfce7; color: #15803d; }
.pill-ok { background: #fef3c7; color: #b45309; }
.pill-poor { background: #fee2e2; color: #b91c1c; }
.pill-blue { background: #dbeafe; color: #1d4ed8; }
.pill-gray { background: #e2e8f0; color: #334155; }

/* SEO Score Box */
.seo-meter { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.seo-circle { width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; color: #fff; flex-shrink: 0; }
.seo-circle.good { background: var(--wp-green); }
.seo-circle.ok { background: var(--wp-amber); }
.seo-circle.poor { background: var(--wp-red); }
.seo-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.seo-checks li { display: flex; gap: 8px; align-items: flex-start; }

/* Theme Gallery */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.theme-card { background: #fff; border: 2px solid var(--wp-border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--wp-shadow); transition: transform .16s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--wp-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.theme-preview { height: 158px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.theme-swatches { display: flex; gap: 6px; }
.theme-swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); }
.theme-info { padding: 14px 16px; flex: 1; }
.theme-actions { padding: 12px 16px; border-top: 1px solid var(--wp-border); background: #f8fafc; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Media Grid */
.dropzone { border: 2px dashed var(--wp-border-strong); border-radius: 12px; padding: 32px 20px; text-align: center; background: #f8fafc; cursor: pointer; margin-bottom: 18px; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--wp-blue); background: #eff6ff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-card { background: #fff; border: 1px solid var(--wp-border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--wp-shadow); }
.media-thumb { aspect-ratio: 16/10; background: #f1f5f9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-meta { padding: 10px 12px; font-size: 12.5px; flex: 1; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.58); backdrop-filter: blur(5px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal-dialog { background: #fff; border-radius: 12px; width: 100%; max-width: 880px; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--wp-border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 70%); }
.login-card { width: 100%; max-width: 390px; background: #fff; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }

@media (max-width: 960px) {
  .wp-sidebar { width: 64px; padding: 10px 6px; }
  .wp-menu .lbl, .wp-menu-badge { display: none; }
  .wp-main { margin-left: 64px; padding: 16px; }
  .editor-layout, .form-2col { grid-template-columns: 1fr; }
}
