/* ==========================================================================
   BSR Case Studies – Frontend Stylesheet
   Medical-professional design language
   ========================================================================== */

/* Google Fonts – Roboto Slab (display/headings) + Roboto (body) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,700;1,300&family=Roboto+Slab:wght@300;400&display=swap');

/* --------------------------------------------------------------------------
   Custom properties
   -------------------------------------------------------------------------- */
:root {
    --bsr-blue:        #446463;
    --bsr-blue-dark:   #2d4342;
    --bsr-teal:        #82A198;
    --bsr-teal-light:  #dde9e7;
    --bsr-grey-100:    #f5f7f7;
    --bsr-grey-200:    #e9ecec;
    --bsr-grey-400:    #adb5bd;
    --bsr-grey-700:    #495057;
    --bsr-text:        #212529;
    --bsr-white:       #ffffff;
    --bsr-red:         #c62828;
    --bsr-green:       #2e7d32;
    --bsr-radius:      6px;
    --bsr-shadow:      0 2px 8px rgba(0, 0, 0, .09);
    --bsr-shadow-lg:   0 4px 20px rgba(0, 0, 0, .12);
    --bsr-font:        'Roboto', sans-serif;
    --bsr-font-display:'Roboto Slab', serif;
}

/* --------------------------------------------------------------------------
   Utility notices
   -------------------------------------------------------------------------- */
.bsr-notice {
    padding: 14px 18px;
    border-radius: var(--bsr-radius);
    margin-bottom: 20px;
    font-family: var(--bsr-font);
    font-size: .95rem;
}
.bsr-notice-info    { background: #dde9e7; border-left: 4px solid var(--bsr-blue); color: var(--bsr-blue-dark); }
.bsr-notice-success { background: #e8f5e9; border-left: 4px solid #43a047; color: var(--bsr-green); }
.bsr-notice-error   { background: #ffebee; border-left: 4px solid var(--bsr-red); color: var(--bsr-red); }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.bsr-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    white-space: nowrap;
}
.bsr-badge-public  { background: #dde9e7; color: var(--bsr-blue); }
.bsr-badge-members { background: #fff3e0; color: #e65100; }
.bsr-badge-private { background: #fce4ec; color: #880e4f; }
.bsr-badge-semi    { background: #f3e5f5; color: #6a1b9a; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.bsr-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--bsr-radius);
    font-family: var(--bsr-font);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.4;
}
.bsr-btn-primary {
    background: var(--bsr-blue);
    color: var(--bsr-white);
    border-color: var(--bsr-blue);
}
.bsr-btn-primary:hover {
    background: var(--bsr-blue-dark);
    border-color: var(--bsr-blue-dark);
    color: var(--bsr-white);
}
.bsr-btn-secondary {
    background: var(--bsr-grey-200);
    color: var(--bsr-grey-700);
    border-color: var(--bsr-grey-200);
}
.bsr-btn-secondary:hover {
    background: var(--bsr-grey-400);
    border-color: var(--bsr-grey-400);
    color: var(--bsr-text);
}
.bsr-btn-outline {
    background: transparent;
    color: var(--bsr-blue);
    border-color: var(--bsr-blue);
}
.bsr-btn-outline:hover {
    background: var(--bsr-blue);
    color: var(--bsr-white);
}
.bsr-btn-link {
    background: none;
    border: none;
    color: var(--bsr-red);
    font-size: .85rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* ==========================================================================
   SUBMISSION FORM
   ========================================================================== */

.bsr-form-wrap {
    max-width: 820px;
    margin: 0 auto;
    font-family: var(--bsr-font);
    font-weight: 300;
    color: var(--bsr-text);
}
.bsr-form-title {
    font-family: var(--bsr-font-display);
    font-weight: 300;
    font-size: 1.6rem;
    color: var(--bsr-blue);
    margin-bottom: 6px;
}
.bsr-form-intro {
    color: var(--bsr-grey-700);
    margin-bottom: 28px;
    font-size: .9rem;
}

/* Sections */
.bsr-form-section {
    background: var(--bsr-white);
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    padding: 28px 28px 22px;
    margin-bottom: 24px;
    box-shadow: var(--bsr-shadow);
}
.bsr-section-members {
    border-left: 4px solid #e65100;
}
.bsr-section-submit {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.bsr-section-title {
    font-family: var(--bsr-font-display);
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--bsr-blue);
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bsr-grey-200);
    display: flex;
    align-items: center;
    gap: 8px;
}
.bsr-section-intro {
    font-size: .875rem;
    color: var(--bsr-grey-700);
    margin: -10px 0 18px;
}

/* Fields */
.bsr-field-group {
    margin-bottom: 16px;
}
.bsr-field-row {
    display: flex;
    gap: 16px;
}
.bsr-field-row .bsr-field-group {
    flex: 1;
}
.bsr-field-narrow {
    flex: 0 0 200px;
    max-width: 200px;
}
.bsr-field-group label {
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: 5px;
    color: var(--bsr-text);
    display: block;
}
.bsr-field-group label .bsr-badge {
    vertical-align: middle;
    margin-left: 5px;
}
.bsr-field-note {
    display: block;
    font-size: .78rem;
    font-weight: 400;
    color: var(--bsr-grey-700);
    margin-top: 3px;
}
.bsr-input,
.bsr-select,
.bsr-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--bsr-grey-400);
    border-radius: var(--bsr-radius);
    font-family: var(--bsr-font);
    font-size: .9rem;
    color: var(--bsr-text);
    background: var(--bsr-white);
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.bsr-input:focus,
.bsr-select:focus,
.bsr-textarea:focus {
    border-color: var(--bsr-blue);
    box-shadow: 0 0 0 3px rgba(68, 100, 99, .15);
    outline: none;
}
.bsr-textarea {
    resize: vertical;
    min-height: 70px;
}
.bsr-radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.bsr-radio-group label {
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bsr-checkbox-group label {
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Complaint blocks */
.bsr-complaint-block {
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bsr-grey-100);
}
.bsr-complaint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.bsr-complaint-label {
    font-weight: 700;
    font-size: .95rem;
    color: var(--bsr-blue);
}

/* Complaint typeahead */
.bsr-typeahead-wrap {
    position: relative;
}
.bsr-typeahead-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bsr-white);
    border: 1px solid var(--bsr-grey-400);
    border-top: none;
    border-radius: 0 0 var(--bsr-radius) var(--bsr-radius);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--bsr-shadow-lg);
}
.bsr-dropdown-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: .9rem;
    border-bottom: 1px solid var(--bsr-grey-200);
    transition: background .1s;
}
.bsr-dropdown-item:last-child { border-bottom: none; }
.bsr-dropdown-item:hover { background: #dde9e7; }
.bsr-dropdown-new {
    color: var(--bsr-teal);
    font-weight: 600;
}
.bsr-dropdown-hint {
    padding: 7px 14px;
    font-size: .8rem;
    color: var(--bsr-grey-400);
    font-style: italic;
    border-bottom: 1px solid var(--bsr-grey-200);
    cursor: default;
}

/* Add complaint button */
#bsr-add-complaint {
    margin-top: 4px;
}

/* ==========================================================================
   CASE STUDY LIST
   ========================================================================== */

.bsr-list-wrap {
    font-family: var(--bsr-font);
    font-weight: 300;
    color: var(--bsr-text);
}

/* Filter bar */
.bsr-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bsr-grey-100);
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    margin-bottom: 20px;
}
.bsr-filter-active {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.bsr-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bsr-white);
    border: 1px solid var(--bsr-grey-400);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: .85rem;
}
.bsr-filter-remove {
    color: var(--bsr-red);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}
.bsr-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: .85rem;
}
.bsr-search-wrap {
    flex: 1 1 auto;
    max-width: 280px;
}
.bsr-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--bsr-grey-400);
    border-radius: var(--bsr-radius);
    font-size: .85rem;
    font-family: var(--bsr-font);
    color: var(--bsr-text);
    background: var(--bsr-white);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.bsr-search-input:focus {
    border-color: var(--bsr-blue);
    box-shadow: 0 0 0 3px rgba(68,100,99,.15);
}
.bsr-sort-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.bsr-sort-label { color: var(--bsr-grey-700); }
.bsr-sort-link {
    color: var(--bsr-blue);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background .1s;
}
.bsr-sort-link:hover    { background: var(--bsr-grey-200); }
.bsr-sort-active { font-weight: 700; background: var(--bsr-grey-200); }

/* List header */
.bsr-list-header,
.bsr-row-summary {
    display: grid;
    grid-template-columns: 80px 110px 1fr 180px 44px;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}
.bsr-list-header {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bsr-grey-700);
    border-bottom: 2px solid var(--bsr-grey-200);
    background: var(--bsr-grey-100);
    border-radius: var(--bsr-radius) var(--bsr-radius) 0 0;
}

/* Case rows */
.bsr-case-list {
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    overflow: hidden;
}
.bsr-case-row {
    border-bottom: 1px solid var(--bsr-grey-200);
    background: var(--bsr-white);
    transition: background .15s;
}
.bsr-case-row:last-child { border-bottom: none; }
.bsr-case-row:nth-child(even) { background: #fafbfc; }
.bsr-case-row:hover { background: #f0f6fb; }

.bsr-row-summary {
    cursor: pointer;
    font-size: .9rem;
    user-select: none;
}
.bsr-col-gender     { }
.bsr-col-bracket    { }
.bsr-col-complaints { display: flex; flex-wrap: wrap; gap: 4px; }
.bsr-col-practitioner { }
.bsr-col-toggle     { display: flex; align-items: center; justify-content: flex-end; }

.bsr-col-sortable {
    color: var(--bsr-grey-700);
    text-decoration: none;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color .15s;
}
.bsr-col-sortable:hover { color: var(--bsr-blue); }
.bsr-col-sort-active { color: var(--bsr-blue); }
.bsr-sort-arrow { font-size: .6rem; }

/* Practitioner in expanded row — only shown on mobile */
.bsr-expanded-practitioner-mobile { display: none; }

/* Tags */
.bsr-tag {
    display: inline-block;
    background: var(--bsr-teal-light);
    color: var(--bsr-teal);
    border: 1px solid #b2dfdb;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .1s;
}
.bsr-tag:hover { background: #b2dfdb; color: #004d40; }

/* Practitioner link */
.bsr-practitioner-link {
    color: var(--bsr-blue);
    text-decoration: none;
    font-weight: 500;
}
.bsr-practitioner-link:hover { text-decoration: underline; }

/* Row toggle button */
.bsr-row-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--bsr-grey-700);
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .1s;
    font-size: 1rem;
}
.bsr-row-toggle:hover { background: var(--bsr-grey-200); }
.bsr-toggle-icon {
    display: inline-block;
    transition: transform .2s;
}
.bsr-row-toggle.bsr-open .bsr-toggle-icon {
    transform: rotate(180deg);
}

/* Expanded row content */
.bsr-row-expanded {
    border-top: 1px solid var(--bsr-grey-200);
    background: #f8fbff;
}
.bsr-expanded-inner {
    padding: 16px 20px 20px;
}
.bsr-expanded-header {
    margin-bottom: 12px;
}
.bsr-case-link {
    color: var(--bsr-blue);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
}
.bsr-case-link:hover { text-decoration: underline; }
.bsr-expanded-meta {
    font-size: .875rem;
    color: var(--bsr-grey-700);
    margin: 0 0 10px;
}
.bsr-expanded-complaints {
    margin-top: 10px;
    font-size: .875rem;
}
.bsr-expanded-complaint {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--bsr-grey-200);
}
.bsr-expanded-complaint:last-child { border-bottom: none; }
.bsr-expanded-complaint-name {
    font-weight: 600;
    min-width: 140px;
    color: var(--bsr-blue-dark);
}
.bsr-expanded-complaint-desc {
    color: var(--bsr-grey-700);
}

/* No results */
.bsr-no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--bsr-grey-700);
}

/* Pagination */
.bsr-pagination {
    margin-top: 28px;
    text-align: center;
}
.bsr-pagination ul {
    display: inline-flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.bsr-pagination ul li a,
.bsr-pagination ul li span {
    display: block;
    padding: 7px 14px;
    border: 1px solid var(--bsr-grey-400);
    border-radius: var(--bsr-radius);
    text-decoration: none;
    color: var(--bsr-blue);
    font-size: .875rem;
    font-family: var(--bsr-font);
    transition: background .1s;
}
.bsr-pagination ul li .current {
    background: var(--bsr-blue);
    color: var(--bsr-white);
    border-color: var(--bsr-blue);
}
.bsr-pagination ul li a:hover { background: var(--bsr-grey-200); }

/* ==========================================================================
   SINGLE CASE STUDY
   ========================================================================== */

.bsr-single-wrap {
    max-width: 820px;
    margin: 0 auto;
    font-family: var(--bsr-font);
    font-weight: 300;
    color: var(--bsr-text);
    padding-bottom: 40px;
}
.bsr-back-link {
    display: inline-block;
    color: var(--bsr-blue);
    text-decoration: none;
    font-size: .875rem;
    margin-bottom: 20px;
    font-weight: 500;
}
.bsr-back-link:hover { text-decoration: underline; }

.bsr-edit-bar {
    margin-bottom: 16px;
}
.bsr-btn-sm {
    padding: 5px 12px;
    font-size: .825rem;
}

/* Single header */
.bsr-single-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bsr-grey-200);
}
.bsr-single-title {
    font-family: var(--bsr-font-display);
    font-weight: 300;
    font-size: 1.8rem;
    color: var(--bsr-blue-dark);
    margin: 0 0 10px;
}
.bsr-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: .875rem;
    color: var(--bsr-grey-700);
}
.bsr-meta-label { font-weight: 600; margin-right: 4px; }

/* Sections on single page */
.bsr-section {
    background: var(--bsr-white);
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--bsr-shadow);
}
.bsr-section-private {
    border-left: 4px solid #880e4f;
    background: #fffafa;
}
.bsr-private-notice {
    font-size: .85rem;
    color: #880e4f;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bsr-section-members { border-left: 4px solid #e65100; }
.bsr-section-comments { }
.bsr-lock-icon { font-size: 1rem; }

.bsr-section .bsr-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bsr-blue);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bsr-grey-200);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Detail table */
.bsr-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.bsr-detail-table th,
.bsr-detail-table td {
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--bsr-grey-200);
}
.bsr-detail-table tr:last-child th,
.bsr-detail-table tr:last-child td { border-bottom: none; }
.bsr-detail-table th {
    font-weight: 600;
    color: var(--bsr-grey-700);
    width: 200px;
    background: var(--bsr-grey-100);
}
.bsr-members-row th,
.bsr-members-row td { background: #fff8f1; }
.bsr-members-row th .bsr-badge { display: block; margin-top: 4px; }

/* Complaint cards */
.bsr-complaint-card {
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.bsr-complaint-card:last-child { margin-bottom: 0; }
.bsr-complaint-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bsr-white);
    background: var(--bsr-blue);
    padding: 10px 16px;
    margin: 0;
}

/* Subscription box */
.bsr-subscription-box {
    margin-bottom: 20px;
    padding: 14px 20px;
    background: var(--bsr-grey-100);
    border: 1px solid var(--bsr-grey-200);
    border-radius: var(--bsr-radius);
}

/* Login prompt */
.bsr-login-prompt {
    text-align: center;
    padding: 28px;
    background: #dde9e7;
    border-radius: var(--bsr-radius);
    border: 1px solid #b0c9c5;
    margin-bottom: 20px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 700px) {
    .bsr-list-header,
    .bsr-row-summary {
        grid-template-columns: 60px 80px 1fr 36px;
    }
    .bsr-col-practitioner { display: none; }
    .bsr-expanded-practitioner-mobile { display: block; }

    .bsr-field-row { flex-direction: column; }
    .bsr-field-narrow { max-width: 100%; }

    .bsr-filter-bar { flex-direction: column; align-items: flex-start; }

    .bsr-detail-table th { width: 120px; }
}
