/* ============================================================================
   NexusFlow — components.css
   Re-skin komponentów aplikacji na jasny motyw „Clarity & Momentum" (MD3).
   Używa wyłącznie zmiennych z tokens.css. Nie definiuje :root, nie importuje.
   ========================================================================== */

/* ============================================================================
   1. BAZOWE KONTROLKI FORMULARZY
   ========================================================================== */

input,
select,
button {
    font: inherit;
}

input,
select {
    height: 40px;
    padding: 0 var(--sp-sm);
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-md);
    background: var(--surface-container-lowest);
    color: var(--on-surface);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
    width: 100%;
    padding: 8px var(--sp-sm);
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-md);
    background: var(--surface-container-lowest);
    color: var(--on-surface);
    font: inherit;
    resize: vertical;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

input[type="checkbox"] {
    height: auto;
    accent-color: var(--primary);
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

/* ============================================================================
   2. PRZYCISKI
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 var(--sp-md);
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-md);
    background: var(--surface-container-low);
    color: var(--on-surface);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 150ms ease, box-shadow 150ms ease, transform 100ms ease, border-color 150ms ease;
}

.btn:hover {
    background: var(--surface-container);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn--primary {
    background: var(--primary);
    border-color: transparent;
    color: var(--on-primary);
}

.btn--primary:hover {
    background: var(--on-primary-fixed-variant);
}

.btn--secondary {
    background: var(--surface-container-low);
    border-color: var(--outline-variant);
    color: var(--on-surface);
}

.btn--secondary:hover {
    background: var(--surface-container);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--on-surface-variant);
}

.btn--ghost:hover {
    background: var(--surface-container);
    color: var(--on-surface);
}

.btn--block {
    width: 100%;
}

/* ============================================================================
   3. POLA Z ETYKIETĄ + LAYOUT FORMULARZY
   ========================================================================== */

.field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.field > span {
    font-size: 11px;
    font-weight: 600;
    color: var(--on-surface-variant);
    letter-spacing: 0.02em;
}

.field.grow {
    flex: 1;
    min-width: 180px;
}

.field input,
.field select {
    width: 100%;
}

.row-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.grow {
    flex: 1;
    min-width: 180px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.checkline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--on-surface-variant);
    font-size: 14px;
}

/* ============================================================================
   4. FORMULARZ DODAWANIA POZYCJI + NARZĘDZIA LISTY
   ========================================================================== */

.create {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create__more {
    font-size: 13px;
}

.create__more summary {
    cursor: pointer;
    color: var(--on-surface-variant);
    margin-bottom: 8px;
    list-style: none;
    user-select: none;
}

.create__more summary::-webkit-details-marker {
    display: none;
}

.create__more textarea {
    margin-bottom: 8px;
}

.list-tools {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-input {
    min-width: 220px;
}

/* ============================================================================
   5. KARTY
   ========================================================================== */

.card {
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-lg);
    padding: var(--sp-lg);
    box-shadow: var(--shadow-card);
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-hover);
    }
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-sm);
    margin-bottom: var(--sp-md);
}

.card__head h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--on-surface);
    letter-spacing: -0.01em;
    margin: 0;
}

.card__head a {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

/* ============================================================================
   6. CHIPY / FILTRY / TAGI
   ========================================================================== */

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

.chips--sub {
    margin-top: 8px;
    align-items: center;
}

.chips__label {
    color: var(--on-surface-variant);
    font-size: 13px;
    font-weight: 600;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-pill);
    background: var(--surface-container);
    color: var(--on-surface-variant);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    /* NB: color NIE jest !important — inline style="color:..." ze statusów działa normalnie */
}

.chip:hover {
    background: var(--surface-container-high);
    color: var(--on-surface);
    text-decoration: none;
}

.chip.is-active {
    background: var(--primary);
    border-color: transparent;
    color: var(--on-primary);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--surface-container);
    color: var(--on-surface-variant);
    font-size: 12px;
    font-weight: 500;
    /* color NIE jest !important — pozwala na inline kolory statusów */
}

/* ============================================================================
   7. PRIORYTETY + STALE + SWATCH
   ========================================================================== */

.prio {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.prio--low      { background: var(--c-low); }
.prio--medium   { background: var(--c-medium); }
.prio--high     { background: var(--c-high); }
.prio--critical { background: var(--c-critical); }

.stale--warning {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--warning-container);
    color: var(--warning);
    font-size: 12px;
    font-weight: 600;
}

.stale--alert {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--error-container);
    color: var(--error);
    font-size: 12px;
    font-weight: 600;
}

.swatch {
    width: 18px;
    height: 18px;
    border-radius: var(--r-xs);
    border: 1px solid var(--outline-variant);
    flex: none;
    display: inline-block;
}

/* ============================================================================
   8. PASEK POSTĘPU
   ========================================================================== */

.progress {
    height: 8px;
    background: var(--surface-container-high);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: var(--secondary);
    border-radius: var(--r-pill);
    transition: width 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* ============================================================================
   9. PRZYCISKI SZYBKIEJ ZMIANY STATUSU (segmenty)
   ========================================================================== */

.status-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin: 0;
}

.sbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--r-pill);
    background: transparent;
    font: 600 12px/1 var(--font);
    color: var(--on-surface-variant);
    cursor: pointer;
    white-space: nowrap;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
    /* color NIE jest !important — inline kolory statusów działają */
}

.sbtn:hover {
    border-color: var(--outline);
    background: var(--surface-container);
    color: var(--on-surface);
}

.sbtn.is-active {
    box-shadow: inset 0 0 0 2px currentColor;
    background: color-mix(in srgb, currentColor 12%, transparent);
}

.sbtn--clear {
    width: 28px;
    padding: 0;
    color: var(--on-surface-variant);
    font-size: 14px;
}

/* ============================================================================
   10. DROBNE KOMPONENTY
   ========================================================================== */

.meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 12px;
    color: var(--on-surface-variant);
    align-items: center;
}

.empty {
    padding: var(--sp-lg);
    text-align: center;
    color: var(--on-surface-variant);
    font-size: 14px;
}

/* ---- Share box ---- */

.share-box {
    margin-top: 8px;
    font-size: 13px;
}

.share-box summary {
    cursor: pointer;
    color: var(--on-surface-variant);
    list-style: none;
    user-select: none;
    font-weight: 600;
}

.share-box summary::-webkit-details-marker {
    display: none;
}

.share-box .row-form {
    margin-top: 8px;
}

.share-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--on-surface-variant);
    font-size: 13px;
}

/* ============================================================================
   RESPONSYWNOŚĆ (mobile-first uzupełnienia)
   ========================================================================== */

@media (max-width: 600px) {
    .card {
        padding: var(--sp-md);
    }

    .row-form {
        flex-direction: column;
        align-items: stretch;
    }

    .row-form .grow,
    .row-form .field {
        width: 100%;
    }

    .list-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-input {
        min-width: 0;
        width: 100%;
    }
}

/* ============================================================================
   DOSTĘPNOŚĆ — reduced-motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .card,
    .btn,
    .chip,
    .sbtn,
    .tag,
    .progress__bar {
        transition: none;
    }

    .card:hover {
        transform: none;
    }
}

/* ---- Karty kategorii pulpitu: lewy akcent (niebieski/zielony/różowy/teal) ---- */
.card--tasks { border-left: 4px solid var(--primary); }
.card--projects { border-left: 4px solid var(--secondary); }
.card--payments { border-left: 4px solid var(--tertiary); }
.card--events { border-left: 4px solid #14b8a6; }
.card--tasks .card__head h2 { color: var(--primary); }
.card--projects .card__head h2 { color: var(--secondary); }
.card--payments .card__head h2 { color: var(--tertiary); }
.card--events .card__head h2 { color: #0f766e; }
