/* ==========================================================================
   pwai-coins-tools.css
   Consistent with Project Work AI design tokens:
     Primary #2F5DAA | Accent #4CAF50 | BG #F0F2F7
     Font: Trebuchet MS (UI), Georgia (body text/output)
   ========================================================================== */

/* ── Shared tokens ───────────────────────────────────────────────────────── */
:root {
    --pwai-primary:   #2F5DAA;
    --pwai-primary-d: #1e3f7a;
    --pwai-accent:    #4CAF50;
    --pwai-bg:        #F0F2F7;
    --pwai-white:     #ffffff;
    --pwai-ink:       #1a2340;
    --pwai-muted:     #6b7a99;
    --pwai-border:    #dde2ee;
    --pwai-radius:    10px;
    --pwai-font-ui:   'Trebuchet MS', sans-serif;
    --pwai-font-body: Georgia, serif;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.pwai-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .75rem 1.5rem;
    background: var(--pwai-primary);
    color: #fff;
    border: none;
    border-radius: var(--pwai-radius);
    font-family: var(--pwai-font-ui);
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .1s;
    line-height: 1;
}
.pwai-btn-primary:hover  { background: var(--pwai-primary-d); color: #fff; }
.pwai-btn-primary:active { transform: scale(.98); }
.pwai-btn-primary:disabled { background: #b0bdd6; cursor: not-allowed; }

.pwai-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .6rem 1.1rem;
    border: 2px solid var(--pwai-primary);
    border-radius: var(--pwai-radius);
    color: var(--pwai-primary);
    font-family: var(--pwai-font-ui);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    transition: background .2s, color .2s;
}
.pwai-btn-outline:hover { background: var(--pwai-primary); color: #fff; }

/* ── Tool wrap ────────────────────────────────────────────────────────────── */
.pwai-tool-wrap {
    min-height: 100vh;
    background: var(--pwai-bg);
    font-family: var(--pwai-font-ui);
    color: var(--pwai-ink);
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.pwai-tool-topbar {
    background: #1a2340;
    padding: .85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 200;
}
.pwai-tool-back { color: rgba(255,255,255,.65); text-decoration: none; font-size: .82rem; font-weight: 600; transition: color .2s; }
.pwai-tool-back:hover { color: #fff; }
.pwai-tool-topbar-name { color: #fff; font-size: .92rem; font-weight: 800; }
.pwai-tool-cost-badge {
    background: var(--pwai-accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: .28rem .75rem;
    border-radius: 50px;
}

/* ── Two-column body ──────────────────────────────────────────────────────── */
.pwai-tool-body {
    display: grid;
    grid-template-columns: 380px 1fr;
    min-height: calc(100vh - 54px);
}

/* ── Input panel ─────────────────────────────────────────────────────────── */
.pwai-tool-input-panel {
    background: var(--pwai-white);
    border-right: 1px solid #eef0f5;
    padding: 1.75rem;
    overflow-y: auto;
    height: calc(100vh - 54px);
    position: sticky;
    top: 54px;
}
.pwai-tool-panel-title { font-size: 1.1rem; font-weight: 800; color: var(--pwai-ink); margin: 0 0 .35rem; }
.pwai-tool-panel-desc  { font-size: .82rem; color: var(--pwai-muted); line-height: 1.6; margin: 0 0 1.25rem; }

/* ── Balance display ─────────────────────────────────────────────────────── */
.pwai-tool-balance {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #e8eef8;
    border-radius: 8px;
    padding: .6rem .9rem;
    font-size: .82rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.pwai-tool-balance strong { color: var(--pwai-primary); font-weight: 700; }
.pwai-tool-balance-low   { background: #fff3e0; }
.pwai-tool-balance-low strong { color: #e65100; }
.pwai-tool-topup-link    { margin-left: auto; color: var(--pwai-primary); font-weight: 700; font-size: .78rem; text-decoration: none; }
.pwai-tool-topup-link:hover { text-decoration: underline; }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.pwai-tool-field { margin-bottom: 1.1rem; }
.pwai-tool-field label {
    display: block;
    font-size: .83rem;
    font-weight: 700;
    color: var(--pwai-ink);
    margin-bottom: .4rem;
}
.pwai-tool-field label small {
    display: block;
    font-size: .7rem;
    font-weight: 400;
    color: var(--pwai-muted);
    margin-top: 1px;
}
.pwai-tool-input,
.pwai-tool-textarea,
.pwai-tool-select {
    width: 100%;
    padding: .65rem .85rem;
    border: 1.5px solid var(--pwai-border);
    border-radius: var(--pwai-radius);
    font-family: var(--pwai-font-body);
    font-size: .88rem;
    color: var(--pwai-ink);
    background: #fafbfc;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.pwai-tool-input:focus,
.pwai-tool-textarea:focus,
.pwai-tool-select:focus {
    outline: none;
    border-color: var(--pwai-primary);
    box-shadow: 0 0 0 3px rgba(47,93,170,.1);
    background: var(--pwai-white);
}
.pwai-tool-textarea { resize: vertical; min-height: 90px; }
.pwai-tool-charcount { font-size: .7rem; color: var(--pwai-muted); text-align: right; margin-top: 3px; }
.pwai-req { color: #e65100; }

/* ── Submit button ───────────────────────────────────────────────────────── */
.pwai-tool-submit-btn { width: 100%; margin-top: .25rem; padding: .85rem 1rem; font-size: .88rem; }
.pwai-btn-loading { display: flex; align-items: center; gap: .5rem; }
.pwai-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pwaiSpin .7s linear infinite;
}
@keyframes pwaiSpin { to { transform: rotate(360deg); } }

.pwai-tool-disclaimer {
    font-size: .7rem;
    color: var(--pwai-muted);
    text-align: center;
    margin-top: .6rem;
    line-height: 1.5;
}

/* ── Error message ───────────────────────────────────────────────────────── */
.pwai-tool-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
    border-radius: 6px;
    padding: .7rem 1rem;
    font-size: .83rem;
    margin-bottom: .85rem;
    line-height: 1.5;
}
.pwai-tool-error a { color: #c62828; font-weight: 700; }

/* ── Insufficient coins gate ─────────────────────────────────────────────── */
.pwai-tool-insufficient {
    text-align: center;
    padding: 2rem 1rem;
}
.pwai-tool-insufficient-icon { font-size: 2.5rem; margin-bottom: .65rem; }
.pwai-tool-insufficient h3   { font-size: .95rem; font-weight: 800; color: var(--pwai-ink); margin-bottom: .4rem; }
.pwai-tool-insufficient p    { font-size: .83rem; color: var(--pwai-muted); margin-bottom: 1rem; }

/* ── Output panel ────────────────────────────────────────────────────────── */
.pwai-tool-output-panel {
    padding: 1.75rem;
    overflow-y: auto;
    height: calc(100vh - 54px);
    position: sticky;
    top: 54px;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.pwai-tool-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    color: var(--pwai-muted);
}
.pwai-tool-empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.pwai-tool-empty h3   { font-size: .95rem; font-weight: 700; color: var(--pwai-ink); margin-bottom: .35rem; }
.pwai-tool-empty p    { font-size: .82rem; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.pwai-tool-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    gap: .75rem;
}
.pwai-tool-progress-icon  { font-size: 2.5rem; animation: pwaiPulse 1.4s ease-in-out infinite; }
.pwai-tool-progress-label { font-size: .88rem; color: var(--pwai-muted); margin: 0; }
@keyframes pwaiPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.pwai-tool-progress-bar-wrap {
    width: 220px;
    height: 6px;
    background: #eef0f5;
    border-radius: 50px;
    overflow: hidden;
}
.pwai-tool-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pwai-primary), var(--pwai-accent));
    border-radius: 50px;
    transition: width .5s ease;
    width: 0;
}

/* ── Result ──────────────────────────────────────────────────────────────── */
.pwai-tool-result { display: flex; flex-direction: column; gap: .85rem; }
.pwai-tool-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.pwai-tool-result-label  { font-size: .8rem; font-weight: 700; color: #2e7d32; }
.pwai-tool-result-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.pwai-tool-result-body {
    background: var(--pwai-white);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 2px 10px rgba(47,93,170,.07);
    font-family: var(--pwai-font-body);
    font-size: .92rem;
    line-height: 1.85;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
}
/* Result content formatting */
.pwai-tool-result-body h2 { font-family: var(--pwai-font-ui); font-size: 1rem; font-weight: 800; color: var(--pwai-ink); margin: 1.25rem 0 .4rem; border-bottom: 2px solid var(--pwai-primary); padding-bottom: 3px; }
.pwai-tool-result-body h3 { font-family: var(--pwai-font-ui); font-size: .88rem; font-weight: 700; color: var(--pwai-primary); margin: 1rem 0 .25rem; }
.pwai-tool-result-body p  { margin-bottom: .75rem; text-align: justify; }
.pwai-tool-result-body ol,
.pwai-tool-result-body ul { margin: .5rem 0 .75rem 1.5rem; }
.pwai-tool-result-body li { margin-bottom: .4rem; }
.pwai-tool-result-body table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .84rem; }
.pwai-tool-result-body th,
.pwai-tool-result-body td  { border: 1px solid var(--pwai-border); padding: .45rem .65rem; }
.pwai-tool-result-body th  { background: #eef0f5; font-weight: 700; text-align: left; }
.pwai-tool-result-body strong { color: var(--pwai-ink); }

/* ── Login gate / tool gate ─────────────────────────────────────────────── */
.pwai-tool-gate {
    max-width: 480px;
    margin: 4rem auto;
    background: var(--pwai-white);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 4px 24px rgba(47,93,170,.1);
}
.pwai-tool-gate-icon { font-size: 2.8rem; margin-bottom: .65rem; }
.pwai-tool-gate h2   { font-size: 1.15rem; font-weight: 800; color: var(--pwai-ink); margin-bottom: .5rem; }
.pwai-tool-gate p    { font-size: .88rem; color: var(--pwai-muted); margin-bottom: 1.25rem; }
.pwai-tool-unavailable { text-align:center; padding: 2rem; color: var(--pwai-muted); font-style: italic; }

/* ── Tools Hub ───────────────────────────────────────────────────────────── */
.pwai-hub-wrap    { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
.pwai-hub-header  { text-align: center; margin-bottom: 2.5rem; }
.pwai-hub-title   { font-family: var(--pwai-font-ui); font-size: 1.9rem; font-weight: 800; color: var(--pwai-ink); margin-bottom: .5rem; }
.pwai-hub-sub     { font-size: .95rem; color: var(--pwai-muted); max-width: 520px; margin: 0 auto .85rem; line-height: 1.65; }
.pwai-hub-sub a   { color: var(--pwai-primary); font-weight: 700; }
.pwai-hub-balance { display: inline-flex; align-items: center; gap: .6rem; background: #e8eef8; padding: .45rem 1rem; border-radius: 50px; font-size: .82rem; font-weight: 600; }
.pwai-hub-balance strong { color: var(--pwai-primary); }
.pwai-hub-topup   { color: var(--pwai-primary); font-weight: 700; font-size: .78rem; text-decoration: none; }
.pwai-hub-topup:hover { text-decoration: underline; }
.pwai-hub-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.pwai-hub-card    {
    background: var(--pwai-white);
    border-radius: 14px;
    padding: 1.5rem;
    border: 2px solid #eef0f5;
    box-shadow: 0 2px 10px rgba(47,93,170,.06);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    transition: border-color .2s, box-shadow .2s;
}
.pwai-hub-card:hover         { border-color: var(--pwai-primary); box-shadow: 0 4px 20px rgba(47,93,170,.12); }
.pwai-hub-card-icon          { font-size: 2.25rem; }
.pwai-hub-card-name          { font-size: 1rem; font-weight: 800; color: var(--pwai-ink); margin: 0; }
.pwai-hub-card-desc          { font-size: .82rem; color: var(--pwai-muted); line-height: 1.6; flex: 1; margin: 0; }
.pwai-hub-card-footer        { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .25rem; }
.pwai-hub-card-cost          { font-size: .78rem; font-weight: 700; color: var(--pwai-primary); }
.pwai-hub-card-btn           { padding: .55rem 1rem; font-size: .8rem; }
.pwai-hub-card-btn-secondary { border: 2px solid var(--pwai-border); color: var(--pwai-muted); border-radius: var(--pwai-radius); font-size: .8rem; padding: .5rem .9rem; text-decoration: none; font-weight: 700; transition: background .2s; }
.pwai-hub-card-btn-secondary:hover { background: #eef0f5; }
.pwai-hub-empty   { text-align: center; padding: 3rem; color: var(--pwai-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .pwai-tool-body { grid-template-columns: 1fr; min-height: auto; }
    .pwai-tool-input-panel,
    .pwai-tool-output-panel { height: auto; position: static; overflow-y: visible; }
    .pwai-tool-result-body  { max-height: none; }
    .pwai-tool-empty        { min-height: 180px; }
    .pwai-tool-progress     { min-height: 180px; }
}
@media (max-width: 480px) {
    .pwai-tool-topbar   { padding: .7rem 1rem; }
    .pwai-tool-input-panel,
    .pwai-tool-output-panel { padding: 1.1rem; }
    .pwai-hub-grid      { grid-template-columns: 1fr; }
    .pwai-hub-title     { font-size: 1.4rem; }
}

/* ── Two-column field row (Spin Bot selects) ─────────────────────────────── */
.pwai-tool-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

@media ( max-width: 600px ) {
    .pwai-tool-field-row { grid-template-columns: 1fr; }
}

/* ── Image upload field ──────────────────────────────────────────────────── */
.pwai-tool-image-upload {
    border: 2px dashed #c4d2ed;
    border-radius: 10px;
    background: #f5f7fb;
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    position: relative;
}

.pwai-tool-image-upload:hover,
.pwai-tool-image-upload.dragover {
    border-color: #2F5DAA;
    background: #e8eef8;
}

.pwai-tool-image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.pwai-tool-image-upload-icon  { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; }
.pwai-tool-image-upload-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2F5DAA;
    display: block;
    margin-bottom: 0.2rem;
}
.pwai-tool-image-upload-hint  {
    font-size: 0.75rem;
    color: #6b7a99;
}

.pwai-tool-image-preview {
    margin-top: 0.75rem;
    display: none;
}
.pwai-tool-image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #dde2ee;
    object-fit: contain;
}
.pwai-tool-image-clear {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #c62828;
    cursor: pointer;
    background: none;
    border: none;
    font-family: 'Trebuchet MS', sans-serif;
    font-weight: 700;
}

.pwai-tool-or-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: #9aa3b8;
    font-size: 0.8rem;
    font-weight: 700;
}
.pwai-tool-or-divider::before,
.pwai-tool-or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eef0f5;
}

/* ==========================================================================
   CONCEPTUAL FRAMEWORK DIAGRAM
   Matches the academic layout shown in Figure 1.1:
   [IV Box] ──arrow──> [DV Box]
       |                   |
   [Outer IV box]     [Outer DV box]
   ┌──────────┐       ┌──────────┐
   │ IV dim 1 │       │ DV dim 1 │
   │ IV dim 2 │       │ DV dim 2 │
   │ IV dim 3 │       │ DV dim 3 │
   └──────────┘       └──────────┘
   ========================================================================== */

.pwai-cf-diagram {
    font-family: 'Times New Roman', Georgia, serif;
    background: #fff;
    border: 1px solid #dde2ee;
    border-radius: 10px;
    padding: 2rem 1.5rem 1.5rem;
    margin: 1.5rem 0;
    max-width: 820px;
}

/* ── Top row: IV → Arrow → DV ─────────────────────────────────────────── */
.pwai-cf-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 0;
}

.pwai-cf-var-box {
    border: 2px solid #1a2340;
    padding: 0.8rem 1.2rem;
    min-width: 200px;
    max-width: 280px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.97rem;
    font-weight: 600;
    color: #1a2340;
    line-height: 1.4;
    background: #fff;
    flex: 1;
}

/* ── Arrow between top boxes ───────────────────────────────────────────── */
.pwai-cf-arrow-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
    width: 80px;
}

.pwai-cf-arrow {
    position: relative;
    width: 100%;
    height: 2px;
    background: #1a2340;
}

.pwai-cf-arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 10px solid #1a2340;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* ── Connector lines (vertical drops from top boxes to outer boxes) ─────── */
.pwai-cf-connectors {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 36px;
}

.pwai-cf-connector {
    flex: 1;
    display: flex;
    justify-content: center;
}

.pwai-cf-connector--left::before,
.pwai-cf-connector--right::before {
    content: '';
    display: block;
    width: 2px;
    height: 36px;
    background: #1a2340;
    /* centre under each top box, accounting for arrow wrap width */
}

.pwai-cf-connector-spacer {
    width: 88px; /* matches arrow-wrap width + padding */
    flex-shrink: 0;
}

/* ── Bottom row: outer boxes ────────────────────────────────────────────── */
.pwai-cf-bottom-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.pwai-cf-outer-box {
    border: 2px solid #1a2340;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fff;
}

.pwai-cf-bottom-spacer {
    width: 88px;
    flex-shrink: 0;
}

/* ── Inner dimension boxes ──────────────────────────────────────────────── */
.pwai-cf-inner-box {
    border: 2px solid #1a2340;
    padding: 0.65rem 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: #1a2340;
    line-height: 1.4;
    background: #fff;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Caption and source ─────────────────────────────────────────────────── */
.pwai-cf-caption {
    text-align: center;
    font-style: italic;
    font-size: 0.88rem;
    color: #1a2340;
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
}

.pwai-cf-source {
    text-align: center;
    font-size: 0.82rem;
    color: #475569;
    margin-top: 0;
}

/* ── Section headings ───────────────────────────────────────────────────── */
.pwai-cf-section-heading {
    font-family: var(--pwai-font-ui);
    font-size: 1rem;
    font-weight: 800;
    color: #1e3f7a;
    border-left: 4px solid var(--pwai-primary);
    padding-left: 0.7rem;
    margin: 1.75rem 0 0.75rem;
}

/* ── Framework description ──────────────────────────────────────────────── */
.pwai-cf-description p {
    font-family: Georgia, serif;
    font-size: 0.93rem;
    line-height: 1.8;
    color: #1a2340;
    text-align: justify;
    margin-bottom: 0.75rem;
}

/* ── Variable table ─────────────────────────────────────────────────────── */
.pwai-cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0.5rem 0 1rem;
}
.pwai-cf-table th {
    background: #1e3f7a;
    color: #fff;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 700;
}
.pwai-cf-table td {
    padding: 0.55rem 0.75rem;
    border: 1px solid #dde2ee;
    vertical-align: top;
    color: #1a2340;
    line-height: 1.5;
}
.pwai-cf-table tr:nth-child(even) td {
    background: #f8f9fc;
}

/* ── Hypotheses ─────────────────────────────────────────────────────────── */
.pwai-cf-hypotheses ol {
    padding-left: 1.25rem;
}
.pwai-cf-hypotheses li {
    font-family: Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #1a2340;
    margin-bottom: 0.5rem;
}

/* ── Print / download friendly ─────────────────────────────────────────── */
@media print {
    .pwai-cf-diagram {
        border: none;
        padding: 0;
    }
    .pwai-cf-var-box,
    .pwai-cf-inner-box,
    .pwai-cf-outer-box {
        border-color: #000 !important;
    }
    .pwai-cf-arrow { background: #000; }
    .pwai-cf-arrow::after { border-left-color: #000; }
    .pwai-cf-connector--left::before,
    .pwai-cf-connector--right::before { background: #000; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pwai-cf-top-row    { flex-direction: column; align-items: center; gap: 0.5rem; }
    .pwai-cf-arrow-wrap { transform: rotate(90deg); width: 60px; margin: 0.25rem 0; }
    .pwai-cf-connectors { display: none; }
    .pwai-cf-bottom-row { flex-direction: column; gap: 1rem; }
    .pwai-cf-bottom-spacer { display: none; }
    .pwai-cf-var-box    { max-width: 100%; min-width: unset; width: 100%; }
    .pwai-cf-outer-box  { width: 100%; }
}

/* ==========================================================================
   LAB SCIENTIST TOOLS — Output Styling
   Classes used by Chemistry, Biology, and Physics Lab Scientist outputs
   ========================================================================== */

/* Section and sub-section headings */
.pwai-lab-section {
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e3f7a;
    border-left: 4px solid #2F5DAA;
    padding-left: 0.75rem;
    margin: 1.75rem 0 0.6rem;
}
.pwai-lab-subsection {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a2340;
    margin: 1.2rem 0 0.4rem;
    padding-left: 0.5rem;
    border-left: 3px solid #c7d2fe;
}

/* Theory / definition blockquotes */
blockquote.pwai-lab-theory {
    background: #f0f4ff;
    border-left: 4px solid #4f46e5;
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-style: italic;
    color: #1e293b;
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Calculation blocks */
.pwai-lab-calculation {
    background: #0f172a;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    color: #e2e8f0;
    line-height: 1.8;
    overflow-x: auto;
}
.pwai-lab-calculation code,
.pwai-phys-formula,
.pwai-chem-formula,
.pwai-bio-formula {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    background: #1e293b;
    color: #93c5fd;
    padding: 1px 5px;
    border-radius: 4px;
}
.pwai-lab-calculation .pwai-phys-formula,
.pwai-lab-calculation .pwai-chem-formula,
.pwai-lab-calculation .pwai-bio-formula {
    background: transparent;
    color: #93c5fd;
    padding: 0;
}

/* Final answer box */
.pwai-lab-answer {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 2px solid #16a34a;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    font-size: 1rem;
    line-height: 1.6;
}
.pwai-lab-answer strong {
    color: #15803d;
    font-size: 1.05rem;
}

/* Safety / biosafety blocks */
.pwai-lab-safety {
    background: #fff7ed;
    border: 2px solid #f97316;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin: 0.75rem 0;
}
.pwai-lab-safety::before {
    content: '⚠️  Safety / Biosafety';
    display: block;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #c2410c;
    margin-bottom: 0.5rem;
}
.pwai-lab-safety p,
.pwai-lab-safety li {
    font-size: 0.88rem;
    color: #431407;
    line-height: 1.6;
}

/* Lab data tables */
.pwai-lab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 0.75rem 0 1rem;
    overflow-x: auto;
    display: block;
}
.pwai-lab-table th {
    background: #1e3f7a;
    color: #fff;
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
}
.pwai-lab-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dde2ee;
    vertical-align: top;
    color: #1a2340;
    line-height: 1.5;
}
.pwai-lab-table tr:nth-child(even) td {
    background: #f8fafc;
}

/* Diagram description blocks */
.pwai-lab-diagram {
    background: #f8f9fc;
    border: 1.5px dashed #94a3b8;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: #334155;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.6;
    margin: 0.75rem 0;
}

/* Field row for side-by-side selects in forms */
.pwai-tool-field-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0;
}
.pwai-tool-field-row > .pwai-tool-field {
    flex: 1;
    min-width: 180px;
}

@media (max-width: 600px) {
    .pwai-tool-field-row { flex-direction: column; }
    .pwai-lab-calculation { font-size: 0.78rem; padding: 0.75rem; }
}
