﻿/* =========================================================
   IPD SHARED DESIGN KIT
   One global stylesheet for every IPD page (Dashboard,
   Admission Assessment, Clinical Care, Discharge Summary) so
   they all look like one module instead of four different
   screens. Tokens match the rest of the app (Patients /
   Appointments / Users use --primary: #5B4FE5).

   This is a GLOBAL stylesheet, not a .razor.css file -
   reference it once in index.html / App.razor:

       <link rel="stylesheet" href="css/ipd-shared.css" />

   Works alongside Bootstrap's own grid (row / col-md-6 /
   col-md-3 etc.) which this project already loads - this file
   only styles the *content* inside those columns.
   ========================================================= */

:root {
    --ipd-primary: #5B4FE5;
    --ipd-primary-dark: #3D33B0;
    --ipd-primary-soft: #EDEBFF;
    --ipd-ink: #101827;
    --ipd-ink-soft: #667085;
    --ipd-ink-faint: #94A0B4;
    --ipd-border: #E2E6ED;
    --ipd-border-soft: #EEF0F5;
    --ipd-surface: #FFFFFF;
    --ipd-surface-muted: #F8F9FC;
    --ipd-page-bg: #F2F3FA;
    --ipd-green: #059669;
    --ipd-green-soft: #D1FAE5;
    --ipd-amber: #D97706;
    --ipd-amber-soft: #FEF3C7;
    --ipd-red: #E11D48;
    --ipd-red-soft: #FFE4E9;
    --ipd-blue: #2563EB;
    --ipd-blue-soft: #DBEAFE;
    --ipd-radius-lg: 16px;
    --ipd-radius-md: 12px;
    --ipd-radius-sm: 8px;
    --ipd-shadow: 0 1px 2px rgba(16, 24, 39, .04), 0 8px 20px rgba(16, 24, 39, .06);
}

.ipd-page {
    min-height: 100vh;
    padding: 18px 22px 36px;
    background: var(--ipd-page-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ipd-ink);
}

/* =========================================================
   PAGE HEADER  (title + breadcrumb + actions, one row)
   ========================================================= */

.ipd-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.ipd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    color: var(--ipd-ink-faint);
    font-size: 12px;
    font-weight: 600;
}

    .ipd-breadcrumb a {
        color: var(--ipd-primary);
        text-decoration: none;
    }

    .ipd-breadcrumb .mdi {
        font-size: 14px;
        color: #C7CEDB;
    }

.ipd-page-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.2px;
    color: var(--ipd-ink);
}

.ipd-page-header p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--ipd-ink-soft);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.ipd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 15px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

    .ipd-btn .mdi {
        font-size: 15px;
    }

    .ipd-btn:disabled {
        cursor: not-allowed;
        opacity: .6;
        transform: none;
    }

    .ipd-btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

.ipd-btn-primary {
    background: linear-gradient(160deg, var(--ipd-primary), var(--ipd-primary-dark));
    border-color: var(--ipd-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(91, 79, 229, .25);
}

    .ipd-btn-primary:hover:not(:disabled) {
        box-shadow: 0 8px 18px rgba(91, 79, 229, .32);
    }

.ipd-btn-outline {
    background: var(--ipd-surface);
    border-color: var(--ipd-border);
    color: var(--ipd-primary);
}

    .ipd-btn-outline:hover:not(:disabled) {
        border-color: var(--ipd-primary);
        background: var(--ipd-primary-soft);
    }

.ipd-btn-light {
    background: var(--ipd-surface);
    border-color: var(--ipd-border);
    color: var(--ipd-ink-soft);
}

    .ipd-btn-light:hover:not(:disabled) {
        background: var(--ipd-surface-muted);
        color: var(--ipd-ink);
    }

.ipd-btn-danger {
    background: var(--ipd-surface);
    border-color: var(--ipd-red-soft);
    color: var(--ipd-red);
}

    .ipd-btn-danger:hover:not(:disabled) {
        background: var(--ipd-red-soft);
    }

.ipd-btn-compact {
    min-height: 32px;
    padding: 0 11px;
    font-size: 11.5px;
}

/* =========================================================
   LAYOUT  (sticky step-nav + content)
   ========================================================= */

.ipd-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ipd-step-nav {
    position: sticky;
    top: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius-lg);
    box-shadow: var(--ipd-shadow);
}

.ipd-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--ipd-radius-sm);
    background: transparent;
    color: var(--ipd-ink-soft);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .ipd-step-item:hover,
    .ipd-step-item.active {
        background: var(--ipd-primary-soft);
        color: var(--ipd-primary-dark);
    }

.ipd-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    background: var(--ipd-surface-muted);
    color: var(--ipd-ink-faint);
    font-size: 11px;
    font-weight: 700;
    transition: background .15s ease, color .15s ease;
}

.ipd-step-item.active .ipd-step-number,
.ipd-step-item:hover .ipd-step-number {
    background: var(--ipd-primary);
    color: #fff;
}

.ipd-step-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ipd-content {
    min-width: 0;
}

/* =========================================================
   SECTION CARD  (used for every form section)
   ========================================================= */

.ipd-section {
    scroll-margin-top: 18px;
    padding: 18px 20px;
    margin-bottom: 14px;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius-lg);
    box-shadow: var(--ipd-shadow);
}

.ipd-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ipd-section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
}

.ipd-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: var(--ipd-primary-soft);
    color: var(--ipd-primary);
    font-size: 18px;
}

.ipd-section-title h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ipd-ink);
}

.ipd-section-title p {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: var(--ipd-ink-soft);
}

.ipd-required-note {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--ipd-amber-soft);
    color: var(--ipd-amber);
    font-size: 10.5px;
    font-weight: 700;
}

/* =========================================================
   FORM FIELDS  (sit inside Bootstrap's row / col-md-*)
   ========================================================= */

.ipd-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

    .ipd-field label,
    .ipd-field-label {
        display: flex;
        align-items: baseline;
        gap: 5px;
        font-size: 11.5px;
        font-weight: 700;
        color: var(--ipd-ink-soft);
    }

        .ipd-field label .ipd-unit,
        .ipd-field-label .ipd-unit {
            font-weight: 400;
            color: var(--ipd-ink-faint);
        }

    .ipd-field input[type="text"],
    .ipd-field input[type="number"],
    .ipd-field input[type="date"],
    .ipd-field input[type="time"],
    .ipd-field select,
    .ipd-field textarea,
    .ipd-input {
        width: 100%;
        box-sizing: border-box;
        height: 40px;
        padding: 0 12px;
        border: 1px solid var(--ipd-border);
        border-radius: var(--ipd-radius-sm);
        outline: none;
        background: var(--ipd-surface);
        color: var(--ipd-ink);
        font-family: inherit;
        font-size: 13px;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

    .ipd-field textarea,
    textarea.ipd-input {
        height: auto;
        min-height: 90px;
        padding: 10px 12px;
        resize: vertical;
        line-height: 1.5;
    }

        .ipd-field input:focus,
        .ipd-field select:focus,
        .ipd-field textarea:focus,
        .ipd-input:focus {
            border-color: var(--ipd-primary);
            box-shadow: 0 0 0 3px var(--ipd-primary-soft);
        }

.ipd-textarea-lg {
    min-height: 110px;
}

.ipd-char-count {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
    font-size: 10.5px;
    color: var(--ipd-ink-faint);
}

/* BP-style paired input */
.ipd-pair-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .ipd-pair-input input {
        min-width: 0;
    }

    .ipd-pair-input b {
        color: var(--ipd-ink-faint);
        font-size: 13px;
    }

/* =========================================================
   TOGGLE BUTTONS  (Present/Absent, WNL/Abnormal etc.)
   ========================================================= */

.ipd-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 4px 0;
    border-bottom: 1px solid var(--ipd-border-soft);
}

    .ipd-toggle-row:last-child {
        border-bottom: 0;
    }

    .ipd-toggle-row > span:first-child {
        font-size: 12.5px;
        font-weight: 600;
        color: var(--ipd-ink);
    }

.ipd-toggle-group {
    display: flex;
    gap: 4px;
}

    .ipd-toggle-group button {
        padding: 6px 11px;
        border: 1px solid var(--ipd-border);
        border-radius: 7px;
        background: var(--ipd-surface);
        color: var(--ipd-ink-soft);
        font-family: inherit;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        transition: border-color .15s ease, background .15s ease, color .15s ease;
    }

        .ipd-toggle-group button:hover,
        .ipd-toggle-group button.ipd-toggle-selected {
            border-color: var(--ipd-primary);
            background: var(--ipd-primary-soft);
            color: var(--ipd-primary-dark);
        }

/* =========================================================
   REPEATING ITEM ROW  (diagnosis, medications, procedures...)
   ========================================================= */

.ipd-item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ipd-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius-sm);
    background: var(--ipd-surface-muted);
}

.ipd-item-fields {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

    .ipd-item-fields input {
        height: 36px;
        font-size: 12px;
    }

.ipd-check-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    color: var(--ipd-ink-soft);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

    .ipd-check-pill input {
        accent-color: var(--ipd-primary);
    }

.ipd-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 0;
    border-radius: var(--ipd-radius-sm);
    background: var(--ipd-surface);
    color: var(--ipd-ink-soft);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .ipd-icon-btn:hover {
        background: var(--ipd-red-soft);
        color: var(--ipd-red);
    }

/* =========================================================
   STATUS PILLS
   ========================================================= */

.ipd-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

    .ipd-status-pill::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

.ipd-status-draft {
    background: var(--ipd-amber-soft);
    color: var(--ipd-amber);
}

.ipd-status-complete {
    background: var(--ipd-green-soft);
    color: var(--ipd-green);
}

.ipd-status-admitted {
    background: var(--ipd-blue-soft);
    color: var(--ipd-blue);
}

/* =========================================================
   STICKY BOTTOM ACTION BAR
   ========================================================= */

.ipd-bottom-bar {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    margin-top: 4px;
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius-md);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 6px 22px rgba(16, 24, 39, .12);
    backdrop-filter: blur(8px);
}

.ipd-bottom-status {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: var(--ipd-ink-soft);
}

.ipd-bottom-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================================
   EMPTY / LOADING / ERROR STATES
   ========================================================= */

.ipd-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 260px;
    color: var(--ipd-ink-soft);
    font-size: 13.5px;
}

    .ipd-state .mdi {
        font-size: 22px;
        color: var(--ipd-primary);
    }

.ipd-state-error {
    align-items: flex-start;
    padding-top: 70px;
}

    .ipd-state-error strong {
        display: block;
        margin-bottom: 4px;
        color: var(--ipd-ink);
        font-size: 14px;
    }

    .ipd-state-error p {
        margin: 0 0 14px;
        color: var(--ipd-ink-soft);
        font-size: 12.5px;
    }

.ipd-readonly-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 15px;
    margin-bottom: 14px;
    border-radius: var(--ipd-radius-md);
    background: var(--ipd-surface-muted);
    border: 1px solid var(--ipd-border);
}

    .ipd-readonly-banner .mdi {
        font-size: 19px;
        color: var(--ipd-ink-soft);
        margin-top: 1px;
    }

    .ipd-readonly-banner strong {
        display: block;
        font-size: 13px;
        color: var(--ipd-ink);
    }

    .ipd-readonly-banner p {
        margin: 3px 0 0;
        font-size: 12px;
        color: var(--ipd-ink-soft);
    }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {
    .ipd-layout {
        grid-template-columns: 1fr;
    }

    .ipd-step-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
    }

    .ipd-step-item {
        min-width: 150px;
    }
}

@media (max-width: 640px) {
    .ipd-page {
        padding: 12px;
    }

    .ipd-bottom-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .ipd-bottom-actions .ipd-btn {
        flex: 1;
    }
}
