/* ============================================================
   Reusable components: pipeline, chips, icon-buttons, popovers
   ============================================================ */

/* -------- Icon button (square, ghost-style) -------- */
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: rgba(34, 46, 57, 0.5);
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}

.icon-btn:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-strong);
    transform: none;
    box-shadow: none;
}

.icon-btn.is-primary {
    background: var(--gold-soft);
    color: var(--gold);
    border-color: var(--gold-line);
}

.icon-btn.is-primary:hover {
    background: var(--gold);
    color: #1a1410;
    border-color: var(--gold);
}

.icon-btn.is-sky {
    color: var(--sky);
    border-color: var(--sky-line);
    background: var(--sky-soft);
}

.icon-btn.is-sky:hover {
    background: var(--sky);
    color: #0a1820;
}

/* -------- Pill chip (status/tag display) -------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.chip.gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.chip.sky { background: var(--sky-soft); border-color: var(--sky-line); color: var(--sky); }
.chip.mint { background: var(--mint-soft); border-color: var(--mint-line); color: var(--mint); }
.chip.rose { background: var(--rose-soft); border-color: rgba(251,113,133,0.35); color: var(--rose); }

/* -------- Workflow pipeline -------- */
.pipeline-form {
    margin: 0;
    padding: 0;
    display: inline-block;
}

.pipeline {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 4px;
    border-radius: var(--r-pill);
    background: rgba(15, 21, 27, 0.6);
    border: 1px solid var(--hairline);
}

.pipeline-step {
    --dot-color: var(--faint);
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--dot-color);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.pipeline-step:hover {
    transform: scale(1.15);
    background: transparent;
    box-shadow: none;
    filter: none;
}

.pipeline-step::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    transition: all 0.25s var(--ease-out);
}

.pipeline-step[data-state="done"] {
    --dot-color: var(--mint);
}

.pipeline-step[data-state="current"] {
    --dot-color: var(--gold);
}

.pipeline-step[data-state="current"]::before {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 0 4px rgba(255, 179, 71, 0.22), 0 0 12px rgba(255, 179, 71, 0.5);
    animation: pulse-soft 2.2s ease-in-out infinite;
}

.pipeline-step[data-state="pending"] {
    --dot-color: var(--faint);
}

.pipeline-step[data-state="pending"]::before {
    width: 7px;
    height: 7px;
    background: transparent;
    border: 1.5px solid currentColor;
}

/* Connector line between steps */
.pipeline-step + .pipeline-step::after {
    content: "";
    position: absolute;
    left: -7px;
    top: 50%;
    width: 14px;
    height: 1.5px;
    background: var(--border);
    transform: translateY(-50%);
    z-index: -1;
}

.pipeline-step[data-state="done"] + .pipeline-step::after,
.pipeline-step + .pipeline-step[data-state="done"]::after {
    background: var(--mint-line);
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* -------- Item-count badges -------- */
.items-line {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.item-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-soft);
    border: 1px solid var(--hairline);
    line-height: 1.3;
}

.item-pill .item-label {
    color: var(--muted);
    font-size: 0.72rem;
}

.item-pill[data-zero="true"] {
    opacity: 0.3;
}

/* -------- Price block -------- */
.price-block {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.price-block .price-main {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.price-block .price-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
}

.price-block .price-sub.positive { color: var(--mint); }
.price-block .price-sub.negative { color: var(--rose); }

/* -------- Icon strip (Sonstiges/Notes) -------- */
.meta-icons {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.meta-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    border: 1px solid var(--hairline);
    background: var(--surface-2);
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}

.meta-icon:hover {
    color: var(--gold);
    border-color: var(--gold-line);
    background: var(--gold-soft);
}

.meta-icon svg {
    width: 13px;
    height: 13px;
    stroke-width: 1.9;
}

/* -------- Popover (note popup) -------- */
.popover-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 16, 0.65);
    backdrop-filter: blur(6px);
    z-index: 999;
    animation: fade-in 0.18s var(--ease-out);
}

.popover {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: min(540px, 90vw);
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.22s var(--ease-out);
}

.popover p {
    color: var(--text-soft);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 16px;
}

.popover button {
    margin: 0;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pop-in {
    from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* -------- Toast / inline alert -------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-soft);
    margin: 12px 0;
    font-size: 0.92rem;
}

.alert.success { background: var(--mint-soft); border-color: var(--mint-line); color: var(--mint); }
.alert.error { background: var(--rose-soft); border-color: rgba(251,113,133,0.35); color: var(--rose); }

/* -------- Stagger reveal -------- */
.stagger-item {
    animation: stagger-in 0.45s var(--ease-out) both;
}

@keyframes stagger-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------- Section divider with label -------- */
.section-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0 16px;
}

.section-heading::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--hairline), transparent);
}

.section-heading h2,
.section-heading h3 {
    margin: 0;
}

/* -------- Eyebrow label -------- */
.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--gold);
    margin-bottom: 8px;
}
