/* ============================================================
   Budgetplaner – Stylesheet
   Basierend auf dem Lohnkostenrechner-Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:           #f4f2ed;
  --bg2:          #eceae4;
  --bg3:          #e2e0d9;
  --surface:      #ffffff;
  --border:       #d4d1c8;
  --border2:      #c0bdb4;
  --text:         #1a1a18;
  --text2:        #5a5955;
  --text3:        #8a8882;
  --accent:       #1a3a2a;
  --accent2:      #2d5c42;
  --accent-light: #e8f0eb;
  --red:          #8b1a1a;
  --red-light:    #f5e8e8;
  --amber:        #7a4a0a;
  --amber-light:  #faf0e0;
  --mono:         'IBM Plex Mono', monospace;
  --sans:         'IBM Plex Sans', sans-serif;
  --radius:       4px;
  --radius-lg:    10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── App Header ── */
.app-header {
  background: var(--accent);
  color: #fff;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.app-header-logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.app-header-sep {
  opacity: 0.35;
  font-weight: 300;
  font-size: 18px;
}
.app-header-sub {
  font-size: 12px;
  opacity: 0.6;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.btn-header-icon {
  background: none;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1;
}
.btn-header-icon:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

/* ── Sidebar Nav ── */
.app-nav {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.2s ease;
}
.app-nav--collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
}
.app-nav--collapsed .nav-section-title,
.app-nav--collapsed .nav-item,
.app-nav--collapsed .nav-divider {
  display: none;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 12px 16px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  transition: background 0.12s, color 0.12s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.nav-item.aktiv {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
  border-left-color: var(--accent);
}
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ── Hauptinhalt ── */
.app-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ── Seitentitel ── */
.page-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title .icon { font-size: 22px; }
.page-subtitle {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 24px;
  font-family: var(--mono);
}

/* ── Cards / Panels ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Formular-Elemente ── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 0 10px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  height: 34px;
}
textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  min-height: 80px;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent2);
  background: #fff;
}
input[readonly], input[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.row2 .field, .row3 .field { margin-bottom: 0; }

.field-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* Checkboxen */
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.check-field input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent2);
  cursor: pointer;
  flex-shrink: 0;
}
.check-field label {
  margin: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: 0.88; }

.btn-secondary { background: var(--bg); color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent); color: #fff; }

.btn-danger    { background: var(--bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-ghost     { background: none; color: var(--text2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg2); color: var(--text); }

.btn-sm        { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg        { height: 42px; padding: 0 20px; font-size: 14px; }
.btn-full      { width: 100%; justify-content: center; }

/* ── Tabellen ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius) 0 0; }

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--accent-light); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 8px 12px; vertical-align: middle; }

.table-actions { white-space: nowrap; display: flex; gap: 4px; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.aktiv { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  animation: modal-in 0.2s ease;
}
.modal-box--lg { width: min(800px, 100%); }
.modal-box--sm { width: min(400px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text3);
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--text); background: var(--bg2); }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Alerts / Hinweise ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-warning { background: var(--amber-light); color: var(--amber); border: 1px solid #e8d0a0; }
.alert-danger   { background: var(--red-light); color: var(--red); border: 1px solid #e0b0b0; }
.alert-success  { background: var(--accent-light); color: var(--accent); border: 1px solid #b0d0b8; }
.alert-info     { background: var(--bg2); color: var(--text2); border: 1px solid var(--border); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  white-space: nowrap;
}
.badge-accent  { background: var(--accent); color: #fff; }
.badge-green   { background: var(--accent-light); color: var(--accent2); }
.badge-red     { background: var(--red-light); color: var(--red); }
.badge-gray    { background: var(--bg3); color: var(--text2); }

/* ── Leer-Zustand ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ── Utility ── */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-gap { display: flex; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-mono { font-family: var(--mono); }
.col-betrag { min-width: 90px; white-space: nowrap; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent2); }
.text-red { color: var(--red); }
.fw-500 { font-weight: 500; }

/* ── Login ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg2);
}
.login-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: min(420px, 92vw);
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
}
.login-logo   { font-size: 22px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.login-sub    { font-size: 13px; color: var(--text3); margin-bottom: 28px; font-family: var(--mono); }
.login-error  { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-success{ color: var(--accent2); font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-link   {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent2);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: var(--sans);
  padding: 0;
}
.toggle-section { display: none; }
.toggle-section.aktiv { display: block; }

/* ── Benutzerverwaltung ── */
.user-row-self { background: var(--accent-light) !important; }

/* ── Jahr-Auswahl Dashboard ── */
.jahr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.jahr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
  display: block;
}
.jahr-card:hover {
  border-color: var(--accent2);
  box-shadow: 0 4px 16px rgba(26,58,42,0.12);
  background: var(--accent-light);
}
.jahr-card .jahr-zahl {
  font-size: 32px;
  font-weight: 300;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 8px;
}
.jahr-card .jahr-meta { font-size: 12px; color: var(--text3); }

/* ── Projekt-Karten ── */
.projekt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.projekt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.projekt-card:hover { border-color: var(--accent2); box-shadow: 0 4px 16px rgba(26,58,42,0.1); }
.projekt-card-title { font-size: 15px; font-weight: 500; color: var(--accent); margin-bottom: 8px; }
.projekt-card-meta  { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.projekt-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Druck-Stile ── */
@media print {
  .app-header,
  .app-nav,
  .no-print,
  .btn,
  .modal-overlay,
  .header-actions { display: none !important; }

  .app-layout   { display: block; }
  .app-content  { padding: 0; }
  body          { font-size: 11px; background: #fff; color: #000; }

  .card {
    border: 1px solid #ccc;
    border-radius: 0;
    box-shadow: none;
    page-break-inside: avoid;
    margin-bottom: 12px;
  }

  thead th {
    background: #333 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page-title  { font-size: 16px; margin-bottom: 4px; }
  .page-subtitle { font-size: 11px; margin-bottom: 12px; }

  table { font-size: 10px; }
  th, td { padding: 4px 6px !important; }

  a { text-decoration: none; color: inherit; }
}
