/*
 * ============================================================
 *  Design System – Light / Frosted Glass
 *  Stack: Bootstrap 5 + Material Icons (Google Fonts)
 *  Übernommen aus design-system/design-system.css
 * ============================================================
 */

/* ----------------------------------------------------------
   BASE
---------------------------------------------------------- */
body {
    background: linear-gradient(160deg, #e8e0f5 0%, #e0e4f8 50%, #d4e0f8 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding-top: 60px; /* Platz für fixed navbar */
    padding-bottom: 2rem;
}
.container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
@media (min-width: 576px) {
    .container { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 992px) {
    .container { padding-left: 2rem; padding-right: 2rem; }
}

/* ----------------------------------------------------------
   NAVBAR  —  frosted glass, fixed top
   HTML: <nav class="navbar navbar-expand-lg navbar-light fixed-top" id="main-nav">
---------------------------------------------------------- */
#main-nav {
    background: rgba(45, 48, 58, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

#main-nav .navbar-brand {
    font-weight: 700;
    color: #f0f0f2;
    letter-spacing: -.01em;
}

#main-nav .nav-link { color: rgba(255, 255, 255, 0.88); }
#main-nav .nav-link:hover,
#main-nav .nav-link:focus { color: #fff; }
#main-nav .nav-link.active { color: #fff; font-weight: 600; }

/* ----------------------------------------------------------
   PAGE HEADER
---------------------------------------------------------- */
.page-header {
    padding: 1.75rem 0 1.25rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 1.75rem;
}

/* ----------------------------------------------------------
   CARDS – Frosted, kompakte Maße wie Task-Items (app-weit)
---------------------------------------------------------- */
.card,
.section-card {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
}
.card {
    border-radius: 14px;
}
.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
}
.card-body {
    padding: 1rem 1.25rem;
}
@media (min-width: 576px) {
    .card-body { padding: 1.1rem 1.25rem; }
}

/* ----------------------------------------------------------
   SECTION CARD
---------------------------------------------------------- */
.section-card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.section-card-header .material-icons {
    font-size: 18px;
    color: #6c757d;
}

.section-card-header .section-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
}

.section-card-body {
    padding: 1rem 1.25rem;
}
@media (min-width: 576px) {
    .section-card-body { padding: 1.1rem 1.25rem; }
}

/* ----------------------------------------------------------
   BUTTONS  —  .btn-primary-dark, .btn-ghost, .btn-icon
---------------------------------------------------------- */
.btn-primary-dark {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #212529;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .55rem 1.2rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease;
}
.btn-primary-dark:hover { background: #343a40; color: #fff; }
.btn-primary-dark .material-icons { font-size: 16px; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #6c757d;
    border-radius: 10px;
    padding: .5rem 1rem;
    font-size: .875rem;
    text-decoration: none;
    cursor: pointer;
    transition: all .2s ease;
}
.btn-ghost:hover { background: #f8f9fa; color: #212529; border-color: #adb5bd; }
.btn-ghost .material-icons { font-size: 16px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 10px;
    padding: .4rem;
    color: #6c757d;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.btn-icon:hover { background: #f1f3f5; color: #212529; }
.btn-icon .material-icons { font-size: 18px; }

/* ----------------------------------------------------------
   FORM FIELDS  —  .form-field
---------------------------------------------------------- */
.form-field label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    margin-bottom: 0.4rem;
}

.form-field .form-control,
.form-field .form-select {
    border-radius: 10px;
    font-size: .875rem;
    border-color: #dee2e6;
    padding: 0.5rem 0.75rem;
}

.form-field .form-control:focus,
.form-field .form-select:focus {
    border-color: #6c757d;
    box-shadow: 0 0 0 3px rgba(108,117,125,.1);
}

/* ----------------------------------------------------------
   LIST GROUP – mehr Abstand (app-weit)
---------------------------------------------------------- */
.list-group-item {
    padding: 0.75rem 1rem;
}
@media (min-width: 576px) {
    .list-group-item { padding: 0.85rem 1.25rem; }
}

/* Notizliste: aktiver Eintrag – helles Blau */
#note-list .list-group-item.active {
    background-color: #d4e0f8;
    border-color: #b8cce8;
    color: #1a2d4a;
}
#note-list .list-group-item.active small {
    color: #3d5a80 !important;
}

/* ----------------------------------------------------------
   INLINE ALERT
---------------------------------------------------------- */
.inline-alert {
    border-radius: 10px;
    font-size: .875rem;
}

/* ----------------------------------------------------------
   BADGES – Pills, weniger gesättigte Farben (app-weit)
---------------------------------------------------------- */
.badge {
    border-radius: 999px;
    padding: 0.35em 0.7em;
    font-weight: 500;
}
.badge.bg-primary {
    background-color: #b8c5f5 !important;
    color: #2c3e8a !important;
}
.badge.bg-secondary {
    background-color: #e2e5ea !important;
    color: #495057 !important;
}
.badge.bg-success {
    background-color: #bbf0d1 !important;
    color: #0d5c2e !important;
}
.badge.bg-info {
    background-color: #c5dcfa !important;
    color: #1e4976 !important;
}
.badge.bg-warning {
    background-color: #fce9b9 !important;
    color: #7c5a0a !important;
}
.badge.bg-danger {
    background-color: #f5c6cb !important;
    color: #842029 !important;
}
/* Outline-Badges (index ToDo) unverändert – nur Pills */
.badge.bg-transparent.border-primary { border-radius: 999px; }
.badge.bg-transparent.border-secondary { border-radius: 999px; }

/* ----------------------------------------------------------
   STATUS CHIPS
---------------------------------------------------------- */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .25rem .65rem;
    border-radius: 999px;
}
.chip-success  { background: #d1fae5; color: #065f46; }
.chip-warning  { background: #fef3c7; color: #92400e; }
.chip-danger   { background: #fee2e2; color: #991b1b; }
.chip-neutral  { background: #f1f3f5; color: #495057; }
.chip-info     { background: #dbeafe; color: #1e40af; }

/* ----------------------------------------------------------
   LIST ROW  —  .item-list, .item-row
---------------------------------------------------------- */
.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #f1f3f5;
}
.item-row:last-child { border-bottom: none; }
.item-name { font-size: .9rem; font-weight: 600; color: #212529; }
.item-sub  { font-size: .78rem; color: #6c757d; }
.item-actions { display: flex; gap: .3rem; align-items: center; }

/* ----------------------------------------------------------
   LOGIN CARD  (Auth-Seiten ohne Haupt-Nav)
---------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(160deg, #e8e0f5 0%, #e0e4f8 50%, #d4e0f8 100%);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 2rem 2rem;
    width: 100%;
    max-width: 380px;
}
.login-card .app-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -.02em;
}
.login-card .app-tagline {
    font-size: .82rem;
    color: #6c757d;
}

/* ----------------------------------------------------------
   Seite ToDo (index) – etwas kleinere, elegantere Typografie
---------------------------------------------------------- */
.page-todo {
    font-size: 0.9375rem; /* ~15px, etwas kleiner als Standard */
}
.page-todo .form-control,
.page-todo .form-select {
    font-size: 0.9375rem;
    padding: 0.4rem 0.65rem;
}
.page-todo .list-group-item {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.9375rem;
}
.page-todo .list-group-item .task-title {
    font-size: 0.9375rem;
}
.page-todo .list-group-item small {
    font-size: 0.75rem;
}
.page-todo .btn,
.page-todo .btn-sm {
    font-size: 0.8125rem;
}
/* Kategorie- und Label-Buttons oben dezenter */
.page-todo .page-todo-filters .btn-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}
.page-todo .page-todo-filters .dropdown-menu {
    font-size: 0.875rem;
}
.page-todo .page-todo-filters small {
    font-size: 0.75rem;
}
.page-todo .dropdown-menu {
    font-size: 0.875rem;
}
.page-todo .modal-title {
    font-size: 1rem;
}
.page-todo .modal .form-label,
.page-todo .modal .form-control,
.page-todo .modal .form-select {
    font-size: 0.875rem;
}

/* ----------------------------------------------------------
   TODO FILTER PILLS
---------------------------------------------------------- */
.todo-filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1.5px solid rgba(108,117,125,0.35);
    background: rgba(255,255,255,0.55);
    color: #495057;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}
.todo-filter-btn:hover {
    background: rgba(255,255,255,0.85);
    border-color: rgba(108,117,125,0.6);
    color: #212529;
}
.todo-filter-btn.active {
    background: #212529;
    border-color: #212529;
    color: #fff;
}
.todo-filter-btn--sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.65rem;
}

/* ----------------------------------------------------------
   TODO ADD FORM
---------------------------------------------------------- */
.todo-add-form {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.todo-add-form .form-control,
.todo-add-form .form-select {
    font-size: 0.9rem;
    border-radius: 10px;
    border-color: rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.75);
}
.todo-add-btn {
    border-radius: 10px !important;
    padding: 0.4rem 0.85rem !important;
}

/* ----------------------------------------------------------
   TASK CARDS
---------------------------------------------------------- */
#task-list,
#family-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-card {
    position: relative;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    cursor: grab;
}
.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}
.task-card.dragging {
    opacity: 0.45;
    cursor: grabbing;
}
.task-card--done {
    opacity: 0.55;
    background: rgba(255,255,255,0.38);
}
.task-card--done:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.task-card-accent {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
}

.task-card-inner {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 1.15rem;
    gap: 0.75rem;
}

/* Custom circular checkbox */
.task-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid #adb5bd;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}
.task-checkbox:checked {
    background: #6366f1;
    border-color: #6366f1;
}
.task-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 5px; height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
.task-checkbox:hover:not(:checked) {
    border-color: #6366f1;
}

/* Task body */
.task-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a2e;
    cursor: pointer;
    line-height: 1.3;
    word-break: break-word;
}
.task-title--done {
    text-decoration: line-through;
    color: #9ca3af;
    cursor: default;
}

.task-meta-edit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    cursor: default;
    margin-top: 5px;
}

.task-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1.5px solid;
}
.task-badge--cat {
    border-color: #adb5bd;
    color: #6c757d;
}
.task-badge--label {
    border-color: #818cf8;
    color: #4f46e5;
}

.task-edit-meta-icon {
    opacity: 0;
    transition: opacity 0.15s;
    cursor: pointer;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
}
.task-edit-meta-icon .material-icons { font-size: 13px; }
.task-meta-edit:hover .task-edit-meta-icon { opacity: 1; }

.task-date {
    font-size: 0.72rem;
    color: #adb5bd;
    opacity: 0;
    transition: opacity 0.15s;
}
.task-card:hover .task-date { opacity: 1; }
/* Family: Details (Von, Für, Datum) immer anzeigen */
.page-family .task-date { opacity: 1; }

.task-delete {
    color: #dc3545;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    text-decoration: none;
}
.task-delete .material-icons { font-size: 20px; }
.task-card:hover .task-delete { opacity: 0.6; }
.task-card:hover .task-delete:hover { opacity: 1; }

/* Empty state */
.todo-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #adb5bd;
}
.todo-empty .material-icons { font-size: 48px; display: block; margin-bottom: 0.5rem; }
.todo-empty p { font-size: 0.9rem; margin: 0; }

/* Color swatches (add & edit form) */
.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch--none { background: #dee2e6; border-color: #adb5bd; }
.color-swatch--lg { width: 28px; height: 28px; font-size: 11px; }
.color-swatch.selected { border-color: #495057 !important; }

/* ========== Projekt-spezifische Styles ========== */

    .editable-text {
        display: inline-block;
        min-width: 60px;
        padding: 4px 12px;
        margin: -4px -8px;
        cursor: text;
        border-radius: 4px;
        transition: background-color 0.2s;
    }
    .editable-text:hover {
        background-color: rgba(0, 0, 0, 0.08);
    }
    /* Speziell für große Titel */
    h2 .editable-text,
    h3 .editable-text {
        min-width: 200px;
    }

    /* Löschen-Button */
    .delete-btn {
        color: #dc3545;
        cursor: pointer;
        opacity: 0.2;
        transition: opacity 0.2s;
        font-size: 18px;
    }
    .delete-btn:hover {
        opacity: 1;
    }
    .card-header:hover .delete-btn {
        opacity: 0.5;
    }

    /* Karten-Kopfzeile */
    .card-header {
        cursor: pointer;
    }

    /* Abgehaktes Item in Packliste */
    .item-completed {
        text-decoration: line-through;
        color: #6c757d;
    }

    /* Häkchen wenn alle Items in einer Section erledigt */
    .section-done-icon {
        color: #198754;
        margin-left: 8px;
        font-size: 20px;
        vertical-align: middle;
    }

    /* Checkbox-Ausrichtung in Flex-Zeilen korrigieren */
    .items-sortable .item-cb {
        margin-top: 0;
    }

    /* Notiz-/Kommentarfeld an Packlisten-Items */
    input.item-note {
        width: 165px;
        font-size: 0.8em;
        padding: 2px 4px;
    }

    @media (max-width: 575.98px) {
        /* Vor Checkbox minimaler Abstand, nach Checkbox mehr Abstand zum Namen */
        .items-sortable .item-cb {
            margin-left: 0.1rem !important;
            margin-right: 0.6rem !important;
        }
        /* Editable-Text weniger Innenabstand */
        .items-sortable .editable-text {
            padding-left: 4px;
            padding-right: 4px;
        }
        /* Note-Feld auf Mobile kleiner, kein Textumbruch */
        input.item-note {
            width: 80px;
        }
    }

    /* Vorlage-Karten mit weichem Schatten und Hover */
    .template-card {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        transition: transform 0.2s, box-shadow 0.2s;
    }
    .template-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    }
