/* Layout on top of Pico CSS (imported first in app.js). Colours: one per entity type, one per project status. */

:root {
    --c-project: #2563eb;
    --c-chat: #15803d;
    --c-person: #7c3aed;

    --s-idea: #64748b;
    --s-planned: #0f766e;
    --s-follow_up: #b45309;
    --s-scheduled: #1d4ed8;
    --s-awaiting_delivery: #c2410c;
    --s-delivery_requested: #be123c;
    --s-closed: #15803d;
    --s-rejected: #6b7280;

    --c-warn: #c2410c;
    --pico-font-size: 95%;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --c-project: #60a5fa;
        --c-chat: #4ade80;
        --c-person: #a78bfa;

        --s-idea: #94a3b8;
        --s-planned: #2dd4bf;
        --s-follow_up: #fbbf24;
        --s-scheduled: #60a5fa;
        --s-awaiting_delivery: #fb923c;
        --s-delivery_requested: #fb7185;
        --s-closed: #4ade80;
        --s-rejected: #9ca3af;

        --c-warn: #fb923c;
    }
}

svg {
    vertical-align: -0.125em;
}

/* Header */
.app-header nav {
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.app-header nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.app-header nav a[aria-current="page"] {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

.app-header form.logout {
    margin: 0;
}

.app-header form.logout button {
    padding: 0.35rem 0.6rem;
    margin: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Entity colours: links, headings, nav */
.entity-project { --entity: var(--c-project); }
.entity-chat { --entity: var(--c-chat); }
.entity-person { --entity: var(--c-person); }

a.entity-project,
a.entity-chat,
a.entity-person,
.page-title.entity-project svg,
.page-title.entity-chat svg,
.page-title.entity-person svg {
    color: var(--entity);
}

a.entity-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    margin-right: 0.6rem;
}

a.entity-link:hover span {
    text-decoration: underline;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    border: 1px solid currentColor;
}

.status-idea { color: var(--s-idea); }
.status-planned { color: var(--s-planned); }
.status-follow_up { color: var(--s-follow_up); }
.status-scheduled { color: var(--s-scheduled); }
.status-awaiting_delivery { color: var(--s-awaiting_delivery); }
.status-delivery_requested { color: var(--s-delivery_requested); }
.status-closed { color: var(--s-closed); }
.status-rejected { color: var(--s-rejected); text-decoration: line-through; }

.badge.manual { color: var(--pico-muted-color); }

.badge.overdue {
    color: #fff;
    background: var(--c-warn);
    border-color: var(--c-warn);
}

.badge.next-me {
    color: #fff;
    background: var(--c-warn);
    border-color: var(--c-warn);
}

.badge.next-contact { color: var(--pico-muted-color); }
.badge.next-none,
.next-none { color: var(--pico-muted-color); }

/* Tables */
table {
    font-size: 0.92em;
}

td .summary,
td .location,
.project .location {
    color: var(--pico-muted-color);
    font-size: 0.92em;
}

/* Project cards (person page) */
article.project h3 {
    margin-bottom: 0.4rem;
}

/* Chat tabs */
nav.tabs {
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tab {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    text-decoration: none;
}

.tab.active {
    font-weight: 700;
    border-color: var(--pico-primary);
}

/* Messages (chat page) */
article.message.mine {
    border-left: 4px solid var(--c-chat);
}

article.message header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9em;
}

article.message img,
article.message video {
    max-width: min(100%, 24rem);
    height: auto;
}

/* Flash and errors */
.flash-success,
.login-error {
    margin: 1rem 0;
    padding: 0.6rem 0.8rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid currentColor;
}

.flash-success { color: var(--s-closed); }
.login-error { color: var(--s-delivery_requested); }

/* Sorting and pagination (KnpPaginator) */
th.sorted {
    font-weight: 700;
}

.pagination {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0;
    list-style: none;
}

/* Tom Select (searchable selects, symfony/ux-autocomplete) inside Pico forms */
.ts-wrapper {
    margin-bottom: var(--pico-spacing);
}

.ts-wrapper .ts-control {
    padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal);
    border: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-form-element-background-color);
    color: var(--pico-color);
}

.ts-wrapper .ts-control input {
    margin: 0;
    padding: 0;
    border: 0;
    height: auto;
    box-shadow: none;
    background: transparent;
    color: inherit;
}

.ts-dropdown {
    background: var(--pico-background-color);
    color: var(--pico-color);
    border-color: var(--pico-form-element-border-color);
}

.ts-dropdown .active {
    background: var(--pico-primary-focus);
    color: var(--pico-color);
}
