/* ================= GLOBAL ================= */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  overflow: hidden;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ================= LOGIN ================= */

.login {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;

  background: linear-gradient(135deg, #0f172a, #1e293b);
  z-index: 9999;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.5s ease;
}

.login-card h2 {
  margin-bottom: 5px;
  color: #111827;
}

.login-card p {
  margin-bottom: 20px;
  color: #6b7280;
  font-size: 14px;
}

.login-card input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.login-card button {
  width: 100%;
  padding: 10px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

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

/* ================= CRM LAYOUT ================= */

.crm {
  display: flex;
  width: 100%;
  height: 100vh;
  align-items: stretch;
}

/* ================= SIDEBAR ================= */

.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, #0f172a, #020617);
  color: white;
  padding: 20px;

  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
}

/* ================= BOXEN ================= */

.topBox,
.userBox,
.taskBox {
  background: #1e293b;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ================= INPUT + BUTTON ================= */

.topBox input {
  width: 100%;
  padding: 6px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: none;
}

.topBox button,
.userBox button {
  width: 100%;
  margin-top: 5px;
  padding: 6px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #2563eb;
  color: white;
}

/* ================= CONTENT AREA ================= */

.contentArea {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100vh;
  padding: 20px;
  gap: 20px;
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
}

/* ================= HAUPTSPALTEN ================= */

.kundeSpalte {
  flex: 1 1 420px;
  min-width: 320px;
  max-width: none;
}

.vorgaengeSpalte {
  flex: 1.4 1 500px;
  min-width: 320px;
  max-width: none;
}

.customerColumn {
  flex: 0 0 300px;
  width: 300px;
  min-width: 260px;
  max-width: 340px;
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  overflow: auto;
  align-self: stretch;
}

/* ================= LINKER INHALT ================= */

.leftColumn {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.customerEdit {
  width: 100%;
  min-width: 0;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.taskBelow {
  width: 100%;
  min-width: 0;
}

/* ================= CUSTOMER ================= */

.customerEdit input,
.customerEdit select,
.customerEdit textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 13px;
}

.customerEdit textarea {
  min-height: 80px;
  resize: vertical;
}

.customerEdit h2 {
  margin-bottom: 10px;
}

/* ================= FORM ================= */

.formRow {
  display: flex;
  gap: 10px;
  width: 100%;
}

.formRow input,
.formRow select,
.formRow textarea {
  flex: 1 1 0;
  min-width: 0;
}

.formActions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.formActions button {
  flex: 1 1 0;
  min-width: 0;
}

/* ================= TASKS ================= */

.task {
  padding: 6px;
  margin-bottom: 6px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: white;
  font-weight: 500;
}

.task.red {
  background: #ef4444;
}

.task.yellow {
  background: #f59e0b;
}

.task.green {
  background: #22c55e;
}

/* ================= CUSTOMER LIST ================= */

.customerItem {
  padding: 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: 0.2s;
}

.customerItem:hover {
  background: #f8fafc;
}

.customerName {
  font-size: 14px;
  color: #111;
}

.customerSub {
  font-size: 13px;
  color: #555;
}

.customerSub.small {
  font-size: 12px;
  color: #888;
}

/* ================= OVERLAY ================= */

.formOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  padding: 20px;
}

.formCard {
  background: white;
  padding: 30px;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ================= SAVE BUTTON ================= */

#saveBtn {
  background: #2563eb;
}

#saveBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1200px) {
  .contentArea {
    flex-wrap: wrap;
  }

  .kundeSpalte,
  .vorgaengeSpalte {
    flex: 1 1 100%;
  }

  .customerColumn {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow: auto;
  }

  .crm {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    border-radius: 0;
  }

  .contentArea {
    height: auto;
    padding: 15px;
    gap: 15px;
    flex-direction: column;
    overflow: visible;
  }

  .kundeSpalte,
  .vorgaengeSpalte,
  .customerColumn {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }

  .formRow,
  .formActions {
    flex-direction: column;
  }
}