/* ============================================
   Praxis-Toolkit Overrides & Additions
   Basis: Hyperspace Template (main.css bleibt unverändert)
   ============================================ */

/* --- Sidebar Navigation Overrides --- */
#sidebar .inner {
  padding: 1.5em 1.5em;
}

#sidebar nav ul li a {
  font-size: 0.85em;
  padding: 0.4em 0;
  border-bottom: none;
}

#sidebar nav ul li a.active {
  color: #fff;
  font-weight: bold;
}

#sidebar nav ul li a:hover {
  color: #b74e91;
}

/* Sidebar: Kategorie-Überschriften */
.nav-divider {
  font-size: 0.65em;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.35);
  padding: 1em 0 0.3em 0;
  margin: 0;
  pointer-events: none;
  font-weight: 600;
}

.nav-divider:first-child {
  padding-top: 0;
}

/* Admin-Only Links */
.nav-admin-only {
  display: none;
}
body.is-admin .nav-admin-only {
  display: block;
}

/* User-Info am Sidebar-Ende */
#nav-user-info {
  margin-top: 1.5em;
  padding-top: 1em;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8em;
  color: rgba(255,255,255,0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#nav-user-info .username {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

#nav-user-info .logout-btn {
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: color 0.2s;
  background: none;
  border: none;
  font-size: 1em;
  padding: 0.3em 0.5em;
}

#nav-user-info .logout-btn:hover {
  color: #b74e91;
}

/* --- Mobile Hamburger Menü --- */
a.toggle {
  display: none;
  position: fixed;
  top: 1em;
  left: 1em;
  z-index: 10002;
  background: #312450;
  color: #fff;
  padding: 0.6em 0.9em;
  border-radius: 4px;
  font-size: 0.9em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@media screen and (max-width: 736px) {
  a.toggle {
    display: block;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10001;
    position: fixed;
    top: 0;
    left: 0;
    width: 18em;
    height: 100vh;
    overflow-y: auto;
  }

  body.sidebar-visible #sidebar {
    transform: translateX(0);
  }

  body.sidebar-visible a.toggle {
    left: calc(18em + 1em);
  }

  #wrapper {
    margin-left: 0 !important;
  }
}

/* --- Layout-Klassen --- */
.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
  margin-bottom: 1.5em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5em;
  margin-top: 1.5em;
}

.card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 1.5em;
  transition: border-color 0.2s, background 0.2s;
}

.card:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
}

.card h3 {
  margin: 0 0 0.5em 0;
  font-size: 1.1em;
}

.card p {
  margin: 0;
  font-size: 0.9em;
  opacity: 0.7;
}

.card .icon {
  font-size: 2em;
  margin-bottom: 0.3em;
  display: block;
  color: #b74e91;
}

.card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.form-section {
  margin-bottom: 2em;
}

.form-section h3 {
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* --- Tabs (Einstellungen) --- */
.tab-container {
  margin-top: 1em;
}

.tab-buttons {
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(255,255,255,0.15);
  margin-bottom: 2em;
  flex-wrap: wrap;
}

.tab-button {
  padding: 0.7em 1.5em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.tab-button:hover {
  color: rgba(255,255,255,0.8);
}

.tab-button.active {
  color: #fff;
  border-bottom-color: #b74e91;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* --- Tabellen --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.data-table th,
.data-table td {
  padding: 0.6em 0.8em;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.9em;
}

.data-table th {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* Action Buttons in Tabellen */
.btn-sm {
  padding: 0.3em 0.6em;
  font-size: 0.8em;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 4px;
  transition: all 0.2s;
  margin-right: 0.3em;
}

.btn-sm:hover {
  background: rgba(255,255,255,0.15);
}

.btn-sm.danger {
  border-color: rgba(255,80,80,0.4);
  color: #ff6b6b;
}

.btn-sm.danger:hover {
  background: rgba(255,80,80,0.15);
}

/* --- PDF Preview --- */
.pdf-preview {
  background: #fff;
  color: #000;
  padding: 40px;
  margin: 1.5em 0;
  border-radius: 4px;
  max-width: 210mm;
  min-height: 297mm;
  position: relative;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 11pt;
  line-height: 1.4;
}

.pdf-preview .letterhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2em;
  padding-bottom: 1em;
  border-bottom: 2px solid #312450;
}

.pdf-preview .letterhead img {
  max-height: 60px;
  max-width: 150px;
}

.pdf-preview .letterhead .praxis-info {
  text-align: right;
  font-size: 9pt;
  color: #555;
}

.pdf-preview h2 {
  color: #312450;
  margin-bottom: 0.5em;
}

.pdf-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.pdf-preview table th,
.pdf-preview table td {
  padding: 6px 10px;
  border: 1px solid #ddd;
  text-align: left;
  font-size: 10pt;
}

.pdf-preview table th {
  background: #f5f5f5;
  font-weight: 600;
}

.pdf-preview .signature-area {
  margin-top: 3em;
  display: flex;
  justify-content: space-between;
}

.pdf-preview .signature-block {
  text-align: center;
  min-width: 200px;
}

.pdf-preview .signature-block .line {
  border-top: 1px solid #000;
  margin-top: 50px;
  padding-top: 5px;
  font-size: 9pt;
}

.pdf-preview .signature-block img {
  max-height: 60px;
  margin-top: 10px;
}

/* --- Warning Badges --- */
.badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: 600;
}

.badge-ok { background: rgba(40,167,69,0.2); color: #5cb85c; }
.badge-warn { background: rgba(255,193,7,0.2); color: #ffc107; }
.badge-danger { background: rgba(220,53,69,0.2); color: #ff6b6b; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 1em;
  right: 1em;
  z-index: 10003;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.toast {
  background: #312450;
  color: #fff;
  padding: 0.8em 1.2em;
  border-radius: 6px;
  font-size: 0.9em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
  max-width: 350px;
}

.toast.success { border-left: 4px solid #5cb85c; }
.toast.error { border-left: 4px solid #ff6b6b; }
.toast.info { border-left: 4px solid #5bc0de; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Login Page --- */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #312450;
}

.login-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 3em;
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 1.5em;
  font-size: 1.5em;
}

.login-box .error-msg {
  background: rgba(255,80,80,0.15);
  border: 1px solid rgba(255,80,80,0.3);
  color: #ff6b6b;
  padding: 0.6em 1em;
  border-radius: 6px;
  margin-bottom: 1em;
  font-size: 0.9em;
  display: none;
}

/* --- Signature Canvas --- */
.signature-pad-wrapper {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: #fff;
  padding: 0.5em;
  display: inline-block;
}

.signature-pad-wrapper canvas {
  cursor: crosshair;
}

/* --- Image Upload Preview --- */
.logo-upload-area {
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 2em;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.logo-upload-area:hover {
  border-color: rgba(255,255,255,0.4);
}

.logo-upload-area img {
  max-height: 80px;
  max-width: 200px;
}

/* --- Utilities --- */
.mt-1 { margin-top: 0.5em; }
.mt-2 { margin-top: 1em; }
.mt-3 { margin-top: 1.5em; }
.mb-1 { margin-bottom: 0.5em; }
.mb-2 { margin-bottom: 1em; }
.mb-3 { margin-bottom: 1.5em; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5em; }
.gap-2 { gap: 1em; }
.hidden { display: none !important; }
