:root {
  --bg-main: #0b1220;
  --bg-sidebar: #020617;
  --bg-panel: #020617;
  --border: #1e293b;
  --accent: #38bdf8;
  --text: #e5e7eb;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text);
}

.app {
  display: flex;
  height: 100vh;
}

/* ================= Sidebar ================= */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.logo {
  padding: 1rem;
  font-weight: bold;
  border-bottom: 1px solid var(--border);
}

/* Sidebar – Projekt anlegen Button */
.sidebar-action {
  width: calc(100% - 1rem);
  margin: 0.5rem;
  padding: 0.6rem;
  background: #020617;
  border: 1px dashed var(--accent);
  color: var(--accent);
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.sidebar-action:hover {
  background: var(--accent);
  color: #020617;
}

/* Projektliste */
#project-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

#project-list li {
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

#project-list li:hover {
  background: #1e293b;
}

#project-list li.active {
  background: var(--accent);
  color: #020617;
  font-weight: bold;
}

/* ================= Content ================= */
.content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* ================= Topbar ================= */
.topbar {
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  gap: 0.75rem;
}

/* Aktionen */
.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
button {
  background: var(--accent);
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

button:disabled {
  background: #334155;
  color: var(--muted);
  cursor: not-allowed;
}

/* ================= Status ================= */
.status {
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-weight: bold;
}

.status.active {
  background: #22c55e;
  color: #020617;
}

.status.failed {
  background: #ef4444;
  color: white;
}

/* ================= Panels ================= */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.panel-header {
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.panel-body {
  padding: 1rem;
}

/* ================= Codebox ================= */
.codebox {
  max-height: 300px;
  overflow: auto;
  font-size: 0.85rem;
  background: #020617;
  border: 1px dashed var(--border);
  padding: 1rem;
  white-space: pre-wrap;
}

/* ================= Kontext-Editor ================= */
.context-editor {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: #020617;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

.context-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ================= File Explorer ================= */
.filetree li {
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 4px;
}

.filetree li:hover {
  background: #1e293b;
}

.filetree li.active {
  background: #334155;
}

/* ================= Inputs ================= */
input {
  width: 100%;
  padding: 0.55rem;
  background: #020617;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
}

/* ================= Commit Result ================= */
.commit-result.success {
  color: #22c55e;
}

.commit-result.error {
  color: #ef4444;
}

/* ================= Projekt anlegen Formular ================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#create-project-log {
  margin-top: 0.75rem;
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ================= Explorer Aktionen ================= */
.explorer-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.explorer-actions button {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

#explorer-status {
  margin-left: auto;
  font-size: 0.85rem;
}

/* =====================================================
   📱 MOBILE OPTIMIERUNG
   ===================================================== */
@media (max-width: 900px) {

  .app {
    flex-direction: column;
  }

  /* Sidebar wird Topbar */
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .logo {
    border-bottom: none;
    padding: 0.75rem;
    white-space: nowrap;
  }

  .sidebar-action {
    width: auto;
    margin: 0.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
  }

  #project-list {
    display: flex;
    flex-direction: row;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
  }

  #project-list li {
    white-space: nowrap;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
  }

  .content {
    padding: 1rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .codebox {
    font-size: 0.8rem;
  }
}
/* ================================
   📱 Responsive (Minimal & Clean)
   ================================ */
@media (max-width: 900px) {

  /* App untereinander statt nebeneinander */
  .app {
    flex-direction: column;
  }

  /* Sidebar wird obere Leiste */
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Logo kompakter */
  .logo {
    padding: 0.75rem;
    border-bottom: none;
    white-space: nowrap;
  }

  /* Projektliste horizontal */
  #project-list {
    display: flex;
    flex-direction: row;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
  }

  #project-list li {
    white-space: nowrap;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
  }

  /* Content enger */
  .content {
    padding: 1rem;
  }

  /* Topbar stapeln */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Buttons besser klickbar */
  button {
    padding: 0.55rem 0.8rem;
  }

  /* Formulare einspaltig */
  .form-grid {
    grid-template-columns: 1fr;
  }
}
#frontend-btn {
  background: #22c55e;
  color: #020617;
}

#frontend-btn:disabled {
  background: #334155;
  color: #94a3b8;
}

.project-port {
  margin-left: 6px;
  font-size: 0.8em;
  color: #777;
}
