/* ── Reset & Base ───────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #0D7C5F;
  --green-dk: #096B51;
  --green-light: #D4F0E7;
  --green-bg: #F0FAF6;
  --blue: #2563EB;
  --blue-bg: #DBEAFE;
  --text: #151221;
  --text-mid: #5A5E7A;
  --text-light: #8A8FA8;
  --white: #FFFFFF;
  --border: #E4E6F0;
  --warm-bg: #F7F8FD;
  --bg: #F5F6FA;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.08);
  --ease: cubic-bezier(.22,1,.36,1);
  --sidebar-w: 220px;
  --topbar-h: 56px;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.6; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dk); }
img { max-width: 100%; height: auto; display: block; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1rem; font-weight: 600; }

/* ── Login Page ────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a1a14 0%, #0D3D2E 100%);
}
.login-card {
  background: var(--white); border-radius: 20px; padding: 48px 40px;
  width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.login-logo { font-size: 28px; font-weight: 800; color: var(--green); margin-bottom: 4px; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-sub { color: var(--text-mid); font-size: 14px; margin-bottom: 28px; }

/* ── Buttons ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .2s var(--ease); border: 2px solid transparent;
  text-decoration: none; font-family: inherit; line-height: 1.5;
}
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dk); border-color: var(--green-dk); color: #fff; }
.btn-outline { background: transparent; color: var(--green); border-color: var(--border); }
.btn-outline:hover { border-color: var(--green); }
.btn-danger { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.btn-danger:hover { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-link {
  background: none; border: none; color: var(--text-mid); font-size: 13px;
  cursor: pointer; font-family: inherit; padding: 4px 8px;
}
.btn-link:hover { color: var(--text); }

/* ── Forms ──────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text); background: var(--white);
  transition: border-color .2s, box-shadow .2s; line-height: 1.6;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,124,95,.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── Alerts ─────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; margin-bottom: 20px;
}
.alert-success { background: var(--green-bg); color: var(--green-dk); border: 1px solid var(--green-light); }
.alert-error { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: var(--blue-bg); color: var(--blue); border: 1px solid #BFDBFE; }

/* ── Info Boxes ─────────────────────── */
.info-box {
  display: flex; gap: 14px; padding: 16px 20px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 14px; line-height: 1.7;
}
.info-box p { margin: 0; }
.info-box strong { font-weight: 700; }
.info-box-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.info-box-green { background: var(--green-bg); border: 1px solid var(--green-light); color: var(--green-dk); }
.info-box-green strong { color: var(--green-dk); }
.info-box-light { background: var(--warm-bg); border: 1px solid var(--border); color: var(--text-mid); }
.info-box-blue { background: var(--blue-bg); border: 1px solid #BFDBFE; color: #1E40AF; }
.info-box-amber { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; }
.section-help { font-size: 13px; color: var(--text-light); margin-bottom: 20px; line-height: 1.7; }

/* ── Live Preview ───────────────── */
.live-preview {
  margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--green-bg); transition: all .2s var(--ease);
}
.live-preview:hover { border-color: var(--green); background: #E6F5EF; }
.live-preview-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; font-size: 13px; color: var(--text-mid);
}
.live-preview-header strong { color: var(--text); }

/* ── Shell Layout ──────────────────── */
.admin-shell { min-height: 100vh; }
.topbar {
  height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { font-size: 20px; font-weight: 800; color: var(--green); }
.topbar-label { font-size: 13px; color: var(--text-light); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; font-weight: 600; color: var(--text-mid); }

/* Site switcher */
.site-switcher { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius); padding: 4px; }
.site-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 16px;
  border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--text-mid); font-family: inherit;
  transition: all .2s;
}
.site-btn.active { background: var(--white); color: var(--text); box-shadow: var(--shadow); }
.site-btn:hover:not(.active) { color: var(--text); }
.site-dot { width: 8px; height: 8px; border-radius: 50%; }
.site-dot.mtu { background: var(--green); }
.site-dot.ou { background: var(--blue); }

/* Sidebar */
.admin-body { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); background: var(--white); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  color: var(--text-mid); transition: all .15s; text-decoration: none;
}
.sidebar-link:hover { background: var(--warm-bg); color: var(--text); }
.sidebar-link.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.sidebar-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; }
.sidebar-publish { margin-top: auto; padding: 12px 14px; line-height: 1.3; }
.sidebar-publish.active, .sidebar-link.sidebar-publish:hover {
  background: var(--green); color: #fff;
}
.sidebar-publish span span { color: inherit; }

/* Main content */
.main-content { flex: 1; padding: 32px; max-width: 1000px; }

/* ── Page Header ───────────────────── */
.page-header { margin-bottom: 32px; }
.page-header h1 { margin-bottom: 4px; }
.page-subtitle { color: var(--text-mid); font-size: 15px; }
.page-header-actions { display: flex; gap: 12px; margin-top: 16px; }

/* ── Stats Grid (Dashboard) ────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 40px;
}
.stat-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; transition: all .2s var(--ease); text-decoration: none; color: var(--text);
}
.stat-card:hover { border-color: var(--green); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--green); letter-spacing: -0.03em; }
.stat-label { font-size: 13px; color: var(--text-mid); font-weight: 500; margin-top: 4px; }

/* ── Quick Actions (Dashboard) ──────── */
.quick-actions h2 { margin-bottom: 16px; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-action {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none;
  transition: all .2s var(--ease);
}
.quick-action:hover { border-color: var(--green); color: var(--green); box-shadow: var(--shadow-hover); }
.quick-action-publish { background: var(--green-bg); border-color: var(--green-light); color: var(--green); }

/* ── Content List ──────────────────── */
.content-list {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.content-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--warm-bg);
}
.content-list-header h3 { font-size: 14px; color: var(--text-mid); }
.content-row {
  display: flex; align-items: center; gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); transition: background .15s;
  text-decoration: none; color: var(--text);
}
.content-row:last-child { border-bottom: none; }
.content-row:hover { background: var(--warm-bg); }
.content-row-img {
  width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden;
  flex-shrink: 0; background: var(--bg);
}
.content-row-img img { width: 100%; height: 100%; object-fit: cover; }
.content-row-body { flex: 1; min-width: 0; }
.content-row-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-row-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.content-row-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Badges ────────────────────────── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-shared { background: var(--green-bg); color: var(--green); }
.badge-mtu { background: var(--green-bg); color: var(--green); }
.badge-ou { background: var(--blue-bg); color: var(--blue); }

/* ── Card Grid ─────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: all .2s var(--ease); cursor: pointer;
}
.card:hover { border-color: var(--green); box-shadow: var(--shadow-hover); }
.card-img { height: 120px; overflow: hidden; background: var(--bg); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 12px; }
.card-body h4 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body p { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ── Publish Page ──────────────────── */
.publish-options { display: flex; gap: 16px; margin-top: 24px; }
.publish-btn {
  flex: 1; padding: 24px; border-radius: var(--radius); text-align: center;
  border: 2px solid var(--border); cursor: pointer; transition: all .2s;
  font-family: inherit; background: var(--white);
}
.publish-btn:hover { border-color: var(--green); background: var(--green-bg); }
.publish-btn h3 { font-size: 16px; margin-bottom: 4px; }
.publish-btn p { font-size: 13px; color: var(--text-mid); }
.publish-log {
  background: #0a1210; color: rgba(255,255,255,.7); padding: 20px;
  border-radius: var(--radius); font-family: monospace; font-size: 13px;
  line-height: 1.8; max-height: 400px; overflow-y: auto; margin-top: 24px;
  display: none;
}
.publish-log.visible { display: block; }

/* ── Image Manager ─────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 48px;
  text-align: center; margin-bottom: 32px; transition: all .2s; cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--green); background: var(--green-bg); }
.upload-zone p { color: var(--text-mid); font-size: 14px; }
.upload-zone strong { color: var(--green); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.image-card {
  border-radius: var(--radius-sm); overflow: hidden; position: relative;
  border: 1px solid var(--border); background: var(--white);
}
.image-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.image-card-name {
  padding: 8px 10px; font-size: 12px; color: var(--text-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-card-delete {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; border: none;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.image-card:hover .image-card-delete { opacity: 1; }

/* ── Editor Tabs (Edit/Preview) ───── */
.editor-tabs {
  display: flex; gap: 0; margin-bottom: -1px; position: relative; z-index: 1;
}
.editor-tab {
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0;
  background: var(--bg); color: var(--text-mid); font-family: inherit; transition: all .15s;
}
.editor-tab:hover { background: var(--warm-bg); color: var(--text); }
.editor-tab.active { background: var(--white); color: var(--text); border-bottom: 1px solid var(--white); }
.content-preview {
  min-height: 400px; padding: 28px; background: var(--white);
  border: 1px solid var(--border); border-radius: 0 8px 8px 8px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; line-height: 1.7; color: #151221;
}
.content-preview h2 { font-size: 1.5rem; margin: 28px 0 12px; font-weight: 700; }
.content-preview h3 { font-size: 1.15rem; margin: 20px 0 8px; font-weight: 600; }
.content-preview p { margin-bottom: 14px; }
.content-preview ul, .content-preview ol { margin: 0 0 14px 24px; }
.content-preview li { margin-bottom: 6px; }
.content-preview strong { font-weight: 700; }
.content-preview a { color: var(--green); text-decoration: underline; }
.content-preview table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.content-preview th { background: var(--green); color: #fff; padding: 10px 14px; text-align: left; font-size: 14px; }
.content-preview td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.content-preview tr:nth-child(even) { background: var(--warm-bg); }

/* ── Preview Panel ─────────────────── */
.preview-toggle {
  position: fixed; top: calc(var(--topbar-h) + 16px); right: 16px; z-index: 90;
}
.preview-toggle-btn {
  padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; font-family: inherit; transition: all .15s;
  background: var(--green); color: #fff; border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(13,124,95,.3);
}
.preview-toggle-btn:hover { background: var(--green-dk); box-shadow: 0 6px 20px rgba(13,124,95,.4); }

.preview-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 79;
  display: none;
}
.preview-overlay.open { display: block; }
.preview-panel {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 50%;
  background: var(--white); border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.08); z-index: 80;
  transform: translateX(100%); transition: transform .35s var(--ease);
  display: flex; flex-direction: column;
}
.preview-panel.open { transform: translateX(0); }
.preview-panel-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-panel-header h3 { font-size: 14px; font-weight: 700; }
.preview-panel-close-btn {
  padding: 6px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  cursor: pointer; background: var(--white); font-size: 13px; font-weight: 600;
  font-family: inherit; color: var(--text-mid); transition: all .15s;
}
.preview-panel-close-btn:hover { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.preview-panel-body {
  flex: 1; overflow-y: auto; padding: 0;
}

/* Mini site preview inside panel */
.preview-site {
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; line-height: 1.5;
  color: #151221;
}
.preview-site section { padding: 20px 16px; }
.preview-site .p-dark {
  background: linear-gradient(135deg, #0a1a14, #0D3D2E); color: #fff; padding: 28px 16px;
}
.preview-site .p-alt { background: #F7F8FD; }
.preview-site .p-warm { background: #FDF8F6; }
.preview-site .p-green-bg { background: #F0FAF6; }
.preview-site h2 { font-size: 14px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; }
.preview-site h3 { font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.preview-site p { font-size: 10px; color: #5A5E7A; margin-bottom: 4px; }
.preview-site .p-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 9px;
  font-weight: 600; background: rgba(212,240,231,.15); color: #D4F0E7; margin-bottom: 10px;
}
.preview-site .p-stat { text-align: center; }
.preview-site .p-stat-num { font-size: 16px; font-weight: 800; color: #0D7C5F; }
.preview-site .p-stat-text { font-size: 9px; color: #8A8FA8; }
.preview-site .p-card {
  background: #fff; border: 1px solid #E4E6F0; border-radius: 8px;
  padding: 10px; margin-bottom: 6px;
}
.preview-site .p-card-dark {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; padding: 10px; margin-bottom: 6px;
}
.preview-site .p-btn {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #0D7C5F; color: #fff; font-size: 10px; font-weight: 600;
}
.preview-site .p-tag {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 9px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.6); margin: 2px;
}
.preview-site .p-grid { display: grid; gap: 6px; }
.preview-site .p-grid-3 { grid-template-columns: repeat(3, 1fr); }
.preview-site .p-grid-4 { grid-template-columns: repeat(4, 1fr); }
.preview-site .p-section-label {
  font-size: 9px; font-weight: 700; color: #0D7C5F; text-transform: uppercase;
  letter-spacing: .08em; text-align: center; margin-bottom: 4px;
}
.preview-site .p-section-title { text-align: center; margin-bottom: 4px; }
.preview-site .p-section-sub { text-align: center; font-size: 10px; color: #5A5E7A; margin-bottom: 12px; }
.preview-site .p-highlight { background: rgba(13,124,95,.08); border: 2px solid #0D7C5F; border-radius: 8px; }
.preview-site .p-dim { opacity: .35; }

/* ── Responsive ────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
