:root {
  --bg: #e7ddcb;
  --fg: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-fg: #fff;
  --border: #e5e7eb;
  --accent: #edb3a1;
  --accent-foreground: #1e1b4b;
  --secondary: #f3f4f6;
  --secondary-foreground: #1f2937;
  --destructive: #f87171;
  --destructive-foreground: #fff;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  margin: 0 auto;
  padding: 2rem;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.day {
  position: relative;
  padding: 0.5rem;
  border-radius: 8px;
  background: white;
}

.day-header {
  position: relative;
}

.course-icons {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.course-icon {
  display: inline-block;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #333;
  border: 1px solid #ccc;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  margin-top: 1rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid #bbb;
  border-radius: 6px;
  background-color: #fff;
  transition: all 0.2s ease;
  position: relative;
}

.checkbox-label input[type="checkbox"]:checked {
  background-color: #efb8ab; /* gleiche Farbe wie Button */
  border-color: #efb8ab;
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '✔';
  color: white;
  font-size: 0.9rem;
  position: absolute;
  top: 0;
  left: 2px;
}

.checkbox-label input[type="checkbox"]:hover {
  border-color: #999;
}

.checkbox-label input[type="checkbox"]:focus {
  outline: 2px solid #ccc;
  outline-offset: 2px;
}

.top-logo {
  display: none;
  position: absolute;
  top: 20px;
  right: 50px;
}

.top-logo img {
  height: 100px;
}

@media screen and (min-width: 700px) {
  .top-logo {
    display: block;
  }
}

input, button, select {
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  box-sizing: border-box;
}

.buttonbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

li {
	padding: 5px;
}

/* Basis-Buttonstil */
.button, .delete-button, .slot-button, .logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.6rem;
  font-size: 1rem;
  font-weight: 500;
  color: #000;
  background-color: #edb3a1;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, box-shadow .2s;
}

.button:hover, .delete-button:hover, .slot-button:hover, .logout:hover {
  background-color: #ffd7cb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

button, input[type="submit"] {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.6rem;
  font-size: 1rem;
  font-weight: 500;
  color: #000;
  background-color: #edb3a1;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color .2s, box-shadow .2s;
}
button:hover, input[type="submit"]:hover {
  background-color: #e0e0e0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#extraButtonsContainer {
  position: absolute;
  display: none;
  flex-direction: column;
  margin-top: 0.4rem;
  gap: 0.4rem;
  top: 100%;       /* unter dem Auslöser */
  left: 0;
  z-index: 1000;
}

/* damit Container an richtiger Stelle erscheint */
.user-button + #extraButtonsContainer {
  /* wird von JS an richtige Position gesetzt, falls nötig */
}

.extra-button {
  display: flex;
  background-color: #fff;
  color: #212121;
  padding: 0.6rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  white-space: nowrap;
}

.logout:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.logout strong {
  font-weight: 600;
  color: #2b2b2b;
}

.logout-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-width: 100%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 10;
}

.logout-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  text-decoration: none;
  color: #333;
  border-radius: 6px;
}

.logout-menu a:hover {
  background-color: #eee;
}

.card, .day-card {
  width: 100%;
  max-width: 100%;
  margin: 0 auto; /* falls zentriert */
  box-sizing: border-box;
}

.weekday {
  font-size: 0.6em;
  display: block;
  margin-top: 4px;
  color: #b1b1b1;
}

.weekday.saturday {
  color: #e2a464; /* Blau für Samstag */
  font-weight: bold;
}

.weekday.sunday {
  color: #e2a464; /* Rot für Sonntag */
  font-weight: bold;
}

.card:hover, .day-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem;
}

.grid-admin {  
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 1.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.day {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  min-height: 80px;
  background-color: white;
  position: relative;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.day.booked {
  border: 2px solid #22c55e;
  box-shadow: 0 0 0 2px #bbf7d0;
}

.day.available:hover {
  background-color: #bfdbfe;
  box-shadow: 0 0 0 2px var(--primary);
  cursor: pointer;
}

.slot-count {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: #edb3a1;
  color: #000000;
  border-radius: 0.375rem;
  font-weight: 500;
}

.nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav a {
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.nav a:hover {
  background: #ffd7cb;
}

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: none;
  justify-content: center;
  align-items: flex-start; 
  padding-top: 5vh;
  z-index: 999;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  width: 95%;
  max-width: 800px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
}

.modal .close {
  position: absolute;
  right: 2rem;
  top: 2rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.close {
  float: right;
  font-size: 1.5rem;
  cursor: pointer;
  margin-top: -0.5rem;
  margin-right: -0.5rem;
}

.slot-button {
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.2s ease;
}

.slot-button:hover {
  background: #1d4ed8;
}

.slot-select {
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

.slot-email {
  width: 100%;
  margin-bottom: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

table th, table td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

table th {
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
}

.alert {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
}

.card .delete-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-button {
  background: var(--destructive, #ef4444);
  color: var(--destructive-foreground, #fff);
  border: none;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.delete-button:hover {
  background: #dc2626;
}

.card.admin-card {
position: relative;
}

.admin-card {
display: flex;
flex-direction: column;

height: 100%;
min-height: 300px;
padding: 1.5rem;
border-radius: 12px;
background-color: #fff;
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.admin-card h2 {
font-size: 1.6rem;
font-weight: 600;
margin-bottom: 1rem;
padding-bottom: 0.4rem;
border-bottom: 2px solid #e0e0e0;
color: #1f1f1f;
display: flex;
align-items: center;
gap: 0.5rem;
}

.admin-card form {
display: flex;
flex-direction: column;
flex-grow: 1; /* macht die Form dehnbar */
}

.admin-card form label {
margin-bottom: 1rem;
}

.admin-card .button-bar {
margin-top: auto;
text-align: center;
}

.grid-terminvorschau {
flex-grow: 1;
gap: 5px;
margin-top: 1rem;
margin-bottom: 1rem;
}

.day-card {
background-color: #f9f9f9;
border: 1px solid #ddd;
padding: 1rem;
margin-bottom: 1rem;
border-radius: 10px;
min-width: 180px;
flex: 1 1 45%;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
transition: transform 0.2s;
}

.day-card:hover {
transform: scale(1.02);
background-color: #f0f0f0;
}

.day-date {
font-weight: 600;
font-size: 1.1rem;
margin-bottom: 0.4rem;
color: #222;
}

.day-slots {
font-size: 0.95rem;
color: #666;
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal.open {
  display: flex !important;
}

.button-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.button-group button {
  flex: 1;
}

.day.today {
  border: 2px solid #3b82f6;
  box-shadow: 0 0 0 2px #dbeafe;
}

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.delete-form {
  display: inline;
}

.rechnungs-kachel {
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.rechnungs-kachel strong {
  font-size: 1rem;
  display: block;
  margin-bottom: 0.3rem;
}

.rechnungs-kachel button {
  margin-top: 0.5rem;
  background-color: #dcb8ac;
  color: #333;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.rechnungs-kachel button:hover {
  background-color: #cfa192;
}

#rechnungsbereich {
  display: flex;
  gap: 1rem;
}

.statistik-card {
  flex: 2; /* Breiter als Archiv */
  background: #fff;
  padding: 1.5rem;
  border-radius: 0.75rem;
}

.archiv-card {
  flex: 1;
  background: #fefefe;
  padding: 1.5rem;
  border-radius: 0.75rem;
}

@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  h1, h2, h3 {
    font-size: 1.25rem;
  }

  input, button, select {
    font-size: 1rem;
  }

  .modal-content {
    padding: 1rem;
    width: 95%;
    max-width: 100%;
  }

  .slot-button {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }

  .day {
    min-height: 70px;
    padding: 0.5rem;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card, .day-card {
    padding: 1rem;
  }

  .grid-admin {  
    gap: 0.5rem;
    padding: 0rem;
  }

  .modal .close {
    font-size: 1.25rem;
    top: 1.5rem;
    right: 1.5rem;
  }
}

.modal-buchen {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: flex-start;   
  padding: 10vh 0; /* 10% Abstand oben und unten */
}

.modal-buchen-content {
  background: #fff;
  padding: 2rem 2rem 5rem 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-buchen-content form {
  bottom: 0;
  background: #fff;
  padding: 1rem 0 0 0;
  margin-top: 1rem;
}
	.modal-buchen-content::-webkit-scrollbar {
	  width: 8px;
	}
	.modal-buchen-content::-webkit-scrollbar-track {
	  background: #f1f1f1;
	  border-radius: 4px;
	}
	.modal-buchen-content::-webkit-scrollbar-thumb {
	  background: #bbb;
	  border-radius: 4px;
	}
	.modal-buchen-content::-webkit-scrollbar-thumb:hover {
	  background: #888;
	}
  .modal-buchen-content h2 {
    margin-top: 0;
    font-size: 1.4rem;
  }
  .close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
  }
  .modal-label {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    font-weight: bold;
  }
  .modal-label small {
    font-weight: normal;
    color: #666;
    margin-bottom: 0.5rem;
  }
  .slot-email {
    padding: 0.6rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
  }
  .slot-email:focus {
    border-color: #2c7be5;
    box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.15);
  }
  .slot-section {
    margin-bottom: 1rem;
  }
  .slot-section-header {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.3rem;
  }
  .slot-date {
    font-weight: bold;
    color: #e74c3c;
  }
  .slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
  }
  .slot-item {
    position: relative;
    background: #e0e0e0;
    border-radius: 10px;
    padding: 0.65rem 0.4rem 1.2rem;
    text-align: center;
    cursor: not-allowed;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  }
  .slot-item.available {
    background: #b5b5b5;
    color: #fff;
    cursor: pointer;
  }
  .slot-item.available:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .slot-item.active {
    background: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.25);
  }
  .slot-time {
    font-size: 0.95rem;
    display: block;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: .1px;
  }
  .slot-free {
    position: absolute;
    bottom: 0.35rem;
    right: 0.45rem;
    font-size: 3.8rem;
    font-weight: 800;
    line-height: 1;
    color: rgba(0, 0, 0, 0.1);
    pointer-events: none;
  }