/* ==========================================================================
   Projekt-Historie: Mode-Switch (Aktiv/Historie) + Timeline erledigter
   Tasks & Sprints in der Projektdetailansicht
   ========================================================================== */

/* ---------- Mode-Switch (Segmented-Pill mit gleitendem Indikator) ---------- */

.proj-mode-switch-row {
    display: flex;
    justify-content: flex-start;
    margin: 2px 0 16px;
}

.proj-action-group--mode .proj-mode-switch {
    box-shadow: none;
}

.proj-mode-switch {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.proj-mode-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.28s cubic-bezier(0.65, 0.05, 0.35, 1);
    z-index: 0;
}

.proj-mode-switch[data-mode="history"] .proj-mode-indicator {
    transform: translateX(100%);
}

.proj-mode-btn {
    position: relative;
    z-index: 1;
    /* Beide Buttons exakt gleich breit, damit der 50%-Indikator passt */
    width: 132px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 16px;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: var(--text-3);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.proj-mode-btn:hover {
    color: var(--text-1);
}

.proj-mode-btn.is-active {
    color: #fff;
}

.proj-mode-count {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.proj-mode-btn.is-active .proj-mode-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* ---------- Historie: Grundlayout ---------- */

.history-view {
    animation: history-fade 0.35s ease both;
}

@keyframes history-fade {
    from { opacity: 0; }
}

/* ---------- Hero-Panel mit Statistiken ---------- */

.history-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        radial-gradient(600px 220px at 0% 0%, var(--accent-soft), transparent 70%),
        var(--surface);
    margin-bottom: 26px;
    position: relative;
    overflow: hidden;
}

.history-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 6px;
}

.history-hero-kicker::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--history-accent, var(--accent));
}

.history-hero-title {
    margin: 0 0 4px;
    font-size: 20px;
    color: var(--text-1);
}

.history-hero-sub {
    margin: 0;
    color: var(--text-3);
    font-size: 13px;
    max-width: 480px;
}

.history-hero-stats {
    display: flex;
    gap: 12px;
}

.history-stat {
    min-width: 108px;
    padding: 12px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.history-stat-label {
    font-size: 11px;
    color: var(--text-4);
    letter-spacing: 0.02em;
}

/* ---------- Timeline ---------- */

.history-timeline {
    position: relative;
    padding: 6px 0 30px;
}

.history-timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background: linear-gradient(
        180deg,
        var(--history-accent, var(--accent)) 0%,
        var(--border) 28%,
        var(--border) 85%,
        transparent 100%
    );
    opacity: 0.7;
}

.history-day {
    position: relative;
    margin-bottom: 30px;
}

.history-day:last-child {
    margin-bottom: 0;
}

.history-day-header {
    position: sticky;
    top: 6px;
    z-index: 3;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.history-day-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-1);
    font-weight: 700;
    font-size: 12.5px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.history-day-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--history-accent, var(--accent));
}

.history-day-meta {
    font-size: 12px;
    color: var(--text-4);
}

/* ---------- Einträge ---------- */

.history-entries {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 40px;
    margin-top: 14px;
}

.history-entry {
    position: relative;
    animation: history-entry-in 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes history-entry-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.history-node {
    position: absolute;
    left: -30px;
    top: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--entry-accent, var(--accent));
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    box-sizing: content-box;
    z-index: 1;
}

.history-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 16px 12px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.history-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--entry-accent, var(--accent));
    opacity: 0.85;
}

.history-entry:hover .history-card {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.history-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.history-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-1);
}

.history-time {
    flex-shrink: 0;
    font-size: 11.5px;
    color: var(--text-4);
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 1px 6px;
    background: var(--surface-2);
}

.history-desc {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.history-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
}

.history-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--entry-accent, var(--accent));
}

.history-chip--backlog {
    color: var(--text-4);
    border-style: dashed;
}

.history-chip--epic {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
}

.history-chip--hours {
    font-variant-numeric: tabular-nums;
}

.history-chip--ai {
    color: var(--accent);
    border-color: var(--accent);
    background: transparent;
}

/* ---------- Sprint-Meilensteine ---------- */

.history-node--sprint {
    left: -37px;
    top: 14px;
    width: 26px;
    height: 26px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--entry-accent, var(--accent)), var(--success));
    box-shadow: 0 0 0 4px var(--surface), 0 4px 12px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.history-card--sprint {
    border: 1px solid transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(135deg, var(--entry-accent, var(--accent)), var(--success)) border-box;
}

.history-card--sprint::before {
    display: none;
}

.history-sprint-label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--success);
}

.history-sprint-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    margin-top: 3px;
}

/* ---------- Empty State ---------- */

.history-empty {
    text-align: center;
    padding: 64px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    background: var(--surface-2);
}

.history-empty-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 24px;
    font-weight: 700;
}

.history-empty h3 {
    margin: 0 0 6px;
    color: var(--text-1);
    font-size: 16px;
}

.history-empty p {
    margin: 0 auto;
    color: var(--text-3);
    font-size: 13px;
    max-width: 380px;
}

/* ---------- Responsive + Reduced Motion ---------- */

@media (max-width: 680px) {
    .history-hero {
        padding: 18px;
    }

    .history-hero-stats {
        width: 100%;
    }

    .history-stat {
        flex: 1 1 0;
        min-width: 0;
        padding: 10px 12px;
    }

    .proj-mode-switch {
        width: 100%;
    }

    .proj-mode-btn {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .history-view,
    .history-entry {
        animation: none;
    }

    .proj-mode-indicator {
        transition: none;
    }

    .history-entry:hover .history-card {
        transform: none;
    }
}
