/* VentrIS base styles. No external fonts or CDNs: system fonts only. */

:root {
    --background: #ffffff;
    --text: #09090b;
    --text-muted: #71717a;
    --border: #e4e4e7;
    --focus: #a1a1aa;
    --primary: #000000;
    --primary-text: #ffffff;
    --logo-background: #f7ece3;
    --error: #dc2626;
    --error-background: #fef2f2;
    --info: #1e40af;
    --info-background: #eff6ff;
    --radius: 8px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

a {
    color: inherit;
}

/* ---- Login and registration ---- */

.auth {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 96px 16px 48px;
}

.auth-content {
    width: 100%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-brand {
    margin: 0 0 20px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.auth-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 40px;
}

.auth-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
}

.auth-description {
    margin: 0 0 20px;
    font-size: 14px;
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-link {
    margin: 20px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-link a {
    color: var(--text);
    font-weight: 500;
    text-underline-offset: 3px;
}

/* ---- Inputs and buttons ---- */

.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text);
    font: inherit;
    font-size: 15px;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.input[readonly] {
    background: #fafafa;
    color: var(--text-muted);
}

.input.invalid {
    border-color: var(--error);
}

.button {
    width: 100%;
    height: 40px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--primary-text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.button:hover {
    background: #27272a;
}

.button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.button-secondary {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.button-secondary:hover {
    background: #f4f4f5;
}

/* ---- Messages ---- */

.field-error, .validation-message {
    margin: -4px 0 0;
    color: var(--error);
    font-size: 13px;
    text-align: left;
}

.message {
    width: 100%;
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    text-align: left;
}

.message-error {
    background: var(--error-background);
    color: var(--error);
}

.message-info {
    background: var(--info-background);
    color: var(--info);
}

/* ---- Main app layout ---- */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 63px;
    padding-right: 72px;
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 100%;
    background: var(--logo-background);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user form {
    margin: 0;
}

.button-dark {
    height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--primary-text);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}

.button-dark:hover {
    background: #27272a;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3f3f46;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.content {
    padding: 32px 100px;
}

.tabs {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    margin-bottom: 40px;
    border-radius: var(--radius);
    background: #f4f4f5;
}

.tab {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 15px;
    text-decoration: none;
}

.tab-active {
    background: var(--background);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.page-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
}

.placeholder {
    color: var(--text-muted);
}

@media (max-width: 800px) {
    .header {
        padding-right: 16px;
    }

    .content {
        padding: 24px 16px;
    }
}

.blazor-error-boundary {
    padding: 1rem;
    background: #b32121;
    color: white;
}

.blazor-error-boundary::after {
    content: "Došlo je do greške.";
}

/* ---- Patient list ---- */

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

.patients-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 48px 40px;
}

.patients-search-form {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.search {
    position: relative;
    display: block;
}

.search-icon, .filter-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 10px;
    color: var(--text-muted);
}

.search-input {
    width: 404px;
    max-width: 100%;
    height: 40px;
    padding: 0 12px 0 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 15px;
}

.search-input:focus-visible, .select:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.filter {
    position: relative;
}

.filter-button {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 15px;
    list-style: none;
    cursor: pointer;
}

.filter-button::-webkit-details-marker {
    display: none;
}

.filter[open] .filter-button {
    color: var(--text);
}

.filter-panel {
    position: absolute;
    z-index: 10;
    top: 48px;
    left: 0;
    display: grid;
    gap: 12px;
    width: 260px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.filter-panel label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.select {
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    font: inherit;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-actions .button-dark, .filter-actions .button-secondary {
    height: 36px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.button-red {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius);
    background: #ef2020;
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}

.button-red:hover {
    background: #d91a1a;
}

.patients {
    border-collapse: collapse;
    font-size: 15px;
}

.patients th {
    padding: 0 12px 24px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.patients td {
    height: 56px;
    padding: 0 12px;
    text-align: center;
    white-space: nowrap;
}

.patients .muted {
    color: var(--text-muted);
}

.patients .patient-name {
    text-align: right;
}

.col-state {
    width: 12px;
    padding: 0 !important;
}

.state-lines {
    display: inline-flex;
    gap: 2px;
    vertical-align: middle;
}

.state-line {
    display: block;
    width: 2px;
    height: 30px;
}

.state-remisija {
    background: #22c55e;
}

.state-aktivna {
    background: #f87171;
}

.state-komisija {
    background: #4f2bf0;
}

.regimen {
    font-weight: 500;
}

.imm svg {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

.imm path {
    fill: #ffffff;
}

.imm-aktivan circle {
    fill: #18181b;
}

.imm-iskljucen circle {
    fill: #ef1c1c;
}

.imm-nikad circle {
    fill: #2dd4bf;
}

.tooltip {
    position: relative;
    cursor: default;
}

.tooltip:hover::after, .tooltip:focus::after {
    content: attr(data-full);
    position: absolute;
    z-index: 5;
    top: 100%;
    left: 0;
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--background);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-size: 15px;
    text-align: left;
    white-space: normal;
}

.pager {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 24px 0 0 40px;
}

.pager-info {
    margin-right: 12px;
    color: var(--text-muted);
}

.pager-link, .pager-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius);
    text-decoration: none;
}

.pager-link {
    border: 1px solid var(--border);
}

.pager-current {
    background: var(--primary);
    color: var(--primary-text);
}

@media (max-width: 1100px) {
    .patients-toolbar {
        flex-wrap: wrap;
        margin-left: 0;
    }

    .patients {
        display: block;
        overflow-x: auto;
    }
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sort-arrow {
    font-size: 11px;
}

/* Whole patient row is clickable: the name link stretches over the row. */
.patients tbody tr {
    position: relative;
}

.patients tbody tr:hover {
    background: #fafafa;
}

.row-link {
    color: inherit;
    text-decoration: none;
}

.row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.row-link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* Tooltips must stay above the stretched row link. */
.patients .tooltip, .patients .state-line, .patients .imm, .patients .regimen {
    position: relative;
    z-index: 1;
}

/* ---- Patient card ---- */

.patient-card {
    max-width: 1260px;
    background: #f2f2f2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 32px 12px 12px;
    background: #d9d9d9;
}

.card-identity {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.avatar-patient {
    flex: none;
    margin-top: 8px;
    background: #737373;
}

.card-title {
    margin: 0;
    color: #6b6b6b;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.2;
}

.card-year {
    margin: 0;
    color: #a3a3a3;
    font-size: 22px;
}

.card-actions {
    display: flex;
    gap: 16px;
    margin-top: 44px;
}

.card-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.card-tabs {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    border-radius: 0 var(--radius) 0 0;
    background: #ffffff;
    width: fit-content;
}

.card-body {
    padding: 32px 0 40px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.card-box, .card-panel {
    padding: 20px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
}

.card-box p, .card-panel p {
    margin: 0 0 4px;
    font-size: 15px;
}

.card-panel {
    margin-bottom: 24px;
}

.card-panel-title {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 500;
}

.card-box-framed {
    border-width: 1.5px;
}

.state-border-remisija {
    border-color: #22c55e;
}

.state-border-aktivna {
    border-color: #f87171;
}

.state-border-komisija {
    border-color: #4f2bf0;
}

.drug-card {
    position: relative;
    overflow: hidden;
    border: 0;
    background: color-mix(in srgb, var(--drug-color, #a3a3a3) 45%, #ffffff);
}

.drug-card-empty {
    background: #e5e5e5;
}

.drug-name {
    font-size: 36px !important;
    font-weight: 700;
    margin: 0 !important;
}

.drug-nav {
    display: flex;
    gap: 12px;
    min-height: 28px;
}

.drug-arrow {
    color: #737373;
    font-size: 22px;
    text-decoration: none;
}

.drug-regimen, .drug-period {
    color: #6b6b6b;
}

.drug-imm {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 30px 12px 8px 70px;
    background: linear-gradient(to top left, color-mix(in srgb, var(--drug-color, #a3a3a3) 90%, #000000) 50%, transparent 50%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}

.preserve-lines {
    white-space: pre-line;
}

.plain-list {
    margin: 0;
    padding-left: 18px;
}

.muted-text {
    color: var(--text-muted);
}

.card-note {
    display: flex;
    gap: 24px;
}

.note-icon {
    flex: none;
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.tiles-panel {
    margin: 0 auto 24px;
    max-width: 1020px;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 80px;
    padding: 12px 16px;
    background: #d9d9d9;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
    color: #525252;
    text-decoration: none;
}

.tile:hover {
    background: #cfcfcf;
}

.tile-title {
    font-weight: 600;
}

.tile-date, .tile-conclusion {
    font-size: 13px;
}

.card-entry + .card-entry {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.inline-item + .inline-item::before {
    content: "; ";
}

.card-consent {
    margin: 0 0 0 24px;
}

.dg-banner {
    margin-bottom: 12px;
    padding: 16px;
    border-radius: var(--radius);
    background: #e5e5e5;
    font-size: 30px;
    font-weight: 600;
    text-align: center;
}

.dg-banner.state-border-remisija {
    background: #d1f7da;
}

.dg-banner.state-border-aktivna {
    background: #fde2e2;
}

.dg-banner.state-border-komisija {
    background: #e4defd;
}

.timeline-section {
    margin: 40px 0;
}

.timeline-filter {
    margin-bottom: 16px;
}

.timeline {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 700px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 200px 1fr;
}

.timeline-date {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    border-right: 3px solid #000000;
}

.timeline-status {
    color: var(--text-muted);
}

.timeline-content {
    padding: 16px 0 16px 40px;
}

.timeline-content p {
    margin: 0;
}

.therapy-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.therapy-item {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 120px 240px;
    gap: 24px;
    padding: 16px 0;
}

.therapy-dates {
    padding-right: 24px;
    border-right: 3px solid #000000;
    text-align: right;
}

.therapy-item p {
    margin: 0 0 4px;
}

.therapy-reason {
    display: flex;
    align-items: center;
}

.reason-badge {
    padding: 8px 24px;
    border-radius: var(--radius);
    background: #262626;
    color: #ffffff;
}

.labs-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.chart {
    margin: 0;
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 14px;
}

.chart-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: -1px;
}

.chart-svg {
    width: 100%;
    height: auto;
}

.chart-grid {
    stroke: #e5e5e5;
}

.chart-axis {
    fill: #737373;
    font-size: 11px;
}

.ai-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-weight: 500;
}

.data-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 640px;
}

.data-table th, .data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.record-list {
    display: grid;
    gap: 12px;
    max-width: 820px;
}

.record {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    font-weight: 600;
}

.record summary {
    cursor: pointer;
}

.record-body {
    padding-top: 8px;
    font-weight: 400;
}

.record-body p {
    margin: 0 0 4px;
}

.record-link {
    color: inherit;
    text-decoration: none;
}

.record-link:hover {
    background: #fafafa;
}

.consultation-filter {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.consultation-filter label {
    display: grid;
    gap: 4px;
    font-weight: 500;
}

.consultation-head {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px 24px;
    background: #d9d9d9;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.field-value {
    display: block;
    padding: 6px 10px;
    border-radius: var(--radius);
    background: #ffffff;
}

@media (max-width: 1000px) {
    .card-grid-3, .tiles, .labs-charts, .consultation-head {
        grid-template-columns: minmax(0, 1fr);
    }

    .therapy-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .therapy-dates {
        border-right: 0;
        text-align: left;
    }

    .card-title {
        font-size: 28px;
    }
}

/* "Prikaži još" under lists that are read one page at a time */
.load-more { margin: 12px 0 0; text-align: center; }
