@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #16a34a;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Inter', sans-serif; 
}

/* STICKY FOOTER LAYOUT */
html, body {
  height: 100%;
}

body { 
  background-color: var(--bg); 
  color: var(--text); 
  line-height: 1.5; 
  display: flex; 
  flex-direction: column; 
}

/* Der Inhalts-Container dehnt sich aus */
.page-content { 
  flex: 1 0 auto;
  width: 100%;
  max-width: 1600px; /* Breitere Ausnutzung auf großen Monitoren */
  margin: 0 auto;
  padding: 20px 24px 40px 24px; 
}

/* HEADER STYLING */
header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

header h1 { 
  font-size: 1.8rem; 
  color: var(--primary); 
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}

.stats-container { display: flex; gap: 8px; }
.stat-badge { font-size: 0.8rem; font-weight: 700; padding: 6px 12px; border-radius: 20px; }
.stat-open { background-color: #dbeafe; color: #1e40af; }
.stat-done { background-color: #dcfce7; color: #166534; }

.nav-btn {
  background-color: var(--border);
  color: var(--text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.nav-btn:hover { 
  background-color: #cbd5e1; 
}

/* DATUM NAVIGATIONSLEISTE */
.date-bar {
  width: 100%;
  margin-bottom: 24px;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.date-nav-controls { display: flex; align-items: center; gap: 10px; }
.date-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.2s;
}
.date-btn:hover { background: #e2e8f0; }

.toggle-all-btn {
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.toggle-all-btn.active { 
  background: #dbeafe; 
  color: #1e40af; 
  border-color: var(--primary); 
  font-weight: 600;
}

/* GLEICHMÄSSIGES 3-SPALTEN GRID */
main {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Verhindert das Überlappen bei langen Texten */
  gap: 24px;
  align-items: stretch; /* Alle Spalten sind gleich hoch */
}

/* REPRESENSIVES BREAKPOINT FÜR TABLETS & MOBIL */
@media (max-width: 1100px) {
  main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.card h2 { 
  font-size: 1.15rem; 
  margin-bottom: 16px; 
  display: flex;
  align-items: center;
  gap: 8px;
}

/* DYNAMISCHER SCROLLCONTAINER HÖHE */
.scrollable-container { 
  max-height: 650px; 
  overflow-y: auto; 
  padding-right: 4px; 
  flex: 1;
}
.scrollable-container::-webkit-scrollbar { width: 6px; }
.scrollable-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* FORMULARE */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
input, textarea, select { 
  width: 100%; 
  padding: 9px 12px; 
  border: 1px solid var(--border); 
  border-radius: 6px; 
  font-size: 0.95rem; 
  background-color: #ffffff;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.btn-group { display: flex; gap: 8px; margin-top: 8px; }
button[type="submit"] { 
  width: 100%; 
  background-color: var(--primary); 
  color: white; 
  border: none; 
  padding: 10px; 
  border-radius: 6px; 
  font-weight: 600; 
  cursor: pointer; 
  transition: background 0.2s;
}
button[type="submit"]:hover { background-color: var(--primary-hover); }
.btn-cancel { 
  background-color: var(--text-muted); 
  display: none; 
  color: white; 
  border: none; 
  padding: 10px; 
  border-radius: 6px; 
  cursor: pointer; 
}

/* AUFKLAPPBARE ACCORDIONS */
.day-group { 
  margin-bottom: 12px; 
  border: 1px solid var(--border); 
  border-radius: 8px; 
  overflow: hidden; 
}

.day-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: #eff6ff;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.day-header.done { color: var(--success); background: #f0fdf4; }
.day-header:hover { opacity: 0.9; }

.task-list { list-style: none; padding: 10px; background: white; }
.task-item { 
  padding: 12px; 
  border: 1px solid var(--border); 
  border-radius: 6px; 
  margin-bottom: 8px; 
  background: #fafafa; 
}
.task-item:last-child { margin-bottom: 0; }
.task-item.done-item { background-color: #f8fafc; border-left: 4px solid var(--success); }

.task-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.time-badge { font-size: 0.75rem; font-weight: 700; background: #e2e8f0; padding: 3px 8px; border-radius: 4px; }
.task-location { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.task-phone { font-size: 0.8rem; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.task-meta { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

.action-buttons { display: flex; gap: 6px; }
.btn-action { padding: 5px 10px; font-size: 0.75rem; width: auto; border-radius: 4px; border: none; color: white; cursor: pointer; font-weight: 600; }
.btn-edit { background: var(--warning); }
.btn-delete { background: var(--danger); }
.btn-reopen { background: var(--text-muted); }

/* FOOTER FIXIERUNG */
.custom-footer {
  flex-shrink: 0;
  position: relative;
  background-color: #0284c7;
  color: white;
  padding: 20px;
  margin-top: 40px;
  text-align: center;
}
.footer-wave { position: absolute; top: -30px; left: 0; width: 100%; overflow: hidden; line-height: 0; }
.footer-wave svg { position: relative; display: block; width: calc(100% + 1.3px); height: 32px; }
.footer-wave .shape-fill { fill: #0284c7; }
.footer-text { font-size: 0.9rem; font-weight: 500; color: #e0f2fe; }
/* --- NEUER GROSSZÜGIGER HEADER & DROPDOWN --- */
header {
  padding: 12px 0 20px 0;
  margin-bottom: 24px;
}

.version-tag {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Dropdown Container */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-btn {
  background-color: var(--primary);
  color: white;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.dropdown-btn:hover {
  background-color: var(--primary-hover);
}

.dropdown-arrow {
  font-size: 0.7rem;
}

/* Dropdown Inhalt */
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background-color: #ffffff;
  min-width: 200px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  color: var(--text);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.15s;
  border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background-color: #eff6ff;
  color: var(--primary);
}