/* Shared dialog chrome for the plugin modal components (manage events / manage dependencies) and the
   host edit surface. Non-isolated by design: the dialog markup lives in several components across
   several assemblies, so these rules must not carry a per-component scope. Linked once from the host
   (App.razor) as _content/Itinera.Shared.UI/dialogs.css. */

/* ── Modals ─────────────────────────────────────────────────────── */

.pc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 36, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pc-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    padding: 1.1rem 1.25rem;
    width: 320px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.pc-modal-wide {
    width: 540px;
}

.pc-modal h3 {
    margin: 0;
    font-size: 15px;
}

.pc-modal h4 {
    margin: .4rem 0 0;
    font-size: 13px;
    color: #647084;
}

.pc-modal label {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    font-size: 12px;
    color: #647084;
}

/* A checkbox reads inline with its label ("☐ Erledigt") rather than stacking like the field labels. */
.pc-modal label.pc-check {
    flex-direction: row;
    align-items: center;
    gap: .4rem;
}

.pc-modal input,
.pc-modal select {
    font: inherit;
    padding: .3rem .4rem;
    border: 1px solid #cdd5df;
    border-radius: 4px;
    color: #1f2933;
}

.pc-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: .4rem;
}

.pc-modal-actions button {
    font: inherit;
    padding: .35rem .8rem;
    border: 1px solid #cdd5df;
    background: #f7f9fb;
    border-radius: 4px;
    cursor: pointer;
}

.pc-modal-actions button:hover {
    background: #eef2f7;
}

.pc-modal-actions button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.pc-danger {
    border-color: #f5b5ae !important;
    background: #fdecea !important;
    color: #8a1c12 !important;
}

.pc-empty {
    color: #647084;
    font-style: italic;
}

/* ── Event cards (issue #51) ───────────────────────────────────────
   Manage-events rows mirror the dependency cards: a name + always-visible text delete on top,
   the kind and date fields below. Card layout (not a table) keeps the delete button from
   overflowing the row and matches the Manage Dependencies visual language. */
.pc-event-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pc-event {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    border: 1px solid #eceff3;
    border-radius: 6px;
    padding: .5rem .6rem;
}

.pc-event-head {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.pc-event-name {
    flex: 1 1 auto;
    min-width: 0;
}

.pc-event-fields {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .5rem;
}

.pc-event-fields label {
    flex-direction: column;
}

/* Kind is a fixed attribute of the row, not an editable field, so it reads as a small muted badge
   beside the name in the header rather than floating among the date inputs. */
.pc-event-kind {
    flex: 0 0 auto;
    font-size: 11px;
    color: #647084;
    background: #f0f3f7;
    border-radius: 4px;
    padding: .15rem .45rem;
    white-space: nowrap;
}

/* ── Suggestion typeahead (issue #118) ─────────────────────────────
   The create dialogs wrap their name input in .pc-suggest; the filtered suggestion list drops
   below the field. Selection happens on mousedown so it wins against the input's blur. */
.pc-suggest {
    position: relative;
    display: flex;
    flex-direction: column;
}

.pc-suggest input {
    width: 100%;
}

.pc-suggest-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1010;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #cdd5df;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    max-height: 180px;
    overflow-y: auto;
}

.pc-suggest-item {
    font-size: 12px;
    padding: .35rem .5rem;
    cursor: pointer;
    color: #1f2933;
}

.pc-suggest-item:hover {
    background: #eef2f7;
}

/* Provenance badge for suggestion-generated events (issue #118): same shape as the kind badge,
   tinted so "generated" reads apart from the fixed kind. */
.pc-event-auto {
    color: #2b6cb0;
    background: #e7f0fa;
}

/* "Add" trigger — opens the creation popup so the manage window stays edit-only. */
.pc-add-dep {
    font: inherit;
    font-size: 12px;
    padding: .4rem;
    border: 1px dashed #cdd5df;
    border-radius: 6px;
    background: #fff;
    color: #46536b;
    cursor: pointer;
    width: 100%;
}

.pc-add-dep:hover {
    background: #f7f9fb;
    border-color: #a9b4c4;
}

/* ── Dependency cards (issue #40) ──────────────────────────────────
   Each existing dependency is a small card mirroring the timeline TaskEditor chip:
   a From → To header with an always-visible delete, a 3-way kind selector, an auto
   toggle, and a conflict adjust. */
.pc-dep-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pc-dep {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    border: 1px solid #eceff3;
    border-radius: 6px;
    padding: .5rem .6rem;
}

.pc-dep-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.pc-dep-name {
    font-size: 12px;
    color: #1f2933;
}

.pc-dep-arrow {
    color: #647084;
}

.pc-dep-lag {
    color: #647084;
}

.pc-dep-delete {
    font: inherit;
    font-size: 12px;
    padding: .2rem .55rem;
    border: 1px solid #f5b5ae;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 auto;
}

/* 3-way kind selector: all three kinds are always visible; the active one is filled. */
.pc-seg {
    display: inline-flex;
    border: 1px solid #cdd5df;
    border-radius: 5px;
    overflow: hidden;
    align-self: flex-start;
}

.pc-seg-btn {
    font: inherit;
    font-size: 12px;
    padding: .25rem .6rem;
    border: 0;
    border-right: 1px solid #cdd5df;
    background: #fff;
    color: #46536b;
    cursor: pointer;
}

.pc-seg-btn:last-child {
    border-right: 0;
}

.pc-seg-on {
    color: #fff;
}

.pc-seg-on-info {
    background: #8892a6;
}

.pc-seg-on-follow {
    background: #2b6cb0;
}

.pc-seg-on-critical {
    background: #8a1c12;
}

/* Auto-shift toggle switch. */
.pc-dep-auto {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: 12px;
    color: #46536b;
}

.pc-toggle {
    position: relative;
    width: 34px;
    height: 18px;
    border: 0;
    border-radius: 9px;
    background: #cdd5df;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.pc-toggle-on {
    background: #2b6cb0;
}

.pc-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: left .12s ease-in-out;
}

.pc-toggle-on .pc-knob {
    left: 18px;
}

.pc-dep-adjust {
    font: inherit;
    font-size: 12px;
    padding: .25rem .6rem;
    border: 1px solid #f0c36d;
    background: #fff7e6;
    color: #8a5a00;
    border-radius: 4px;
    cursor: pointer;
    align-self: flex-start;
}
