/* Einstellungen: Profilbild und persoenliche Uebungsliste. Farben, Abstaende und Radien stammen aus den Variablen in base.css. */

/* ----------------------------------------------------------------
   Einstellungen / Profilbild
---------------------------------------------------------------- */

.settings.profilbild.hochladen {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.settings.profilbild.hochladen form {
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.settings.profilbild.hochladen .field {
    flex: 1 1 100%;
    min-width: 0;
    margin-bottom: 0;
}

/* ----------------------------------------------------------------
   Persoenliche Uebungsliste (Einstellungen, Vorschlaege, Rueckfrage)
---------------------------------------------------------------- */

.exercise-panel {
    position: relative;
    scroll-margin-top: 90px;
}

.exercise-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 28px;
    margin-bottom: 18px;
}

.exercise-head h2 {
    margin-top: 0;
}

.exercise-head p {
    margin: 0;
    max-width: 52ch;
}

/* Fuellstand: x / 200 */
.exercise-meter {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 116px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}

.exercise-meter-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.exercise-meter-count strong {
    color: var(--accent-strong);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.exercise-meter-bar {
    display: block;
    height: 4px;
    background: var(--border);
}

.exercise-meter-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
    transition: width var(--ease);
}

.exercise-meter.is-full {
    border-color: var(--error-line);
}

.exercise-meter.is-full strong {
    color: var(--error);
}

.exercise-meter.is-full .exercise-meter-bar > span {
    background: var(--error);
}

/* Neue Uebung */
.exercise-add {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.exercise-add input[type="text"] {
    flex: 1 1 auto;
    max-width: none;
}

.exercise-add button svg,
.exercise-adopt-icon svg,
.icon-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: square;
}

.exercise-filter {
    margin-bottom: 10px;
}

.exercise-filter input[type="search"] {
    width: 100%;
    height: 36px;
    padding: 6px 12px 6px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687069' stroke-width='2' stroke-linecap='square'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='M20 20l-4.5-4.5'/%3E%3C/svg%3E") no-repeat 10px center / 16px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.exercise-filter input[type="search"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: var(--focus);
}

/* Liste */
.exercise-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.exercise-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 6px 6px 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    transition: border-color var(--ease), background-color var(--ease);
}

.exercise-item[hidden] {
    display: none;
}

.exercise-item::before {
    content: "";
    position: absolute;
    left: -1px;
    top: -1px;
    bottom: -1px;
    width: 3px;
    background: var(--border-strong);
    transition: background-color var(--ease);
}

.exercise-item:hover {
    border-color: var(--accent-line);
    background: var(--panel);
}

.exercise-item:hover::before {
    background: var(--accent);
}

.exercise-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.exercise-name {
    overflow: hidden;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exercise-usage {
    color: var(--faint);
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.exercise-usage.is-used {
    color: var(--accent);
}

.exercise-remove {
    flex: 0 0 auto;
    margin: 0;
}

.icon-button {
    width: 32px;
    min-height: 32px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: var(--faint);
}

.icon-button:hover {
    border-color: var(--error-line);
    background: var(--error-bg);
    color: var(--error);
}

.exercise-empty {
    margin: 4px 0 0;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.exercise-empty[hidden] {
    display: none;
}

/* Uebungen, die nur in Eintraegen vorkommen */
.exercise-from-entries {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.exercise-from-entries h3 {
    margin-bottom: 4px;
}

.exercise-from-entries > p {
    margin: 0 0 12px;
}

.exercise-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.exercise-chips form {
    margin: 0;
}

.exercise-chip {
    min-height: 32px;
    padding: 4px 12px;
    border: 1px dashed var(--accent-line);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.exercise-chip > span:first-child {
    color: var(--accent);
    font-weight: 700;
}

.exercise-chip:hover {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* Rueckfrage vor dem Entfernen (ohne JavaScript) */
.exercise-confirm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--error-line);
    border-left: 4px solid var(--error);
    border-radius: var(--radius-sm);
    background: var(--error-bg);
}

.exercise-confirm p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13.5px;
}

.exercise-confirm form {
    margin: 0;
}

/* Rueckfrage vor dem Entfernen (mit JavaScript) */
.exercise-dialog {
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border-strong);
    border-top: 3px solid var(--error);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.exercise-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.exercise-dialog form {
    padding: 22px 24px;
}

.exercise-dialog h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.exercise-dialog p {
    margin: 0 0 8px;
}

.exercise-dialog .actions {
    justify-content: flex-end;
    margin-top: 18px;
}

/* Vorschlaege beim Eintippen */
.suggest-menu {
    position: fixed;
    z-index: 1000;
    max-width: calc(100vw - 32px);
    max-height: 320px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
}

.suggest-menu[hidden] {
    display: none;
}

.suggest-item {
    position: relative;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
}

.suggest-item:hover,
.suggest-item.is-active {
    background: var(--accent-soft);
}

.suggest-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent);
}

.suggest-item mark {
    background: transparent;
    color: var(--accent-strong);
    font-weight: 700;
}

/* Hinweis im Eintragsformular: Name steht nicht in der Liste */
.exercise-cell input.is-unlisted {
    border-color: var(--warm-line);
}

.exercise-unlisted-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--warm);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.exercise-unlisted-hint::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--warm);
}

.exercise-unlisted-hint[hidden],
.exercise-cell input:placeholder-shown ~ .exercise-unlisted-hint {
    display: none;
}

/* Rueckfrage nach dem Speichern eines Eintrags */
.exercise-adopt {
    border-color: var(--accent-line);
    border-left: 4px solid var(--accent);
}

.exercise-adopt-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.exercise-adopt-head h2 {
    margin: 0 0 4px;
}

.exercise-adopt-head p {
    margin: 0;
}

.exercise-adopt-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
}

.exercise-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.exercise-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}

.exercise-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}

@media (max-width: 600px) {
    .exercise-head {
        flex-direction: column;
    }

    .exercise-meter {
        align-self: stretch;
    }

    .exercise-add {
        flex-direction: column;
    }

    .exercise-list {
        grid-template-columns: 1fr;
    }
}

/* Erfasste Tageswerte: Unterpunkte (Dauer, Puls, ...) eingerueckt unter ihrem Wert */
.tracking-children {
    margin: -4px 0 8px 9px;
    padding-left: 18px;
    border-left: 2px solid var(--border);
    transition: opacity var(--ease);
}

.tracking-children .field {
    margin-bottom: 6px;
}

/* Solange der Wert selbst aus ist, wirken die Unterpunkte nicht - ihre Auswahl bleibt erhalten. */
.tracking-children.is-inactive {
    opacity: 0.45;
}

/* Profilbild: "Hochladen" und "Entfernen" nebeneinander */
.profile-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Das leere Formular zum Entfernen wird nur ueber das form-Attribut des Knopfs genutzt. */
#profile-image-delete {
    display: none;
}
