/* German-California State Government — Design System */
:root {
  --primary: #0a2a5e;
  --primary-light: #1e4d8b;
  --gold: #c9a227;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1d24;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #b91c1c;
  --shadow: 0 4px 20px rgba(0,0,0,.08);
  --radius: 8px;
}

/* Dark mode (auto via OS + optional toggle via [data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --surface: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: rgba(148,163,184,.25);
    --shadow: 0 10px 35px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148,163,184,.25);
  --shadow: 0 10px 35px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-seal { width: 48px; height: 48px; background: #fff; border-radius: 50%; padding: 4px; }
.brand-title { font-weight: 700; font-size: 18px; }
.brand-sub { font-size: 12px; opacity: .85; letter-spacing: .5px; }
.main-nav { display: flex; gap: 24px; align-items: center; }
.main-nav a { color: #fff; opacity: .9; font-size: 15px; font-weight: 500; }
.main-nav a:hover { opacity: 1; text-decoration: none; }
.nav-home { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.35); padding: 6px 14px; border-radius: 4px; font-weight: 600; }
.nav-home:hover { background: rgba(255,255,255,.25); text-decoration: none; }
.nav-admin { background: var(--gold); color: var(--primary) !important; padding: 6px 14px; border-radius: 4px; }
.nav-login { border: 1px solid rgba(255,255,255,.4); padding: 6px 14px; border-radius: 4px; }

/* Mobile nav */
@media (max-width: 700px) {
  .header-row { flex-wrap: wrap; gap: 10px; }
  .main-nav { flex-wrap: wrap; gap: 10px; font-size: 13px; }
  .brand-title { font-size: 15px; }
}

/* Hero */
.hero { position: relative; min-height: 480px; display: flex; align-items: center; color: #fff; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(.45); }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(10,42,94,.85), rgba(30,77,139,.6)); }
.hero-content { position: relative; padding: 80px 20px; text-align: center; }
.hero-seal { width: 110px; margin: 0 auto 24px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.hero h1 { font-size: 48px; margin: 0 0 16px; font-weight: 800; letter-spacing: -.5px; }
.hero-sub { font-size: 20px; opacity: .95; max-width: 700px; margin: 0 auto 8px; }
.hero-intro { max-width: 700px; margin: 0 auto 32px; opacity: .85; }

/* Buttons */
.btn { display: inline-block; padding: 12px 28px; border-radius: 6px; font-weight: 600; border: none; cursor: pointer; font-size: 15px; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--gold); color: var(--primary); box-shadow: 0 4px 14px rgba(201,162,39,.4); }
.btn-primary:hover { background: #d9b333; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-tiny { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }

/* Sections */
.section { padding: 70px 0; }
.section-alt { background: var(--surface); }
.section-title { font-size: 32px; margin: 0 0 8px; color: var(--primary); font-weight: 700; }
.section-sub { color: var(--muted); margin: 0 0 32px; font-size: 17px; }

/* Department grid */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.dept-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
  border-top: 4px solid var(--accent, var(--primary)); color: var(--text);
}
.dept-card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,.12); text-decoration: none; }
.dept-card-badge { display: flex; align-items: center; justify-content: center; padding: 28px; background: linear-gradient(135deg, #f8fafc, #eef2f7); }
.root[data-theme="dark"] .dept-card-badge,
:root[data-theme="dark"] .dept-card-badge {
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
.dept-card-badge img { width: 110px; height: 110px; object-fit: contain; }
.dept-card-body { padding: 20px 22px 24px; }
.dept-code { font-size: 12px; font-weight: 700; color: var(--accent, var(--primary)); letter-spacing: 1.5px; }
.dept-card-body h3 { margin: 6px 0 8px; font-size: 18px; }
.dept-card-body p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.dept-status { font-size: 12px; color: #16a34a; font-weight: 600; }

/* Department detail */
.dept-hero { background: linear-gradient(135deg, var(--accent, var(--primary)), var(--primary-light)); color: #fff; padding: 50px 0; border-bottom: 4px solid var(--gold); }
.dept-hero-row { display: flex; align-items: center; gap: 32px; }
.dept-hero-badge { width: 130px; height: 130px; background: #fff; border-radius: 50%; padding: 10px; flex-shrink: 0; }
.dept-code-big { font-size: 14px; opacity: .8; letter-spacing: 2px; font-weight: 700; }
.dept-hero h1 { margin: 4px 0 8px; font-size: 36px; font-weight: 800; }
.dept-motto { margin: 0 0 8px; font-style: italic; opacity: .9; font-size: 17px; }

.dept-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; padding: 40px 20px; }
@media (max-width: 900px) { .dept-layout { grid-template-columns: 1fr; } }
.dept-main { display: flex; flex-direction: column; gap: 22px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 14px; color: var(--primary); font-size: 22px; }
.card h3 { margin: 0 0 12px; color: var(--primary); font-size: 17px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* Employees */
.employee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.employee-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--text); }
.employee-photo { aspect-ratio: 1; background: var(--bg); }
.employee-photo img { width: 100%; height: 100%; object-fit: cover; }
.employee-info { padding: 14px; }
.employee-rank { font-size: 11px; color: var(--gold); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.employee-unit { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .5px; margin: 2px 0 0; }
.employee-name { font-weight: 700; font-size: 16px; margin: 4px 0; color: var(--text); }
.employee-badge { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-family: monospace; }
.employee-bio { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.employee-bio p { margin: 0; }

/* Login */
.login-card { max-width: 420px; margin: 60px auto; background: var(--surface); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 20px; color: var(--primary); }
.login-card label { display: block; margin-bottom: 14px; font-weight: 500; font-size: 14px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 15px; margin-top: 6px; }
.login-card .btn { width: 100%; }
.alert { background: #fee2e2; color: var(--danger); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }

/* (recruitment-steps moved above) */

/* Footer */
.site-footer { background: var(--primary); color: #fff; padding: 40px 0; margin-top: 60px; text-align: center; }
.site-footer p { margin: 4px 0; opacity: .85; font-size: 14px; }
.site-footer .copy { opacity: .6; font-size: 12px; }

.muted { color: var(--muted); }
.dept-list { list-style: none; padding: 0; }
.dept-list li { padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.dept-list li a { color: var(--gold); font-weight: 500; }
.dept-list li a:hover { color: #fff; text-decoration: none; }
.admin-info ol { padding-left: 22px; }
.admin-info li { margin: 6px 0; color: var(--text); }
.card h2 { margin: 0 0 14px; color: var(--gold); font-size: 22px; }
.card h3 { margin: 0 0 12px; color: var(--gold); font-size: 17px; }
.card p { color: var(--text); }
.section-title { font-size: 32px; margin: 0 0 8px; color: var(--gold); font-weight: 700; }
.login-card h1 { margin: 0 0 20px; color: var(--gold); }
.login-card label { color: var(--text); }
.login-card input { background: var(--bg); color: var(--text); border-color: var(--border); }
/* recruitment block */
.recruitment-steps { font-weight: 600; color: var(--text); padding: 16px; background: var(--surface); border-left: 4px solid var(--gold); border-radius: 4px; }

/* === ADMIN EDIT MODE === */
body.is-admin [data-editable],
body.is-admin [data-editable-field] {
  position: relative;
  outline: 2px dashed transparent;
  outline-offset: 4px;
  cursor: pointer;
  transition: outline-color .15s;
}
body.is-admin [data-editable]:hover,
body.is-admin [data-editable-field]:hover {
  outline-color: var(--gold);
}
body.is-admin [data-editable]:hover::after,
body.is-admin [data-editable-field]:hover::after {
  content: "✎ Bearbeiten";
  position: absolute;
  top: -22px; right: 0;
  background: var(--gold);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  z-index: 50;
  white-space: nowrap;
}
body.is-admin [data-editable-image] {
  cursor: pointer;
  outline: 2px dashed transparent;
  outline-offset: 2px;
  transition: outline-color .15s;
}
body.is-admin [data-editable-image]:hover {
  outline-color: var(--gold);
}

/* Editor modal — always dark-aware */
.gcrp-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gcrp-modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; max-width: 960px; width: 100%; max-height: 90vh; overflow: auto; padding: 28px; }
.gcrp-modal h3 { margin: 0 0 16px; color: var(--gold); font-size: 20px; }
.gcrp-modal label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; color: var(--muted); }
.gcrp-modal input, .gcrp-modal select, .gcrp-modal textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--bg); color: var(--text); }
.gcrp-modal select option { background: var(--bg); color: var(--text); }
.gcrp-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.gcrp-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .gcrp-modal-grid { grid-template-columns: 1fr; } }

/* Bild im Zuschnitt-Dialog: mit Maus/Touch verschieben */
.gcrp-pos-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  max-height: min(70vh, 520px);
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.gcrp-pos-frame.is-dragging { cursor: grabbing; }
.gcrp-pos-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.gcrp-pos-hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.gcrp-pos-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 640px) {
  .gcrp-pos-layout { grid-template-columns: 1fr; }
}

/* Bild-Blöcke: fester Rahmen wie Mitarbeiterkarte, object-position wirkt sichtbar */
.gcrp-block-image-wrap {
  max-width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}
.gcrp-block-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dark surfaces */
.login-card { border: 1px solid var(--border); }
.dept-card { background: var(--surface); }
.card { border: 1px solid var(--border); }

/* Theme toggle button */
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.35); padding: 6px 12px; border-radius: 4px; color: #fff; opacity: .95; font-size: 14px; background: rgba(255,255,255,.08); cursor: pointer; }
.theme-toggle:hover { opacity: 1; text-decoration: none; }

.gcrp-toast { position: fixed; bottom: 24px; right: 24px; background: var(--primary); color: #fff; padding: 14px 22px; border-radius: 6px; box-shadow: var(--shadow); z-index: 2000; opacity: 0; transition: opacity .2s, transform .2s; transform: translateY(10px); }
.gcrp-toast.show { opacity: 1; transform: translateY(0); }
.gcrp-toast.error { background: var(--danger); }

/* === PAGE BACKGROUND OVERLAY === */
.gcrp-page-bg {
  position: fixed; inset: 0; z-index: -1;
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* === PAGE BLOCKS (modular builder) === */
.gcrp-blocks-zone .gcrp-block-toolbar { margin-bottom: 0; }
.gcrp-blocks { display: flex; flex-direction: column; gap: 16px; }
.gcrp-page-block-wrap { position: relative; margin: 0; }
.gcrp-page-block-wrap > .gcrp-block {
  background: transparent;
  box-shadow: none;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.gcrp-page-block-wrap > .gcrp-block .gcrp-block-inner { padding: 0; }
.gcrp-page-block-wrap > .gcrp-block .gcrp-block-spacer-wrap { padding-left: 0; padding-right: 0; }
.gcrp-block-heading {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.gcrp-rich-body { color: var(--text); }
.gcrp-rich-body p:last-child { margin-bottom: 0; }
/* Klickbare Links in TinyMCE-Inhalten (Blöcke, Bio, Aufgaben …) */
[data-editable][data-rich="1"] a,
[data-editable-field][data-rich="1"] a,
.gcrp-rich-body a,
.gcrp-block-inner a {
  color: #fbbf24;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
[data-editable][data-rich="1"] a:hover,
[data-editable-field][data-rich="1"] a:hover,
.gcrp-rich-body a:hover,
.gcrp-block-inner a:hover {
  color: #fde68f;
}
body.is-admin .gcrp-page-block-wrap > .gcrp-block { position: relative; padding-top: 4px; }
.gcrp-dnd-handle {
  cursor: grab;
  letter-spacing: -3px;
  font-weight: 900;
  padding: 6px 8px;
  user-select: none;
}
.gcrp-dnd-handle:active { cursor: grabbing; }
body.is-admin .gcrp-block::before { content: none !important; display: none !important; }
.gcrp-page-block-wrap.dragging { opacity: 0.78; outline: 2px dashed var(--gold); outline-offset: 4px; }
.gcrp-blocks-section-title { color: var(--gold); }
.gcrp-block { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.gcrp-block-inner { padding: 18px 18px; }
.gcrp-block-spacer-wrap { padding: 12px 18px 18px; }
.gcrp-block-spacer {
  min-height: 96px;
  box-sizing: border-box;
  border-radius: 10px;
}
body.is-admin .gcrp-block-spacer {
  background: linear-gradient(180deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.02));
  outline: 1px dashed rgba(255, 193, 7, 0.45);
  outline-offset: -6px;
}
.gcrp-block-spacer-note {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.gcrp-block-spacer-note:empty { display: none; }

body.is-admin .gcrp-block { position: relative; }
.gcrp-block-controls { display: none; position: absolute; top: 8px; right: 8px; gap: 6px; z-index: 6; flex-wrap: wrap; justify-content: flex-end; max-width: 88%; }
body.is-admin .gcrp-block:hover .gcrp-block-controls { display: inline-flex; }
.gcrp-block-controls button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }
.gcrp-block-controls button:hover { filter: brightness(1.05); }
.gcrp-block.dragging { opacity: 1; }
.gcrp-block-drop { outline: 2px dashed var(--gold); }

.gcrp-block-toolbar { display: none; margin-bottom: 14px; gap: 10px; align-items: center; }
body.is-admin .gcrp-block-toolbar { display: flex; }
