/* ============================================================
   STEIMKER OBJEKTPFLEGE – Dokumentations-App CSS
   ============================================================ */
:root {
  --ink:       #2E4A3C;
  --ink-soft:  #3a5a48;
  --paper:     #F7F5F1;
  --sand:      #E8E2D6;
  --rust:      #C8633A;
  --rust-dark: #A8502E;
  --pine:      #4A6B57;
  --line:      #D8D2C3;
  --white:     #FFFFFF;
  --success:   #2E8B57;
  --danger:    #DC2626;
  --blue:      #2563EB;
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Inter", -apple-system, sans-serif;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(46,74,60,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── LOGIN ─────────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.login-logo img { height: 44px; width: auto; }
.login-logo strong { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); display: block; }
.login-logo span { font-size: 0.65rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rust); font-weight: 600; }

.login-notice {
  margin-top: 24px;
  padding: 10px 14px;
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #92400E;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  background: var(--ink);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.topbar-logo img { height: 32px; width: auto; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 0.82rem; color: #9FB3A6; }

/* ── SUBBAR ────────────────────────────────────────────────── */
.subbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.subbar h1 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; }
.subbar-actions { display: flex; gap: 10px; }

/* ── TABS ──────────────────────────────────────────────────── */
.tab-bar {
  background: var(--white);
  border-bottom: 2px solid var(--line);
  display: flex;
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; }
.tab {
  padding: 11px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #6B7280;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--rust); font-weight: 600; }
.tab-badge {
  background: var(--sand);
  color: var(--pine);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: #9CA3AF;
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { margin-bottom: 20px; }

/* ── DOKUMENTEN-LISTE ──────────────────────────────────────── */
.doc-list {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.doc-list-header {
  display: grid;
  grid-template-columns: 80px 1fr 1.5fr 110px 200px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.doc-row {
  display: grid;
  grid-template-columns: 80px 1fr 1.5fr 110px 200px;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background 0.1s;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #FAFAF8; }

.doc-link { font-weight: 600; color: var(--ink); }
.doc-link:hover { color: var(--rust); }

.doc-kunde small,
.doc-taetigkeit small {
  display: block;
  font-size: 0.76rem;
  color: #9CA3AF;
  margin-top: 2px;
}

.doc-datum { font-size: 0.85rem; color: #6B7280; }

.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.archive-hint { margin-top: 20px; }

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-blue  { background: #DBEAFE; color: #1D4ED8; }
.badge-green { background: #D1FAE5; color: #065F46; }

/* ── CARDS (Formular-Sektionen) ────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* ── FORMULAR ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.form-group input, .form-group textarea, .form-group select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--rust);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.req { color: var(--rust); }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
}

/* ── TABELLEN ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--ink);
  color: var(--white);
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
}
.data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tfoot td { padding-top: 10px; border-top: 2px solid var(--ink); border-bottom: none; }
.data-table input { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-family: var(--font-body); font-size: 0.88rem; width: 100%; background: var(--paper); }
.data-table input:focus { outline: none; border-color: var(--rust); }

/* ── FOTO-UPLOAD ───────────────────────────────────────────── */
.photo-upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 20px;
}
.photo-upload-zone:hover, .photo-upload-zone.drag-over {
  border-color: var(--rust);
  background: #FEF8F5;
}
.photo-upload-zone p { color: #6B7280; font-size: 0.9rem; margin: 6px 0; }

.upload-kategorie-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 14px 0;
  font-size: 0.85rem;
  font-weight: 600;
}
.upload-kategorie-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.foto-gruppe { margin-bottom: 24px; }
.foto-gruppe-titel {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.foto-count {
  background: var(--ink);
  color: var(--white);
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 10px;
}

.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.foto-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--sand);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.foto-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.foto-remove:hover { background: var(--rust); }
.foto-kat-badge {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 3px;
  text-transform: uppercase;
}
.foto-kat-vorher      { background: rgba(37,99,235,0.8); color: white; }
.foto-kat-fortschritt { background: rgba(217,119,6,0.85); color: white; }
.foto-kat-fertig      { background: rgba(5,150,105,0.85); color: white; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary   { background: var(--ink);   color: white; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-secondary { background: var(--pine);  color: white; }
.btn-secondary:hover { background: #3a5a48; }
.btn-outline   { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--sand); }
.btn-success   { background: var(--success); color: white; }
.btn-danger    { background: var(--danger);  color: white; }
.btn-ghost-sm  { background: transparent; border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.85); font-size: 0.78rem; padding: 6px 12px; border-radius: 5px; }
.btn-ghost-sm:hover { border-color: white; color: white; }
.btn-full      { width: 100%; }
.btn-sm        { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon      { background: transparent; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 0.85rem; }
.btn-delete    { color: #9CA3AF; }
.btn-delete:hover { color: var(--danger); background: #FEF2F2; }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 14px;
}
.alert-error   { background: #FEF2F2; border: 1px solid #FCA5A5; color: var(--danger); }
.alert-success { background: #ECFDF5; border: 1px solid #6EE7B7; color: #065F46; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 16px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modal-in 0.2s ease;
  margin: 0 auto;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .modal-overlay { padding: 0; align-items: flex-start; }
  .modal { border-radius: 0; min-height: 100vh; }
}
@keyframes modal-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-family: var(--font-display); font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #9CA3AF; padding: 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 20px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ── TOAST ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--danger); }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .doc-list-header { display: none; }
  .doc-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 16px;
  }
  .doc-datum { font-size: 0.8rem; }
  .subbar h1 { font-size: 1.1rem; }
  .form-row-2 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .login-box { padding: 28px 20px; }
  .foto-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
