/* =====================================================
   Jonasarea Admin Dashboard
   Selbe Designsprache wie die Hauptseite
   ===================================================== */

:root {
  --bg: #f5f3ee;
  --bg-2: #ffffff;
  --fg: #0e0e0e;
  --muted: #797670;
  --line: #e3ddd2;
  --line-soft: #ede7dd;
  --accent: #0e0e0e;
  --danger: #c44;
  --success: #2a8;
  --shadow: 0 1px 3px rgba(14,14,14,0.04);
  --shadow-md: 0 6px 20px rgba(14,14,14,0.06);
  --shadow-lg: 0 16px 40px rgba(14,14,14,0.10);
  --radius: 10px;
  --radius-lg: 16px;
  --pad-x: 1.5rem;
  --ease: cubic-bezier(.22,.61,.36,1);
  --font-sans: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --font-script: 'Caveat', cursive;
}

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

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600;700;800&family=Caveat:wght@500;600&display=swap');

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================
   LOGIN SCREEN
   ===================================================== */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
}
.login-screen[hidden] { display: none !important; }
.dashboard[hidden] { display: none !important; }
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  width: 60px; height: 60px;
  margin: 0 auto 1.5rem;
  color: var(--fg);
}
.login-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.login-sub {
  color: var(--muted);
  margin-bottom: 2rem;
}
.login-card form {
  display: flex; flex-direction: column; gap: 1rem;
}
.login-card input {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color 0.2s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--fg);
}
.login-card button {
  padding: 0.9rem 1.5rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  font-family: inherit;
}
.login-card button:hover { opacity: 0.85; transform: translateY(-1px); }
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  background: rgba(204,68,68,0.08);
  border-radius: var(--radius);
}

/* =====================================================
   DASHBOARD
   ===================================================== */
.dashboard {
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar-logo {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.01em;
}
.topbar-logo svg { width: 22px; height: 22px; }
.topbar-right {
  display: flex; align-items: center; gap: 0.8rem;
}
.save-status {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 0.5rem;
}
.save-status.saving { color: var(--muted); }
.save-status.saved { color: var(--success); }
.save-status.error { color: var(--danger); }
.save-status.dirty { color: #c80; }

.btn-primary {
  padding: 0.6rem 1.2rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  font-family: inherit;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  padding: 0.6rem 1rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn-ghost:hover { border-color: var(--fg); background: var(--bg); }

.btn-danger {
  padding: 0.5rem 0.9rem;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(204,68,68,0.3);
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-danger:hover { background: rgba(204,68,68,0.08); border-color: var(--danger); }

/* =====================================================
   LAYOUT: SIDEBAR + MAIN
   ===================================================== */
.dashboard-body {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.sidebar {
  width: 240px;
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem;
  background: var(--bg);
  position: sticky; top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.tabs {
  display: flex; flex-direction: column; gap: 0.2rem;
}
.tab {
  text-align: left;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.tab:hover { background: var(--bg-2); color: var(--fg); }
.tab.active {
  background: var(--fg);
  color: var(--bg);
}

.main-content {
  flex: 1;
  padding: 2rem 2.5rem 5rem;
  max-width: 800px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s var(--ease); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.panel-desc {
  color: var(--muted);
  font-size: 0.92rem;
}

/* =====================================================
   FORMS
   ===================================================== */
.form-section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.5rem;
}
.form-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line-soft);
}
.form-section .form-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -0.6rem 0 1rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 1rem 0 0.4rem;
}
label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--fg);
  background: var(--bg-2);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* Card-Editor (für Trust-Cards, Werte, Testimonials) */
.card-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
  background: var(--bg);
}
.card-editor h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0;
  color: var(--muted);
}
.card-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.card-editor-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.btn-icon {
  width: 28px; height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--bg-2);
}
.btn-danger {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(204,68,68,0.3);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-danger:hover {
  background: rgba(204,68,68,0.08);
  border-color: var(--danger);
}

/* Feature-Liste-Editor */
.feature-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.feature-item {
  display: flex; gap: 0.5rem; align-items: center;
}
.feature-item input { flex: 1; }
.feature-item button { padding: 0.4rem 0.7rem; }

.add-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.2s;
  font-family: inherit;
}
.add-btn:hover { border-color: var(--fg); color: var(--fg); }

/* Image-Grid (Hero-Karten) */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.img-tile {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.img-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.img-tile img {
  width: 100%; height: 100%; object-fit: cover;
}
.img-tile-no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
.img-tile-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  color: white;
  padding: 0.7rem 0.8rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
}
.img-tile-replace {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: inherit;
  opacity: 0;
  transition: opacity 0.2s;
}
.img-tile:hover .img-tile-replace { opacity: 1; }

/* Single Image Uploader */
.single-image-uploader {
  display: flex; gap: 1rem; align-items: flex-start;
}
.single-image-uploader .preview {
  width: 200px; height: 250px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}
.single-image-uploader .preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.single-image-uploader .preview-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.85rem;
}
.single-image-uploader .actions {
  display: flex; flex-direction: column; gap: 0.5rem;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--fg);
  background: var(--bg-2);
}
.upload-zone-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.upload-zone-content p:first-child {
  color: var(--fg);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.upload-hint {
  font-size: 0.75rem;
  color: var(--muted);
}
.upload-zone.uploading {
  pointer-events: none;
  opacity: 0.6;
}

/* Image Gallery */
.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
}
.gallery-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  background: var(--bg);
  transition: transform 0.2s, border-color 0.2s;
}
.gallery-tile:hover {
  transform: translateY(-2px);
  border-color: var(--fg);
}
.gallery-tile img {
  width: 100%; height: 100%; object-fit: cover;
}
.gallery-tile-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =====================================================
   TOAST
   ===================================================== */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--fg);
  color: var(--bg);
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideUp 0.3s var(--ease);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   MODAL
   ===================================================== */
.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.modal[hidden] { display: none !important; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(14,14,14,0.5);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0;
  width: 32px; height: 32px;
  font-family: inherit;
}
.modal-close:hover { color: var(--fg); }
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}
.modal-body h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.8rem;
  color: var(--muted);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .dashboard-body { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 1rem;
  }
  .tabs {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.4rem;
  }
  .tab { white-space: nowrap; padding: 0.5rem 0.8rem; font-size: 0.8rem; }
  .main-content { padding: 1.5rem 1rem 4rem; }
  .topbar { padding: 0.7rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .btn-primary, .btn-ghost { font-size: 0.78rem; padding: 0.5rem 0.9rem; }
  .single-image-uploader { flex-direction: column; }
  .single-image-uploader .preview { width: 100%; height: auto; aspect-ratio: 4/5; }
}
