/* Datei: public/assets/css/app.css
   Zweck: Gesamtes Erscheinungsbild des BugCenters.
   Farbwelt bewusst an CloudCRM angelehnt (--p-blue #004a99), damit die
   DWO-Systeme zusammen gehoerig wirken. */

:root {
  --p-blue: #004a99;
  --header-bg: linear-gradient(to left, #0a5dab 0%, #004a99 52%, #003b7d 100%);
  --bg: #f1f4f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
  --sidebar-w: 232px;
  --header-h: 60px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--p-blue); color: #fff;
  padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Kopfzeile ---------- */
.topbar {
  height: var(--header-h);
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__brand a { color: #fff; font-weight: 600; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.topbar__mark {
  background: rgba(255,255,255,.18);
  border-radius: 6px;
  padding: .15rem .4rem;
  margin-right: .35rem;
  font-weight: 700;
}
.topbar__search { flex: 1; display: flex; gap: .4rem; max-width: 620px; }
.topbar__search input {
  flex: 1; border: 0; border-radius: var(--radius-sm); padding: .5rem .75rem; font-size: .9rem;
  background: rgba(255,255,255,.95);
}
.topbar__search button {
  border: 0; border-radius: var(--radius-sm); padding: .5rem .9rem; cursor: pointer;
  background: rgba(255,255,255,.2); color: #fff; font-size: .9rem;
}
.topbar__search button:hover { background: rgba(255,255,255,.3); }
.topbar__user { display: flex; align-items: center; gap: .75rem; font-size: .88rem; }
.topbar__name { opacity: .9; }
.topbar__link { color: #fff; opacity: .9; }
.topbar__logout { margin: 0; }

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--header-h) - 44px); }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem .75rem;
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.sidebar__group + .sidebar__group { margin-top: 1.25rem; }
.sidebar__title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 .5rem .5rem; font-weight: 600;
}
.sidebar__list { list-style: none; margin: 0; padding: 0; }
.sidebar__link {
  display: block; padding: .45rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); font-size: .9rem; text-decoration: none;
}
.sidebar__link:hover { background: #eef2f7; text-decoration: none; }
.sidebar__link.is-active { background: var(--p-blue); color: #fff; font-weight: 500; }

.content { flex: 1; padding: 1.25rem 1.5rem 2.5rem; min-width: 0; }

.footer {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.5rem; color: var(--muted); font-size: .8rem;
  border-top: 1px solid var(--border); background: var(--surface);
}

/* ---------- Bausteine ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.35rem; }
.page-head .sub { color: var(--muted); font-size: .85rem; margin: .2rem 0 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1.1rem;
}
.card--narrow { max-width: 460px; margin: 4rem auto; }
.card h2 { margin: 0 0 .85rem; font-size: 1rem; }
.card h3 { margin: 1.1rem 0 .5rem; font-size: .92rem; }

.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.grid { display: grid; gap: 1rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat__value { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.stat__label { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.stat--danger .stat__value { color: var(--danger); }
.stat--warning .stat__value { color: var(--warning); }
.stat--success .stat__value { color: var(--success); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.list th, table.list td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.list tbody tr:hover { background: #f8fafc; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.issue-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; white-space: nowrap; }

/* ---------- Etiketten ---------- */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.badge--primary { background: #dbeafe; color: #1d4ed8; }
.badge--info    { background: #e0f2fe; color: #0369a1; }
.badge--success { background: #d1fae5; color: #047857; }
.badge--warning { background: #fef3c7; color: #b45309; }
.badge--danger  { background: #fee2e2; color: #b91c1c; }
.badge--muted   { background: #e2e8f0; color: #475569; }
.label-chip {
  display: inline-block; padding: .1rem .45rem; border-radius: 4px; font-size: .72rem;
  color: #fff; margin-right: .25rem;
}

/* ---------- Formulare ---------- */
.form-row { margin-bottom: .9rem; }
.form-row label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .25rem; color: #334155; }
.form-row .hint { color: var(--muted); font-size: .76rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: .9rem; background: #fff; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37,99,235,.35); outline-offset: 1px; border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-size: .82rem; font-weight: 600; padding: 0 .35rem; color: #334155; }
.checkbox-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .25rem .75rem; }
.checkbox-list label { display: flex; gap: .45rem; align-items: flex-start; font-size: .85rem; font-weight: 400; }
.checkbox-list input { margin-top: .2rem; }

.btn {
  display: inline-block; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--p-blue); color: #fff; padding: .5rem .95rem; font-size: .88rem;
  cursor: pointer; font-family: inherit; text-decoration: none;
}
.btn:hover { background: #003b7d; text-decoration: none; color: #fff; }
.btn--ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.15); }
.btn--secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: #f1f5f9; color: var(--text); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #b91c1c; }
.btn--sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* ---------- Meldungen ---------- */
.flash { padding: .65rem .9rem; border-radius: var(--radius-sm); margin-bottom: .9rem; font-size: .88rem; border: 1px solid; }
.flash--success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash--error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash--info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ---------- Vorgangsdetail ---------- */
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.issue-title { margin: 0 0 .35rem; font-size: 1.3rem; }
.issue-meta { color: var(--muted); font-size: .84rem; margin-bottom: 1rem; }
.meta-list { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.meta-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.meta-list li:last-child { border-bottom: 0; }
.meta-list .k { color: var(--muted); }
.meta-list .v { text-align: right; font-weight: 500; }

.section-text { white-space: normal; font-size: .9rem; }
.section-text p { margin: 0 0 .6rem; }

.comment { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .85rem; margin-bottom: .7rem; background: #fff; }
.comment--internal { background: #fffbeb; border-color: #fde68a; }
.comment__head { display: flex; justify-content: space-between; gap: .75rem; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.comment__author { font-weight: 600; color: var(--text); }

.history { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.history li { padding: .35rem 0; border-bottom: 1px dashed var(--border); color: var(--muted); }
.history li:last-child { border-bottom: 0; }
.history .who { color: var(--text); font-weight: 500; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem .75rem; align-items: end; }
.pagination { display: flex; gap: .4rem; align-items: center; margin-top: 1rem; font-size: .85rem; }
.pagination .current { color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .9rem; }

.bar { background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--p-blue); }

.token-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem;
  background: #0f172a; color: #e2e8f0; padding: .6rem .8rem; border-radius: var(--radius-sm);
  word-break: break-all; display: block; margin: .5rem 0;
}

@media (max-width: 900px) {
  .issue-layout { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar__list { display: flex; flex-wrap: wrap; gap: .25rem; }
  .topbar { flex-wrap: wrap; height: auto; padding: .6rem 1rem; }
  .topbar__search { order: 3; flex-basis: 100%; max-width: none; }
}
