/* static/css/chest-wall-blocks.css */

.page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 20px 40px;
}

.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card h2 {
    margin-top: 0;
    text-align: left;
}

/* The interim password gate — a single narrow card rather than a card
   stretched across a dashboard-width page. Goes with chest_wall_auth.py
   when the real login lands. */
.login-card {
    max-width: 460px;
    margin: 40px auto;
}

.info-box {
    background-color: rgba(246, 170, 28, 0.12);
    border-left: 4px solid var(--orange-web);
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    margin-bottom: 20px;
    font-size: 0.9em;
    color: #444;
}

/* ---- Dashboard legend ---- */
.dashboard-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 0.78em;
    color: #888;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.legend-sep {
    color: #ddd;
}

.legend-item strong {
    color: #555;
}

/* ---- Consultant row ---- */
.consultant-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #f5f5f5;
    flex-wrap: wrap;
}

.consultant-row:last-child {
    border-bottom: none;
}

.consultant-photo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #e8e8e8;
}

.consultant-info {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.consultant-name {
    font-weight: bold;
    font-size: 0.9em;
}

/* ---- Circles ---- */
.circles-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.circle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.circle-label {
    font-size: 0.62em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
    white-space: nowrap;
}

.circles-row {
    display: flex;
    gap: 3px;
}

.req-circle {
    display: inline-flex;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d0d0d0;
    background: #fff;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: transparent;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.req-circle.done {
    border-color: #28a745;
    background: #28a745;
    color: #fff;
}

.circles-divider {
    width: 1px;
    height: 28px;
    background: #e0e0e0;
    align-self: flex-end;
    margin: 0 2px 2px;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: bold;
    white-space: nowrap;
}

.badge-credentialled {
    background-color: #d4edda;
    color: #155724;
}

/* ---- Form ---- */
.obs-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group > label {
    font-weight: bold;
    color: var(--blood-red);
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'PT Sans', sans-serif;
    font-size: 1em;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--penn-red);
    box-shadow: 0 0 0 3px rgba(148, 27, 12, 0.1);
    background: #fff;
}

.radio-group {
    display: flex;
    gap: 24px;
    padding: 8px 0;
}

.radio-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
    color: #333 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 1em !important;
}

.submit-btn {
    background-color: var(--penn-red);
    color: white;
    padding: 12px 28px;
    font-size: 1em;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    align-self: flex-start;
    font-family: 'PT Sans', sans-serif;
    font-weight: bold;
}

.submit-btn:hover {
    background-color: var(--blood-red);
    transform: scale(1.03);
}

/* Links styled as buttons need the anchor defaults undone. */
a.submit-btn {
    display: inline-block;
    text-decoration: none;
    align-self: center;
}

/* ---- Learning module ---- */
.module-section h2 {
    text-align: left;
    border-bottom: 2px solid rgba(148, 27, 12, 0.12);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.module-body {
    font-size: 0.95em;
    line-height: 1.6;
    color: #333;
}

.module-body p {
    margin: 0 0 14px;
}

.module-body p:last-child {
    margin-bottom: 0;
}

.module-subheading {
    color: var(--rust);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 20px 0 8px;
}

.module-body > .module-subheading:first-child {
    margin-top: 0;
}

.module-list {
    margin: 0 0 4px;
    padding-left: 22px;
}

.module-list li {
    margin-bottom: 7px;
}

/* Nested lists sit tighter than the top-level items they hang off. */
.module-list .module-list {
    margin-top: 7px;
}

.module-list .module-list li {
    margin-bottom: 4px;
}

.module-objectives {
    margin-bottom: 20px;
}

.module-steps li {
    padding-left: 4px;
}

.module-refs {
    font-size: 0.87em;
    color: #555;
}

.module-links a {
    color: var(--penn-red);
    word-break: break-word;
}

/* ---- Module contents ---- */
.module-toc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.85em;
}

.module-toc-title {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
}

.module-toc a {
    color: var(--penn-red);
    text-decoration: none;
}

.module-toc a:hover {
    text-decoration: underline;
}

/* Anchored sections would otherwise land flush against the top edge. */
.module-section {
    scroll-margin-top: 16px;
}

/* ---- Module figures ---- */
.module-figures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 0 20px;
}

.module-figure {
    margin: 0;
}

.module-figure img {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    display: block;
    /* The two figures have different aspect ratios; a shared height with
       contain keeps both whole and leaves the captions on one line. */
    height: 250px;
    object-fit: contain;
    background: #fafafa;
}

.module-figure figcaption {
    font-size: 0.8em;
    color: #888;
    margin-top: 6px;
    line-height: 1.4;
}

/* ---- Quiz ---- */
.quiz-question {
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
}

.quiz-question-text {
    margin: 0 0 10px;
    font-weight: bold;
    font-size: 0.95em;
    color: #333;
}

.quiz-question-number {
    color: var(--penn-red);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.93em;
    transition: background 0.15s, border-color 0.15s;
}

.quiz-option:hover {
    background: #fafafa;
    border-color: #ddd;
}

.quiz-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--penn-red);
    flex-shrink: 0;
}

.quiz-option:has(input:checked) {
    background: rgba(148, 27, 12, 0.05);
    border-color: var(--penn-red);
}

.quiz-result-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 22px;
    line-height: 1.5;
}

.quiz-result-banner > i {
    font-size: 1.4em;
    margin-top: 2px;
}

.quiz-result-pass {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.quiz-result-fail {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.quiz-breakdown {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
}

.quiz-breakdown li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.92em;
}

.quiz-breakdown li:last-child {
    border-bottom: none;
}

.quiz-breakdown small {
    color: #888;
}

.quiz-mark {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.quiz-correct .quiz-mark,
.quiz-correct .quiz-verdict { color: #28a745; }

.quiz-incorrect .quiz-mark,
.quiz-incorrect .quiz-verdict { color: var(--penn-red); }

/* ---- Loading indicator ---- */
.htmx-indicator {
    display: none;
    color: var(--penn-red);
    font-size: 0.9em;
}

.htmx-request .htmx-indicator {
    display: inline;
}

/* ---- Tables ---- */
.status-table,
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93em;
}

.status-table th,
.log-table th {
    background-color: var(--penn-red);
    color: #fff;
    padding: 9px 14px;
    text-align: left;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.status-table td,
.log-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.status-table tr:last-child td,
.log-table tr:last-child td {
    border-bottom: none;
}

.log-scroll {
    overflow-x: auto;
}

.log-table small {
    color: #888;
    font-size: 0.85em;
}

.icon-yes { color: #28a745; }
.icon-no  { color: var(--penn-red); }

/* ---- Empty state ---- */
.empty-state {
    color: #999;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

/* ---- Success banner ---- */
.success-banner {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 11px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    animation: cwb-fadein 0.3s ease;
}

@keyframes cwb-fadein {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Admin ---- */
.back-link {
    color: var(--penn-red);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
}

.back-link:hover {
    text-decoration: underline;
}

.admin-hint {
    font-size: 0.85em;
    color: #888;
    margin: -8px 0 14px;
}

.edu-cell {
    text-align: center;
}

.edu-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--penn-red);
}

.btn-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.btn-delete:hover {
    color: var(--penn-red);
    background: rgba(148, 27, 12, 0.07);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-container {
        padding: 12px;
    }

    .card {
        padding: 16px;
    }

    .consultant-row {
        gap: 8px;
    }

    .consultant-info {
        min-width: 120px;
    }

    /* The circle sections wrap onto their own line on narrow screens,
       which leaves the divider dangling at the end of the first row. */
    .circles-divider {
        display: none;
    }

    .consultant-stats {
        margin-left: 0;
        flex-direction: row;
    }

    .module-figures {
        grid-template-columns: 1fr;
    }

    /* Stacked, they no longer need to match each other's height. */
    .module-figure img {
        height: auto;
    }
}
