/* Plankarten des Dashboards (main/templates/public_dashboard.html): eigene Plaene ("Meine Trainingsplaene",
   components/dashboard_plan_card.html) und kostenlose Shop-Plaene.
   Paket C1 (21.11.2026): aus dem entfallenen training_plan_viewer.css uebernommen (Vorbild: Shop-Plankarte,
   shop_storefront.css); 22.11.2026 um die Regeln der eigenen Plankarte ergaenzt (Level-Balken, Wochenverlauf,
   Coach-Badge, Tags, Kartenrumpf, "nicht verfuegbar"). Fortschritt/Heute/Morgen stehen in public_dashboard.html. */
.tpm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
    gap: 24px;
}
.tpm-card {
    --card-radius: 20px; --card-pad: 8px;
    --tpm-ink: #15191f;
    --tpm-line: #e5e6e8;
    --tpm-line-strong: #cfd2d6;
    --tpm-muted: #5d6671;
    /* Level-Farbe der Bildflaeche (RGB): ohne Level Akzentblau */
    --lvl: 40, 81, 128; --lvl-text: 185, 203, 226;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--card-pad);
    background: #fff;
    border: 1px solid var(--tpm-line);
    border-radius: var(--card-radius);
    box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(21, 25, 31, .05), 0 4px 12px rgba(21, 25, 31, .05);
    transition: transform .2s ease-out, box-shadow .2s ease-out, border-color .2s ease-out, opacity .15s ease;
}
.tpm-card:hover {
    transform: translateY(-2px);
    border-color: var(--tpm-line-strong);
    box-shadow: inset 0 1px 0 #fff, 0 2px 4px rgba(21, 25, 31, .06), 0 14px 32px rgba(21, 25, 31, .12);
}
.tpm-card[data-level="einsteiger"] { --lvl: 38, 120, 108; --lvl-text: 150, 202, 190; }
.tpm-card[data-level="fortgeschritten"] { --lvl: 40, 81, 128; --lvl-text: 160, 184, 214; }
.tpm-card[data-level="leistung"] { --lvl: 190, 120, 62; --lvl-text: 228, 188, 150; }

/* Bildflaeche: fast Schwarz mit Level-Schimmer; mit Foto das Foto gedaempft dahinter */
.tpm-card-media {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    min-height: 168px;
    padding: 16px 16px 0;
    overflow: hidden;
    border-radius: calc(var(--card-radius) - var(--card-pad));
    background:
        radial-gradient(90% 70% at 90% 0%, rgba(var(--lvl), .14), transparent 60%),
        linear-gradient(160deg, var(--tpm-ink) 0%, #0d1014 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 2px 0 rgba(var(--lvl-text), .06);
    isolation: isolate;
}
.tpm-card-photo {
    position: absolute; inset: 0; z-index: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: .42;
    filter: saturate(.7) brightness(.85);
}
.tpm-card-media.has-photo::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(90% 70% at 90% 0%, rgba(var(--lvl), .1), transparent 60%),
        linear-gradient(180deg, rgba(13, 16, 20, .15) 0%, rgba(13, 16, 20, .05) 35%, rgba(13, 16, 20, .75) 100%);
}
.tpm-card-mediatop {
    position: relative; z-index: 1;
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px;
}
/* Sportart-Chip (links) und Level-Plakette (rechts): Glas-Pillen wie im Shop */
.tpm-sport-chip,
.tpm-level-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 9px;
    border-radius: 999px;
    font-size: .6875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; line-height: 1;
    white-space: nowrap;
    background: rgba(13, 16, 20, .55);
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
}
.tpm-sport-chip { min-width: 0; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.tpm-sport-chip-icons { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; color: rgba(255, 255, 255, .8); }
.tpm-level-pill { flex-shrink: 0; color: rgb(var(--lvl-text)); box-shadow: inset 0 0 0 1px rgba(var(--lvl-text), .14); }
.tpm-level-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.tpm-level-bars > span { width: 3px; border-radius: 1px; background: rgba(255, 255, 255, .22); }
.tpm-level-bars > span:nth-child(1) { height: 5px; }
.tpm-level-bars > span:nth-child(2) { height: 8px; }
.tpm-level-bars > span:nth-child(3) { height: 11px; }
.tpm-level-bars > span.is-on { background: rgb(var(--lvl-text)); }

/* Wochenverlauf in der Bildflaeche (wie .shop-spark): helle Balken auf Dunkel, hoechste Woche
   heller, Entlastung zurueckgenommen, Wettkampfwoche orange mit Fahne */
.tpm-spark {
    position: relative; z-index: 1;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 72px;
    margin-top: 12px;
    filter: drop-shadow(0 0 6px rgba(185, 203, 226, .25));
}
.tpm-spark::after { /* leuchtende Grundlinie */
    content: ""; position: absolute; left: -16px; right: -16px; bottom: 0; height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .35), rgba(255, 255, 255, 0));
}
.tpm-spark > span {
    position: relative;
    flex: 1 1 0;
    min-width: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, #b9cbe2 0%, #6f8fb5 100%);
}
.tpm-spark > span.is-empty { background: rgba(255, 255, 255, .14); }
.tpm-spark > span.is-peak { background: linear-gradient(180deg, #e4edf8 0%, #8eaacb 100%); }
.tpm-spark > span.is-light { background: linear-gradient(180deg, #677d99 0%, #42536a 100%); }
.tpm-spark > span.is-race {
    background: linear-gradient(180deg, #ffc27a 0%, #f26e1f 55%, #d9520f 100%);
    box-shadow: 0 0 6px rgba(255, 128, 40, .35);
}
.tpm-spark > span.is-race i {
    position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    font-size: .7rem; color: #ffb05c;
}

/* Kopf unter der Bildflaeche: Titel, Tags, Ziel, Level-Schalter */
.tpm-card-head { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 0; }
/* "Vom Coach angepasst" (Plananpassung) */
.tpm-coach-badge {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .72rem; font-weight: 800; line-height: 1.4; white-space: nowrap;
    color: #3d2a00; background: #f3c262;
}
.tpm-coach-badge .fa-solid { font-size: .68rem; }
.tpm-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.2;
    margin: 0;
    color: var(--tpm-ink);
    overflow-wrap: break-word;
    hyphens: auto;
}
.tpm-title a { color: inherit; text-decoration: none; }
.tpm-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tpm-goal { margin: 0; font-size: .9375rem; line-height: 1.5; color: var(--tpm-muted); }
.tpm-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tpm-tags span {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    color: var(--tpm-muted);
    background: var(--ds-surface-alt);
    border: 1px solid var(--tpm-line);
}

/* Rumpf der eigenen Plankarte: Fortschritt (public_dashboard.html .tpm-progress) bzw. "nicht verfuegbar" */
.tpm-card-body {
    flex: 1 1 auto;
    padding: 16px 16px 0;
}
.tpm-card.is-unavailable .tpm-card-media { min-height: 96px; background: linear-gradient(160deg, #5b6573 0%, #3d4550 100%); }
.tpm-unavailable {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--ds-danger-soft);
    color: #8a1f2b;
    font-size: 0.86rem;
    margin-bottom: 0.8rem;
}
.tpm-unavailable .fa-solid { font-size: 1.3rem; margin-top: 2px; }

/* Fuss wie im Shop: links Kaufdatum bzw. Preis, rechts der dunkle Pillen-Button */
.tpm-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 16px 16px;
    margin-top: auto;
}

.tpm-open,
.tpm-open:focus,
.tpm-open:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 24px;
    border-radius: 24px;
    white-space: nowrap;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -.005em;
    color: #fff;
    background: linear-gradient(180deg, #2b3139 0%, var(--tpm-ink) 100%);
    border: 1px solid #0d1014;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(21, 25, 31, .18), 0 4px 12px rgba(21, 25, 31, .14);
    transition: background .15s ease-out, box-shadow .15s ease-out, transform .1s ease-out;
}
.tpm-open:hover,
.tpm-card:hover .tpm-open {
    color: #fff;
    background: linear-gradient(180deg, var(--tpm-ink) 0%, #000 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 2px 4px rgba(21, 25, 31, .18), 0 8px 20px rgba(21, 25, 31, .22);
}
.tpm-open:active { color: #fff; transform: translateY(1px); }
.tpm-open:focus-visible { outline: 3px solid rgba(40, 81, 128, .45); outline-offset: 2px; }
.tpm-open .fa-solid { font-size: .85em; transition: transform 0.15s ease; }
.tpm-card:hover .tpm-open .fa-solid { transform: translateX(3px); }

@media (max-width: 575.98px) {
    .tpm-card-head, .tpm-card-body, .tpm-card-foot { padding-left: 12px; padding-right: 12px; }
    .tpm-title { font-size: 1.3rem; }
    .tpm-open { width: 100%; }
}
