/* UI-Bausteine (ServiceDesk 3.0): Panel, Palette, Toasts, mobile Ansicht, MFA. */

/* ── Seitenpanel ───────────────────────────────────────────────────────── */
.sd-panel.offcanvas-end { width: min(720px, 100vw); }
.sd-panel .offcanvas-body { padding: 1rem; }
.sd-panel .offcanvas-body > .row { margin-left: 0; margin-right: 0; }

/* ── Befehlspalette ────────────────────────────────────────────────────── */
.sd-palette-dialog { max-width: 640px; margin-top: 10vh; }
.sd-palette-input { padding-left: 2.2rem; font-size: 1rem; }
.sd-palette-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); }
.sd-palette-item { border: 0; font-size: .9rem; }
.sd-palette-item.active { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.sd-palette-item.active .text-muted { color: var(--bs-body-color) !important; }
#sd-palette kbd, #sd-shortcuts kbd { font-size: .72rem; }
.sd-palette-hint { font-size: .72rem; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
#sd-toasts { z-index: 1090; }
.sd-toast { color: #fff; }
.sd-toast .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.sd-toast-success { background: #1f7a3a; }
.sd-toast-info { background: #1158a8; }
.sd-toast-warning { background: #8a5a00; }
.sd-toast-danger { background: #a12622; }

/* ── Login / MFA ───────────────────────────────────────────────────────── */
.sd-login-bg { background: linear-gradient(135deg, #172B4D 0%, #0052CC 100%); }
.sd-login-box { width: 100%; max-width: 420px; padding: 1rem; }
.sd-mfa-code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.sd-recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem 1.5rem; max-width: 360px; }
.sd-qr svg { width: 220px; height: 220px; border-radius: 8px; }
.sd-narrow-card { max-width: 520px; }
.min-w-0 { min-width: 0; }

/* ── Topbar-Knöpfe ─────────────────────────────────────────────────────── */
.sd-nav-toggle { display: none; }
.sd-nav-backdrop { display: none; }

/* ── Mobile Ansicht (< 992 px): Seitenleiste als Schublade ─────────────── */
@media (max-width: 991.98px) {
  .sd-sidebar { transform: translateX(-100%); transition: transform .22s ease; width: min(280px, 85vw) !important; z-index: 1045; }
  body.sd-nav-open .sd-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.sd-collapsed .sd-nav-text, body.sd-collapsed .sd-section-label, body.sd-collapsed .sd-logo-title,
  body.sd-collapsed .sd-collapse-label { opacity: 1; max-width: 200px; }
  body.sd-collapsed .sd-sidebar .nav-link { justify-content: flex-start; padding-left: .9rem; padding-right: .9rem; }
  body.sd-collapsed .sd-sidebar .nav-link .sd-icon { margin-right: 10px; }
  .sd-collapse-btn { display: none !important; }
  .sd-main, body.sd-collapsed .sd-main { margin-left: 0 !important; }
  .sd-nav-toggle { display: inline-flex; }
  body.sd-nav-open .sd-nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040; }
  body.sd-nav-open { overflow: hidden; }
  #sd-main .sd-topbar { padding-left: .75rem !important; padding-right: .75rem !important; gap: .5rem !important; }
  .sd-topbar h6 { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 767.98px) {
  .sd-topbar .sd-hide-mobile { display: none !important; }
  /* Zeile 1: Menü + Suche; Zeile 2: Seitenaktionen, horizontal scrollbar */
  #sd-main .sd-topbar { height: auto; min-height: 60px; flex-wrap: wrap; row-gap: .4rem !important; padding-top: .55rem; padding-bottom: .45rem; }
  #sd-main .sd-topbar .sd-search-wrap { flex: 1 1 0; max-width: none; min-width: 0; }
  #sd-main .sd-topbar-actions { order: 5; flex: 1 0 100% !important; margin-left: 0 !important; overflow-x: auto; overflow-y: hidden;
                       -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .sd-topbar-actions::-webkit-scrollbar { display: none; }
  .sd-topbar-actions > * { flex-shrink: 0; }
  .sd-topbar-actions .btn, .sd-topbar-actions a { white-space: nowrap; }
  #sd-content .sd-status-bar { flex-wrap: wrap; }
  #sd-content .sd-status-tile { flex: 1 1 calc(50% - .5rem); min-width: 0; padding: .7rem .6rem; }
  .sd-search-input { padding-right: .4rem; }
  #sd-main .sd-search-results { position: fixed; top: 52px; left: .5rem; right: .5rem; }
  #sd-content { padding: .75rem !important; }
  /* Breite Tabellen scrollen innerhalb ihrer Karte statt die Seite zu verbreitern */
  #sd-content table.table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #sd-content .table-responsive table.table { display: table; }
  #sd-content .card-body { padding: .9rem; }
  .sd-topbar-actions .btn-sm { padding: .25rem .45rem; }
  .sd-topbar-actions .btn .me-1 { margin-right: 0 !important; }
  .sd-topbar-actions .btn-label { display: none; }
  .modal-dialog.sd-palette-dialog { margin: .5rem; margin-top: 4vh; }
  textarea.form-control { min-height: 8rem; }
  .btn, .form-control, .form-select { min-height: 38px; }
  /* Ticketliste: Auswahlfilter erst auf Knopfdruck, Suche nimmt die Zeile */
  #sd-ticket-filters:not(.sd-filters-open) .sd-filter-extra { display: none !important; }
  #sd-ticket-filters #filter-q { flex: 1 1 8rem; width: auto !important; min-width: 0; }
  #sd-ticket-filters .sd-filter-extra { flex: 1 1 calc(50% - .5rem); width: auto !important; }
  #sd-ticket-filters .btn.sd-filter-extra { flex: 0 0 auto; }
}

@media (max-width: 575.98px) {
  .sd-topbar h6 { display: none; }
}

/* ── Druck ─────────────────────────────────────────────────────────────── */
@media print {
  .sd-sidebar, .sd-topbar, #sd-toasts, .sd-nav-backdrop { display: none !important; }
  .sd-main { margin-left: 0 !important; }
}

/* ── Dark Mode ─────────────────────────────────────────────────────────── */
[data-bs-theme="dark"] .sd-palette-item.active { background: #21262d; }
[data-bs-theme="dark"] .sd-panel { background: #0d1117; border-left-color: #30363d; }

/* ── Benachrichtigungen ────────────────────────────────────────────────── */
.sd-bell-menu { width: min(360px, 92vw); }
.sd-bell-list { max-height: 60vh; overflow-y: auto; }
.sd-bell-item { display: block; padding: .55rem .9rem; border-bottom: 1px solid var(--bs-border-color); color: var(--bs-body-color); text-decoration: none; }
.sd-bell-item:hover { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.sd-bell-item.unread { box-shadow: inset 3px 0 0 var(--sd-primary); }
.sd-bell-time { font-size: .72rem; }
.sd-bell-count { font-size: .62rem; }

/* Mittlere Breiten: Aktionsleiste darf schrumpfen und scrollt notfalls, statt die Seite zu verbreitern */
@media (min-width: 768px) {
  #sd-main .sd-topbar-actions { flex-shrink: 1 !important; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  #sd-main .sd-topbar-actions::-webkit-scrollbar { display: none; }
  #sd-main .sd-topbar-actions > * { flex-shrink: 0; }
}

/* ── Portal: Sterne und Verlauf ────────────────────────────────────────── */
.sd-stars { display: inline-flex; flex-direction: row-reverse; gap: .15rem; border: 0; padding: 0; margin: 0; }
.sd-stars label { cursor: pointer; font-size: 1.6rem; color: var(--bs-secondary-color); line-height: 1; }
.sd-stars label .sd-icon { width: 1.6rem; height: 1.6rem; }
.sd-stars input:checked ~ label, .sd-stars label:hover, .sd-stars label:hover ~ label { color: #f5b301; }
.sd-stars input:focus-visible + label { outline: 2px solid var(--sd-primary, #0052CC); border-radius: 4px; }
.sd-timeline { position: relative; padding-left: 1.1rem; }
.sd-timeline::before { content: ""; position: absolute; left: .3rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--bs-border-color); }
.sd-timeline li { position: relative; padding-bottom: .6rem; }
.sd-timeline li::before { content: ""; position: absolute; left: -1.05rem; top: .3rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--bs-secondary-color); }
.sd-timeline li.current::before { background: var(--sd-primary, #0052CC); box-shadow: 0 0 0 3px rgba(0,82,204,.2); }
