/* === Layout-Grundstruktur === */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    padding-top: 70px; /* Header-Höhe */
    padding-bottom: 100px; /* Footer-Höhe */
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #4CAF50;
    border-bottom: 1px solid #ddd;
    z-index: 1000;
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.header-left, .header-center, .header-right {
    flex: 1;
}

.header-center {
    text-align: center;
}

.header-right {
    text-align: right;
    font-size: 0.9em;
    white-space: nowrap; /* verhinder Zeilenumbruch */
}

.header-center h1 {
    margin: 0.2em 0;   /* weniger Platz oben/unten */
    font-size: 1.5rem; /* ggf. auch etwas kleiner */
    line-height: 1.2;  /* kompakter Zeilenabstand */
}

/* ----- Mobile Ansicht ----- */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column; /* untereinander statt nebeneinander */
        align-items: center;
        text-align: center;
        padding: 0.5rem;
    }

    .header-left {
        display: none; /* leere Box braucht man nicht */
    }

    .header-center {
        flex: none;
        margin-bottom: 0.3rem;
    }

    .header-right {
        flex: none;
        font-size: 0.8em;
        text-align: center;
    }
}

footer {
    position: fixed;      /* fixiert den Footer am Bildschirm */
    bottom: 0;            /* am unteren Rand */
    left: 0;              /* linksbündig */
    width: 100%;          /* volle Breite */
    text-align: center;
    font-size: 0.9em;
    border-top: 1px solid #ddd;
    background: #4CAF50;
    padding: 0;
    z-index: 1000;        /* sicherstellen, dass Footer über allem liegt */
}

.footer-menu {
    display: flex;
    justify-content: center;  /* Icons mittig verteilen */
    gap: 2rem;                /* Abstand zwischen Links */
    padding: 1rem 0;
}

.footer-menu a {
    display: flex;
    flex-direction: column;   /* Icon über Text */
    align-items: center;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: transform 0.2s, color 0.2s;
}

.footer-menu a .icon {
    font-size: 2rem;          
    margin-bottom: 0.3rem;
}

/* Hover-Effekt */
.footer-menu a:hover {
    color: #c8f7c5; /* helleres Grün */
    transform: scale(1.05);
}

/* Aktive Seite hervorheben */
.footer-menu a.active {
    color: #FFD700;  /* Gold/gelb für gute Sichtbarkeit */
    font-weight: bold;
}

.footer-menu a.active .icon {
    font-size: 2.3rem;   /* aktives Icon etwas größer */
}


h3 {
  margin-top: 0.1em;
  margin-bottom: 0.1em;
}
/* === Container & Zentrierung === */
.container {
    padding: 0.8em;
    max-width: 800px;
    margin: 0 auto;
}

/* === Formular-Styling === */
.add-form,
.add-form-setup,
.edit-form {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: stretch;
}

.add-form,
.add-form-setup {
    flex-direction: column;
}

.add-form input,
.add-form select,
.add-form checkbox,
.add-form textarea,
.add-form button,
.add-form number,
.add-form-setup input[type="text"],
.add-form-setup button {
    font-size: 1.1em;
    padding: 0.6em;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    height: 45px;
}

.add-form textarea {
    height: 150px;
    resize: vertical;
}

.add-form input { flex: 2 1 50%; }
.add-form select { flex: 1 1 25%; }
.add-form checkbox { flex: 2 1 50%; }
.add-form button,
.add-form number,
.add-form-setup button {
    flex: 0 0 25%;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

.add-form button:hover,
.add-form-setup button:hover {
    background-color: #45a049;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 5px;
}


/* === Checkbox-Reihen (flexibel, bündig, linksbündig) === */
.form-row-setup {
    display: flex;
    flex-wrap: wrap;        /* Checkboxen gehen in nächste Zeile, wenn nicht genug Platz */
    gap: 1px 20px;          /* vertikaler Abstand 6px, horizontaler 10px */
}

.form-row-setup .setup-checkbox {
    display: flex;
    align-items: center;    /* Text neben Checkbox */
    gap: 4px;               /* Abstand zwischen Checkbox und Text */
    white-space: nowrap;    /* Text bleibt in einer Zeile */
}





.edit-form {
    flex: 1;
    gap: 5px;
    align-items: center;
}

.name-input {
    flex: 1;
    padding: 6px;
    min-width: 0;
}

/* === Farbauswahl / Color Picker === */
.color-picker {
    display: flex;
    gap: 5px;
    justify-items: start; /* sorgt für Links-Bündigkeit */
}

.color-picker input[type="radio"] {
    display: none;
}

.color-btn {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ccc;
    cursor: pointer;
}

.color-picker input[type="radio"]:checked + .color-btn {
    border: 2px solid #000;
}

/* === Listen-Styling === */
.group,
.history {
    list-style: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    padding: 10px;
    margin-left: 0;
}

.group li,
.history li {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fdfdfd;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 10px;
    font-size: 1.1em;
}

.group li span.name,
.history li span.name {
    flex: 1;
}

.group li .actions,
.history li .actions {
    display: flex;
    gap: 0.4em;
}

/* === Artikel-Zustände === */
.artikel-item.done .name,
.artikel-item.done .supermarkt {
    text-decoration: line-through;
    opacity: 0.6;
}

.artikel-item .restore.hidden {
    display: none;
}


/* === Buttons / Aktionen === */
.left-actions,
.right-actions {
    display: flex;
    gap: 0.5em;
}

a.done,
a.edit,
a.restore,
a.restore_historie,
a.del,
a.prio,
a.noprio {
    font-size: 1.3em;
    text-decoration: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: white;
}

a.edit { background-color: Gainsboro; }
a.done { background-color: green; }
a.restore,
a.restore_historie { background-color: blue; }
a.del { background-color: red; }
a.prio,
a.noprio { background-color: Gainsboro; }

/* === Notizen / Notizkarten === */
.note-card {
    background: #fdfdfd;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.note-card + .note-card {
    border-top: 1px solid #ccc;
}

.note-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
}

.note-card p {
    margin: 8px 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* === Checkbox (global) === */
.global-checkbox {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    margin-top: 4px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap; /* verhindert, dass Icon/Text umbrechen */
}

.global-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    cursor: pointer;
}

.global-checkbox span {
    white-space: nowrap;
}

/* === Hilfsklassen === */
.hidden {
    display: none !important;
}

.dragging {
    opacity: 0.5;
}

.drag-handle {
    cursor: grab;
    margin-right: 10px;
}

/* === Responsive: Mobile === */
@media (max-width: 500px) {
    .add-form {
        flex-direction: column;
    }

    .add-form input,
    .add-form select,
    .add-form textarea,
	.add-form number,
	.add-form checkbox,
    .add-form button {
        width: 100%;
    }
}
/* === Neue Listen-Elemente (z. B. für Gruppenverwaltung) === */
.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
    background: #fdfdfd;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.list-item form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.list-item button {
    background-color: Gainsboro;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
}

.list-item button:hover {
    background-color: #ccc;
}

.delete-form button {
    background-color: red;
    color: white;
}

.delete-form button:hover {
    background-color: darkred;
}

/* Optional: Style für Pfeil-Buttons */
.left-actions a {
    font-size: 1.2em;
    text-decoration: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: #ddd;
    color: black;
    cursor: pointer;
}

.left-actions a:hover {
    background-color: #ccc;
}



/* + Button für neue Aufgabe */
.add-button {
	display: flex;                /* Flexbox aktivieren */
    align-items: center;          /* vertikal zentrieren */
    justify-content: center;      /* horizontal zentrieren */s
    cursor: pointer;
    width: 100%;
    height: 45px;
    font-size: 1.1em;
    padding: 0.6em;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    margin-bottom: 1rem;
    background: #4caf50;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s;
}


.aufgaben-task-list {
    list-style: none;
    padding: 0;
    gap: 5px;
    margin: 0 0 2rem 0;
    margin-left: 0;
}

/* Fällige Aufgaben optisch hervorheben */
.task-item.fällig {
    background: #fff2f0;       /* leicht rosa Hintergrund */
}

.task-item.fällig strong {
    color: #c62828;            /* roter Titel */
}




/* ===== spezielle Regeln für .aufgaben (überschreibt .group li) ===== */
.aufgaben-group
 {
    list-style: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    padding: 10px;
    margin-left: 0;
}

.aufgaben-group li.aufgaben,
.group-task-list li.aufgaben,
.aufgaben.artikel-item {
  display: flex;
  flex-direction: column; /* wichtigste Regel: alles untereinander */
  align-items: stretch;
    background: #fdfdfd;
    gap: 5px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 10px;
    font-size: 1.1em;
}

.aufgaben-group li.aufgaben span.name {
    flex: 1;
}

.aufgaben-group li.aufgaben .actions {
    display: flex;
    gap: 0.4em;
}

/* Header: Name und Aktionen nebeneinander */
.aufgaben .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.aufgaben .header .name {
  font-weight: 600;
  flex: 1;
  margin-right: 0.5rem;
  word-break: break-word;
}
.aufgaben .actions { display: flex; gap: 0.4rem; }

/* Beschreibung */
.aufgaben .description p {
  margin: 0;
  font-size: 0.96rem;
  color: #444;
  line-height: 1.35;
}

.description * {
  all: revert;
  margin: 0;
  font-size: 0.96rem;
  color: #444;
  line-height: 1.35;
}

/* Progress-Bar */
.aufgaben .progress-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 5px 0;
}

/* Track + Fill */
.aufgaben .progress-track {
  flex: 1 1 auto;         /* wichtig: erlaubt flex-grow UND Schrumpfen */
  min-width: 40px;        /* verhindert, dass Chrome die Breite auf 0 setzt */
  height: 10px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.aufgaben .progress-fill {
  display: block;         /* Chrome braucht das explizit */
  height: 100%;
  width: 0;               /* Startwert */
  max-width: 100%;        /* falls progress > 100 */
  border-radius: 999px;
  background: linear-gradient(90deg, #7cc242, #4caf50);
  transition: width 0.3s ease;
}

/* Text (links/rechts) */
.progress-bar .interval {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #333;
    z-index: 2;
}
.progress-bar .due-date {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #333;
    z-index: 2;
}

/* Kleine responsive Anpassung */
@media (max-width: 560px) {
  .aufgaben .progress-bar { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 0.4rem; 
  }
  .progress-bar .interval,
  .progress-bar .due-date { 
    font-size: 0.85rem; 
  }
}

/* === Quill Editor Styling im Formular-Stil === */
.quill-custom-editor {
    font-size: 1.1em;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    height: 150px;
    max-height: 300px;
    background: white;
    padding: 0;
    overflow-y: auto;
}

/* Quill-Editor selbst (Inhaltsteil) */
.quill-custom-editor .ql-editor {
    padding: 12px;
    height: 100%;
    line-height: 1.4;
    font-family: inherit; /* gleiche Schrift wie restliches UI */
    overflow-y: auto;
}

/* Quill Toolbar anpassen */
.ql-toolbar {
    border-radius: 6px 6px 0 0;
    border-color: #ccc;
}

/* Editor-Body nur unteren Rand abrunden */
.ql-container {
    border-radius: 0 0 6px 6px;
    border-color: #ccc;
}

.ql-tooltip {
  left: 0 !important;
  right: auto !important;
  transform: translateX(0) !important;
  max-width: 300px; /* Falls nötig */
  word-wrap: break-word;
}

.group li,
.history li {
    justify-content: space-between;
    overflow: hidden;
}

.group li span.name,
.history li span.name {
    flex: 1;
    min-width: 0; /* <<< verhindert Überdehnung */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal; /* erlaubt Zeilenumbruch */
}

.group li .right-actions,
.history li .right-actions {
    flex-shrink: 0; /* <<< Buttons behalten ihre Breite */
    display: flex;
    gap: 0.4em;
}