/* gpt-assistant.css */

.ppc-vce-learning { margin: 0 0 14px; padding: 16px; background: #f8fbfd; border: 1px solid #c6d8e2; border-radius: 6px; }
.ppc-essay-toolbar { display: flex; gap: 8px; justify-content: flex-end; margin: 0 0 10px; }
.ppc-essay-toolbar button, .ppc-drawer-heading button { padding: 8px 12px; }
.ppc-drawer { position: fixed; z-index: 1000; top: 88px; right: 18px; width: min(520px, calc(100vw - 36px)); max-height: calc(100vh - 112px); overflow-y: auto; box-shadow: 0 12px 32px rgba(15, 35, 48, .24); }
.ppc-essay-setup-drawer { background: #fff; border: 1px solid #d7dee2; border-radius: 6px; padding: 14px; }
.ppc-drawer-heading { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 10px; }
.ppc-drawer-heading h2 { margin: 0; color: #173b52; }
.ppc-drawer-heading-actions { display: flex; align-items: center; gap: 12px; }
.ppc-vce-guidance { padding: 10px; background: #fff; border-left: 3px solid #5292a7; }
.ppc-vce-toolkit { padding: 12px; background: #eef5f8; border: 1px solid #d3e0e7; }
.ppc-vce-toolkit h3 { margin: 0 0 8px; color: #173b52; }
.ppc-vce-toolkit p { margin: 6px 0; }
.ppc-vce-pacing { border-top: 1px solid #d3e0e7; padding-top: 8px; }
.ppc-vce-learning-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.ppc-vce-learning h2 { margin: 0 0 6px; color: #173b52; }
.ppc-vce-learning p { margin: 6px 0 10px; }
.ppc-vce-kicker { color: #1f708b; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .82rem; }
.ppc-vce-block { margin-top: 10px; border: 1px solid #d3e0e7; background: #fff; border-radius: 4px; }
.ppc-vce-block summary { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; cursor: pointer; font-weight: 700; color: #173b52; }
.ppc-vce-block-status { color: #28704d; font-size: .9rem; }
.ppc-vce-block-body { padding: 0 12px 14px; }
.ppc-vce-example { padding: 10px; background: #f2f6f8; border-left: 3px solid #5292a7; margin: 10px 0; }
.ppc-vce-option { display: block; margin: 7px 0; }
.ppc-vce-short, .ppc-vce-long { display: block; width: 100%; min-height: 52px; margin: 5px 0 10px; box-sizing: border-box; }
.ppc-vce-long { min-height: 90px; }
.ppc-vce-test.is-error { color: #9b2c2c; }
.ppc-vce-complete { padding: 8px 12px; }
@media (max-width: 650px) {
    .ppc-vce-learning-heading { display: block; }
    .ppc-drawer { top: 72px; right: 10px; width: calc(100vw - 20px); max-height: calc(100vh - 84px); }
}

/* Drawer overrides must come after the legacy sticky essay-panel rules. */
#essay-task-panel.ppc-drawer,
#ppc-vce-section-a.ppc-drawer {
    display: block;
    position: fixed;
    top: 88px;
    right: 18px;
    left: auto;
    width: min(520px, calc(100vw - 36px));
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    z-index: 1000;
    margin: 0 !important;
    box-sizing: border-box;
    box-shadow: 0 12px 32px rgba(15, 35, 48, .24);
}
#essay-task-panel.ppc-drawer {
    grid-template-columns: 1fr;
    padding: 14px !important;
    top: 88px;
}
#essay-task-panel.ppc-drawer h2,
#ppc-vce-section-a.ppc-drawer h2 {
    font-size: 22px;
    line-height: 1.2;
}
#essay-task-panel.ppc-drawer[hidden],
#ppc-vce-section-a.ppc-drawer[hidden] {
    display: none !important;
}

#ppc-essay-understanding.ppc-drawer {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: auto;
    max-height: none;
    overflow: visible;
    margin: 0 0 14px;
    box-shadow: none;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #d7dee2;
    border-radius: 6px;
    padding: 14px;
}
@media (max-width: 760px) {
    #essay-task-panel.ppc-drawer,
    #ppc-vce-section-a.ppc-drawer {
        top: 72px;
        right: 10px;
        width: calc(100vw - 20px);
        max-height: calc(100vh - 84px);
    }
}

.ppc-essay-modes {
    margin: 0 0 14px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #c6d8e2;
    border-radius: 6px;
}

.ppc-essay-modes-heading h2,
.ppc-exam-panel-heading h2 {
    margin: 0;
    color: #173b52;
}

.ppc-essay-modes-heading p:last-child,
.ppc-exam-panel p {
    margin: 4px 0 10px;
}

.ppc-essay-mode-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 12px;
}

.ppc-essay-mode-button {
    min-width: 150px;
    font-weight: 700;
}

.ppc-essay-mode-button.is-active {
    background: #1f6f8b !important;
    color: #ffffff !important;
}

.ppc-pathway-panel {
    padding: 12px;
    background: #f2f6f8;
    border: 1px solid #d3e0e7;
    border-radius: 5px;
}

.ppc-pathway-title {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 10px;
    color: #173b52;
}

.ppc-pathway-title strong {
    font-size: 18px;
}

.ppc-route-map {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 22px 0 5px;
}

.ppc-route-stop {
    flex: 0 0 auto;
    position: relative;
    min-width: 90px;
    padding: 8px 10px;
    border: 2px solid #83aebd;
    border-radius: 999px;
    background: #ffffff;
    color: #173b52;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.ppc-section-complete {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    background: #f5f8fa;
    border-top: 1px solid #d3e0e7;
    color: #173b52;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
}

#gpt-chat-container #essay-task-panel .ppc-section-complete {
    grid-column: 1 / -1;
}

.ppc-understanding-check {
    display: grid;
    gap: 8px;
    margin: 14px 0;
    padding: 12px;
    border: 1px solid #c9dbe3;
    background: #f5f9fb;
}

.ppc-understanding-field {
    display: grid;
    gap: 6px;
    margin: 12px 0;
    color: #173b52;
    font-weight: 700;
}

.ppc-understanding-field textarea {
    width: 100%;
    min-height: 74px;
    padding: 8px;
    resize: vertical;
    box-sizing: border-box;
}

.ppc-understanding-feedback {
    margin-top: 12px;
    padding: 12px;
    border-left: 3px solid #6f8795;
    background: #f0f0f0;
}

.ppc-route-stop:hover,
.ppc-route-stop:focus-visible {
    border-color: #1f6f8b;
    background: #d9edf4;
}

.ppc-route-stop.is-start {
    border-color: #1f6f8b;
    background: #d9edf4;
}

.ppc-route-stop.is-current {
    transform: scale(1.08);
    position: relative;
    z-index: 1;
    border-color: #1f6f8b;
    background: #b9dce8;
    box-shadow: 0 0 0 3px rgba(31, 111, 139, .2);
}

.ppc-route-stop.is-complete::before {
    content: '✓ ';
    position: absolute;
    left: 50%;
    top: -18px;
    transform: translateX(-50%);
    color: #28704d;
    font-size: 16px;
    line-height: 1;
}

.ppc-route-stop.is-recommended {
    border-color: #b8791c;
    background: #fff0c7;
    box-shadow: 0 0 0 3px rgba(184, 121, 28, .18);
}

/* Pathway-map stops use their own visual language and must not inherit the
   page's generic light button styling. */
#gpt-chat-container .ppc-route-stop {
    background: #2c7a7b !important;
    border-color: #1d5b5c !important;
    color: #ffffff !important;
}

#gpt-chat-container .ppc-route-stop:hover,
#gpt-chat-container .ppc-route-stop:focus-visible {
    background: #236365 !important;
    border-color: #153f40 !important;
    color: #ffffff !important;
}

#gpt-chat-container .ppc-route-stop.is-complete {
    background: #e3f3e7 !important;
    border-color: #75ad87 !important;
    color: #245b35 !important;
}

#gpt-chat-container .ppc-route-stop.is-current {
    background: #f0a51a !important;
    border-color: #9a6200 !important;
    color: #173b52 !important;
}

#gpt-chat-container .ppc-route-stop.is-recommended {
    background: #f2d58d !important;
    border-color: #b8791c !important;
    color: #173b52 !important;
}

/* Completion is the stronger state: a completed recommended stop remains green. */
#gpt-chat-container .ppc-route-stop.is-complete.is-recommended {
    background: #e3f3e7 !important;
    border-color: #75ad87 !important;
    color: #245b35 !important;
    box-shadow: none !important;
}

/* Final pathway-map visual system: one active colour, neutral stops, and ticks for completion. */
#gpt-chat-container .ppc-route-stop,
#gpt-chat-container .ppc-route-stop.is-recommended,
#gpt-chat-container .ppc-route-stop.is-complete,
#gpt-chat-container .ppc-route-stop.is-complete.is-recommended {
    background: #ffffff !important;
    border-color: #2c6f8f !important;
    color: #173b52 !important;
    box-shadow: none !important;
}

#gpt-chat-container .ppc-route-stop:hover,
#gpt-chat-container .ppc-route-stop:focus-visible {
    background: #eaf4f8 !important;
    border-color: #1f5875 !important;
    color: #173b52 !important;
}

#gpt-chat-container .ppc-route-stop.is-current {
    background: #173b52 !important;
    border-color: #173b52 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(23, 59, 82, .18) !important;
}

.ppc-route-line {
    flex: 1 0 18px;
    height: 3px;
    min-width: 18px;
    background: #83aebd;
}

.ppc-route-map-vertical {
    display: grid;
    grid-template-columns: minmax(150px, 280px);
    justify-content: start;
    gap: 0;
    overflow: visible;
}

.ppc-route-map-vertical .ppc-route-line {
    width: 3px;
    height: 12px;
    min-width: 3px;
    margin-left: 22px;
}

.ppc-exam-panel {
    margin: 0 0 14px;
    padding: 16px;
    background: #fff8df;
    border: 1px solid #e4c979;
    border-radius: 6px;
}

.ppc-exam-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#ppc-exam-timer {
    min-width: 78px;
    padding: 8px 10px;
    border: 1px solid #bd9b38;
    border-radius: 5px;
    background: #ffffff;
    color: #173b52;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

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

#essay-container.ppc-exam-active .ppc-essay-toolbar,
#essay-container.ppc-exam-active #ppc-essay-modes,
#essay-container.ppc-exam-active #essay-task-panel,
#essay-container.ppc-exam-active #essay-outline,
#essay-container.ppc-exam-active .ppc-essay-support,
#essay-container.ppc-exam-active #ppc-vce-section-a {
    display: none !important;
}

#essay-container.ppc-exam-active #essay-paragraphs,
#essay-container.ppc-exam-active .ppc-draft-heading,
#essay-container.ppc-exam-active > div:last-child {
    display: block !important;
}

#essay-container.ppc-exam-not-started .ppc-draft-heading,
#essay-container.ppc-exam-not-started #essay-paragraphs,
#essay-container.ppc-exam-not-started > div:last-child {
    display: none !important;
}

#essay-container.ppc-exam-active .ppc-return-to-map {
    display: none !important;
}

@media (max-width: 760px) {
    .ppc-pathway-title,
    .ppc-exam-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .ppc-route-map {
        align-items: flex-start;
    }
}

.ppc-public-offer {
    font-family: 'Roboto', sans-serif;
    color: #17211f;
    background: #fbfaf6;
}
.ppc-offer-hero {
    padding: clamp(48px, 8vw, 96px) clamp(18px, 5vw, 64px);
    background: linear-gradient(135deg, #f7fbf8 0%, #e7f4ef 100%);
    border-bottom: 1px solid #dfe7e1;
}
.ppc-eyebrow {
    margin: 0 0 14px;
    color: #0f766e;
    font-weight: 800;
}
.ppc-offer-hero h1 {
    max-width: 850px;
    margin: 0;
    font-size: clamp(34px, 6vw, 68px);
    line-height: 1.02;
}
.ppc-hero-copy {
    max-width: 720px;
    margin: 22px 0 0;
    color: #4f625d;
    font-size: 20px;
    line-height: 1.65;
}
.ppc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}
.ppc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 13px 20px;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
}
.ppc-primary {
    color: #fff;
    background: #0f766e;
}
.ppc-secondary {
    color: #0a4f49;
    background: #fff;
    border: 1px solid #cad8d2;
}
.ppc-offer-section {
    padding: clamp(44px, 7vw, 78px) clamp(18px, 5vw, 64px);
}
.ppc-offer-section h2 {
    max-width: 760px;
    margin: 0 0 26px;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.08;
}
.ppc-price-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.ppc-price-card {
    padding: 24px;
    background: #fff;
    border: 1px solid #dfe7e1;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(23, 33, 31, 0.07);
}
.ppc-price-card h3 {
    margin: 0 0 10px;
}
.ppc-price-card p,
.ppc-price-card li {
    color: #60706b;
    line-height: 1.58;
}
.ppc-price {
    margin: 0 0 12px;
    color: #0a4f49 !important;
    font-size: 32px;
    font-weight: 900;
}
.ppc-featured {
    border-color: #0f766e;
    box-shadow: 0 18px 44px rgba(15, 118, 110, 0.16);
}
.ppc-how {
    background: #123a35;
    color: #fff;
}
.ppc-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}
.ppc-steps div {
    min-height: 118px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
}
.ppc-steps strong,
.ppc-steps span {
    display: block;
}
.ppc-steps span {
    margin-top: 8px;
    color: #cfe7df;
}

@media (max-width: 860px) {
    .ppc-price-grid,
    .ppc-steps {
        grid-template-columns: 1fr;
    }
}

/* General button styles for a modern, minimalist look */
#gpt-chat-container button,
#gpt-login-container button,
#gpt-register-parent-container button,
#gpt-register-child-container button,
#gpt-parent-dashboard button {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #E3F0FA;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
#gpt-chat-container button:hover,
#gpt-login-container button:hover,
#gpt-register-parent-container button:hover,
#gpt-register-child-container button:hover,
#gpt-parent-dashboard button:hover {
    background-color: #C6E0F5;
    transform: translateY(-1px);
}
#gpt-chat-container button:active,
#gpt-login-container button:active,
#gpt-register-parent-container button:active,
#gpt-register-child-container button:active,
#gpt-parent-dashboard button:active {
    transform: translateY(0);
}

/* Login and registration form styles */
#gpt-login-container h2, #gpt-login-container h3,
#gpt-register-parent-container h2,
#gpt-register-child-container h2 {
    font-family: 'Roboto', sans-serif;
    color: #333;
}
#gpt-login-container form,
#gpt-register-parent-container form,
#gpt-register-child-container form {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
#gpt-login-container input[type="email"],
#gpt-login-container input[type="password"],
#gpt-login-container input[type="text"],
#gpt-register-parent-container input[type="text"],
#gpt-register-parent-container input[type="email"],
#gpt-register-parent-container input[type="password"],
#gpt-register-child-container input[type="text"],
#gpt-register-child-container input[type="password"] {
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
#gpt-login-container label,
#gpt-register-parent-container label,
#gpt-register-child-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

/* Styles from the original inline CSS in gpt-assistant.php */
.tab {
    padding: 5px 10px;
    margin-right: 5px;
    cursor: pointer;
}
.tab.active {
    background: #ddd;
}
.interface {
    display: none;
}
.interface.active {
    display: flex;
}
.paragraph-section {
    position: relative;
}
.text-window {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    padding: 5px;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 14px;
    box-sizing: border-box;
    border: 1px solid #000;
}
.grade-window {
    position: absolute;
    width: 40px;
    text-align: center;
    display: none;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    background: #fff;
    border: 1px solid #ccc;
    padding: 2px;
    font-size: 12px;
}
#gpt-response p, #gpt-response div {
    margin-bottom: 16px;
}
#gpt-response pre {
    font-family: monospace;
    white-space: pre-wrap;
}
#gpt-response img.graph-image {
    max-width: 100%;
    height: auto;
    margin-top: 10px;
}
#pdf-viewer canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
    image-rendering: pixelated;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    outline: none;
}
#pdf-viewer .text-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0;
    line-height: 1.0;
}
#pdf-viewer .text-layer span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
}
#adjust-sharpness {
    padding: 5px 10px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 4px;
}
#sharpness-options {
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#sharpness-options button {
    display: block;
    margin: 5px 0;
    padding: 5px 10px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 4px;
}

/* Essay Coach layout */
#gpt-chat-container {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    gap: 20px;
    box-sizing: border-box;
    min-height: calc(100vh - 220px) !important;
    padding-top: 0 !important;
}

#gpt-chat-container,
#gpt-chat-container * {
    letter-spacing: 0 !important;
}

.ppc-tool-main {
    min-width: 0;
    max-width: none !important;
    position: relative;
    width: 100% !important;
}

#dropdown-container.ppc-hidden-controls {
    display: none !important;
}

.ppc-control-label {
    color: #30454b;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

#dropdown-container select {
    min-height: 46px;
    padding: 8px 36px 8px 12px !important;
    border: 1px solid #b6c1c7;
    border-radius: 4px;
    background-color: #ffffff;
    color: #263b42;
    font-size: 16px !important;
    line-height: 1.2;
    width: 100% !important;
}

.ppc-practice-hero {
    background: #ffffff !important;
    border: 1px solid #d8e0e4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-sizing: border-box;
    min-height: 56px;
    padding: 12px 20px;
    margin-bottom: 0;
    position: sticky;
    top: 76px;
    width: 100%;
    z-index: 125;
    box-shadow: 0 1px 0 #d8e0e4;
}

.ppc-practice-hero::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 62px;
    height: 14px;
    background: #dfe7ea;
    pointer-events: none;
    z-index: 122;
}

.ppc-practice-title-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex: 0 0 auto;
}

.ppc-practice-hero h1 {
    font-size: 26px;
    line-height: 1.1;
    margin: 0;
    white-space: nowrap;
}

.ppc-learning-cycle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    color: #40575f;
    font-size: 14px;
    font-weight: 700;
}

.ppc-learning-cycle span {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    padding: 0;
}

#mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0 !important;
    position: sticky;
    top: 133px;
    z-index: 124;
    padding: 6px 0;
    width: 100%;
    background: #dfe7ea !important;
    box-shadow: 0 1px 0 #cdd8dd;
}

#gpt-chat-container button.tab,
#gpt-chat-container #submit-essay,
#gpt-chat-container #revise-essay,
#gpt-chat-container #clear-essay {
    min-height: 36px;
    padding: 8px 14px !important;
    line-height: 1.2;
    white-space: nowrap;
}

#gpt-chat-container button.tab {
    background: #f6fbff;
    border: 1px solid #bdd2df;
    color: #1f3b49;
    font-weight: 700;
}

#gpt-chat-container button.tab.active {
    background: #1f6f8b;
    border-color: #1f6f8b;
    color: #ffffff;
}

#gpt-response {
    border: 1px solid #d8e0e4;
    border-radius: 6px;
    min-height: 380px !important;
}

#gpt-prompt-form {
    background: #ffffff;
    border: 1px solid #d8e0e4;
    border-radius: 6px;
    padding: 12px;
}

#gpt-prompt-form label {
    font-weight: 700;
}

#gpt-prompt-form textarea {
    border: 1px solid #b6c1c7;
    border-radius: 4px;
    line-height: 1.45;
}

#essay-task-panel {
    background: #ffffff !important;
    display: grid;
    grid-template-columns: 135px 240px minmax(0, 1fr);
    gap: 6px 12px;
    padding: 8px 10px !important;
    position: sticky;
    top: 183px;
    z-index: 123;
    margin-bottom: 12px !important;
    box-shadow: 0 10px 14px rgba(31, 59, 73, 0.12);
}

#essay-task-panel label {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
}

#essay-task-panel input,
#essay-task-panel select,
#essay-task-panel textarea,
#essay-paragraphs textarea {
    box-sizing: border-box;
    border: 1px solid #b6c1c7;
    border-radius: 4px;
    font-size: 16px !important;
    line-height: 1.45;
}

#essay-task-panel select {
    min-height: 34px;
    background: #ffffff;
    color: #263b42;
}

#essay-task-panel .ppc-essay-field {
    min-width: 0;
}

#essay-task-panel .ppc-essay-question-field {
    grid-column: auto;
}

.ppc-essay-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#gpt-chat-container #generate-essay-question {
    min-height: 30px;
    padding: 5px 10px !important;
    background: #f6fbff;
    border: 1px solid #bdd2df;
    color: #1f3b49;
    font-weight: 700;
}

#essay-task-panel #essay-task-title {
    min-height: 34px;
}

#essay-task-panel #essay-prompt {
    min-height: 42px !important;
}

#essay-task-panel #essay-success-criteria,
#essay-task-panel #essay-model-paragraph {
    min-height: 70px !important;
}

#essay-task-panel .ppc-demo-feedback-option {
    grid-column: span 3;
}

.ppc-essay-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.ppc-question-actions {
    grid-column: 1 / -1;
    margin-top: 2px;
}

.ppc-outline-actions-footer {
    margin-top: 8px;
}

.ppc-outline-feedback-actions {
    display: flex;
    gap: 8px;
    margin-right: auto;
}

.ppc-plan-feedback {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f0f0f0;
    border: 1px solid #bddfc7;
    border-radius: 4px;
}

.ppc-plan-feedback h3 {
    margin: 0 0 6px;
    color: #173b52;
}

.ppc-plan-feedback p {
    margin: 5px 0;
}

.ppc-essay-support {
    background: #ffffff;
    border: 1px solid #d7dee2;
    border-radius: 6px;
    margin: 10px 0;
    padding: 8px 10px;
}

.ppc-essay-support summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #1f3b49;
    font-weight: 800;
}

.ppc-essay-support .ppc-hide-support {
    min-width: 54px;
    min-height: 26px;
    padding: 3px 8px !important;
    background: #f6fbff;
    border: 1px solid #bdd2df;
    color: #1f3b49;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1.2;
}

.ppc-essay-support textarea {
    box-sizing: border-box;
    border: 1px solid #b6c1c7;
    border-radius: 4px;
    font-size: 16px !important;
    line-height: 1.45;
}

.ppc-essay-support.ppc-support-collapsed {
    padding: 6px 10px;
}

.ppc-essay-support.ppc-support-collapsed textarea {
    display: none !important;
}

#essay-task-panel .ppc-demo-feedback-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f6faf8;
    border: 1px solid #cbded6;
    border-radius: 4px;
    color: #2f4a43;
    font-weight: 600;
}

#essay-task-panel .ppc-demo-feedback-option input {
    width: 18px;
    height: 18px;
    min-height: 0;
}

#essay-paragraphs {
    overflow: visible !important;
    padding: 0 !important;
}

#essay-container.ppc-support-hidden #essay-paragraphs {
    padding-top: 14px !important;
}

#essay-paragraphs .paragraph-section {
    border: 2px solid transparent;
    border-radius: 6px;
    margin-bottom: 18px !important;
    padding: 6px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#essay-paragraphs .paragraph-section.ppc-paragraph-active {
    background: #f7fbff;
    border-color: #1f6f8b;
    box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.14);
}

#essay-paragraphs .paragraph-section > div:first-child {
    display: grid !important;
    grid-template-columns: 36px minmax(0, 1fr) 86px;
    align-items: start !important;
    gap: 10px;
}

#essay-paragraphs .paragraph-section span {
    padding-top: 13px;
    text-align: right;
}

#essay-paragraphs .essay-feedback {
    background: #f0f0f0;
    margin-top: 10px;
    padding: 10px;
}

#essay-paragraphs textarea.essay-input {
    width: 100% !important;
    min-height: 92px !important;
    margin-right: 0 !important;
    resize: vertical;
}

#essay-paragraphs .paragraph-section button {
    width: 82px;
    min-height: 32px;
    padding: 5px 8px !important;
    margin-bottom: 6px;
    white-space: normal;
}

#essay-container > div:last-child {
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px !important;
}

.ppc-essay-primary-actions,
.ppc-essay-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#gpt-chat-container .ppc-essay-export-actions button {
    min-height: 36px;
    padding: 8px 12px !important;
}

.ppc-progress {
    color: #24373d;
    font-family: 'Roboto', sans-serif;
    margin: 24px auto;
    max-width: 1040px;
}

.ppc-progress-card {
    background: #ffffff;
    border: 1px solid #d7dee2;
    border-radius: 6px;
    margin: 18px 0;
    padding: 18px;
}

.ppc-progress-card-header {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.ppc-progress-card h3 {
    margin: 0 0 8px;
}

.ppc-progress-downloads,
.ppc-progress-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ppc-progress-downloads a,
.ppc-progress-scores span {
    background: #f6fbff;
    border: 1px solid #bdd2df;
    border-radius: 4px;
    color: #1f3b49;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 9px;
    text-decoration: none;
}

.ppc-progress-essay,
.ppc-progress-feedback {
    background: #f8fafb;
    border: 1px solid #e1e8eb;
    border-radius: 6px;
    margin-top: 12px;
    padding: 10px 12px;
}

.ppc-progress-essay summary,
.ppc-progress-feedback summary {
    cursor: pointer;
    font-weight: 800;
}

.ppc-progress-paragraph,
.ppc-progress-paragraph-feedback {
    border-top: 1px solid #e1e8eb;
    margin-top: 10px;
    padding-top: 10px;
}

.ppc-progress-paragraph p,
.ppc-progress-paragraph-feedback p {
    margin: 6px 0;
}

#workbook-container {
    padding-top: 14px;
}

#pdf-upload {
    box-sizing: border-box;
    display: block;
    width: min(420px, 100%);
    min-height: 42px;
    padding: 8px 10px;
    margin: 0 0 12px !important;
    background: #ffffff;
    border: 1px solid #b6c1c7;
    border-radius: 4px;
    color: #1f3b49;
    font-size: 16px;
}

.ppc-essay-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
}

.ppc-inline-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #c8d7e8;
    border-top-color: #2b6cb0;
    border-radius: 50%;
    flex: 0 0 auto;
    animation: ppc-spin 0.8s linear infinite;
}

@keyframes ppc-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    #gpt-chat-container {
        width: 100%;
        flex-direction: column !important;
        padding: 14px !important;
    }

    #dropdown-container {
        display: none !important;
    }

    .ppc-practice-hero h1 {
        font-size: 26px;
    }

    #essay-task-panel {
        grid-template-columns: 1fr;
    }

    #essay-task-panel .ppc-essay-question-field,
    #essay-task-panel .ppc-essay-support,
    #essay-task-panel .ppc-demo-feedback-option {
        grid-column: span 1;
    }

    .ppc-essay-label-row {
        align-items: flex-start;
        flex-direction: column;
    }

    #essay-paragraphs .paragraph-section > div:first-child {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    #essay-paragraphs .paragraph-section > div:first-child > div {
        grid-column: 2;
        flex-direction: row !important;
    }

    .ppc-progress-card-header {
        flex-direction: column;
    }
}

body:not(.admin-bar) .site-header,
body:not(.admin-bar) #masthead,
body:not(.admin-bar) .main-header-bar,
body:not(.admin-bar) .ast-primary-header-bar {
    top: 0;
}

.site-header,
#masthead,
.main-header-bar,
.ast-primary-header-bar {
    background: #ffffff !important;
    position: sticky !important;
    z-index: 9990;
    box-shadow: 0 1px 0 #d8e0e4;
}

body.admin-bar .site-header,
body.admin-bar #masthead,
body.admin-bar .main-header-bar,
body.admin-bar .ast-primary-header-bar {
    top: 32px;
}

body.admin-bar .ppc-practice-hero {
    top: 108px;
}

body.admin-bar .ppc-practice-hero::before {
    top: 94px;
}

body.admin-bar #mode-tabs {
    top: 165px;
}

body.admin-bar #essay-task-panel {
    top: 215px;
}

@media (max-width: 782px) {
    body.admin-bar .site-header,
    body.admin-bar #masthead,
    body.admin-bar .main-header-bar,
    body.admin-bar .ast-primary-header-bar {
        top: 46px;
    }

    body.admin-bar .ppc-practice-hero {
        top: 122px;
    }

    body.admin-bar .ppc-practice-hero::before {
        top: 108px;
    }

    body.admin-bar #mode-tabs {
        top: 179px;
    }

    body.admin-bar #essay-task-panel {
        top: 229px;
    }
}

/* PDF controls container */
#pdf-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* Scale container */
#scale-container, #popup-scale-container {
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10001;
}
#scale-minus, #scale-plus, #popup-scale-minus, #popup-scale-plus {
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1;
}
#scale-display, #popup-scale-display {
    padding: 8px 16px;
    background-color: #E3F0FA;
    border-radius: 4px;
    cursor: default;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    width: 90px; /* Increased width for better readability */
    text-align: center;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* PDF viewer containers */
#pdf-viewer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#pdf-viewer {
    width: 100%;
    max-width: 800px;
    max-height: 87.5vh;
    min-height: 200px;
    overflow: auto;
    position: relative;
    z-index: 1;
    border: 2px solid #000;
    resize: both;
    box-sizing: border-box;
    flex: 1 1 auto;
}
#popup-pdf-viewer {
    width: 100%;
    height: calc(100vh - 60px); /* Adjusted for control bar */
    overflow-y: auto;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}
.page-container {
    position: relative;
    margin-bottom: 10px;
    display: block;
    width: 100%;
    margin: 0 auto;
}

/* Modal styles */
.pdf-modal {
    display: none;
    position: fixed;
    z-index: 10002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh; /* Ensure full height on all devices */
    background-color: rgba(0,0,0,0.4);
    overflow: hidden; /* Prevent modal itself from scrolling */
}
.pdf-modal-content {
    background-color: #fefefe;
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    height: 100vh; /* Full height */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    margin-top: 60px; /* Space for the control bar, adjusted dynamically */
}
.pdf-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10003;
}
.pdf-modal-close:hover,
.pdf-modal-close:focus {
    color: black;
    text-decoration: none;
}
#popup-pdf-controls {
    padding: 10px;
    background: #ffffff;
    z-index: 10004; /* Increased to ensure above admin bar */
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding-top: 10px; /* Extra padding for mobile browser toolbars */
}

/* Final page-shell layout: keep the mode navigation in normal flow directly
 * below the site header so it cannot cover essay controls while scrolling. */
#gpt-chat-container {
    margin-top: 0 !important;
    padding: 0 20px 20px !important;
}

#gpt-chat-container #mode-tabs {
    position: relative !important;
    top: auto !important;
    z-index: 10 !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#gpt-chat-container .ppc-essay-toolbar {
    position: relative;
    z-index: 11;
    margin: 0 0 12px;
}

/* Setup uses the full content width but stays in normal flow, so writing
 * paragraphs remain visible below it instead of being covered by a drawer. */
#gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel.ppc-drawer {
    display: grid !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 0 14px !important;
    box-shadow: none !important;
    background: #fff8df !important;
    grid-template-columns: minmax(150px, 0.7fr) minmax(200px, 1fr) minmax(280px, 2fr) !important;
}

#gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel .ppc-essay-question-field,
#gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel .ppc-essay-support,
#gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel .ppc-demo-feedback-option {
    grid-column: 1 / -1;
}

#gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel .ppc-drawer-heading {
    grid-column: 1 / -1;
}

#gpt-chat-container .ppc-essay-support summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: default;
}

#gpt-chat-container .ppc-close-support {
    flex: 0 0 auto;
    padding: 7px 12px;
}

/* Learning is a separate full-workspace state; the essay remains intact but
 * its writing controls are temporarily removed from view. */
#gpt-chat-container #essay-container.ppc-vce-learning-open #ppc-vce-section-a.ppc-drawer {
    display: block !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    box-shadow: none !important;
}

#gpt-chat-container #essay-container.ppc-vce-learning-open #essay-task-panel,
#gpt-chat-container #essay-container.ppc-vce-learning-open .ppc-essay-support,
#gpt-chat-container #essay-container.ppc-vce-learning-open #essay-overall-feedback,
#gpt-chat-container #essay-container.ppc-vce-learning-open #essay-outline,
#gpt-chat-container #essay-container.ppc-vce-learning-open #essay-paragraphs,
#gpt-chat-container #essay-container.ppc-vce-learning-open > div:last-child {
    display: none !important;
}

.ppc-toggle-support[aria-expanded="false"] {
    opacity: .9;
}

.ppc-essay-outline {
    margin: 0 0 14px;
    padding: 12px;
    background: #eef7f1;
    border: 1px solid #c6d8e2;
    border-radius: 6px;
}

.ppc-draft-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 0;
    padding: 10px 12px;
    border-left: 4px solid #1f6f8b;
    background: #ffffff;
    color: #173b52;
    font-size: 22px;
}

.ppc-draft-heading h2 {
    margin: 0;
    font-size: inherit;
    color: inherit;
}

#gpt-chat-container .ppc-outline-heading h2,
#gpt-chat-container .ppc-draft-heading h2,
#gpt-chat-container .ppc-essay-support summary span {
    font-size: 22px;
}

.ppc-return-to-map {
    flex: 0 0 auto;
    padding: 6px 10px !important;
    background: #e8f0f5 !important;
    border: 1px solid #7ea7b8 !important;
    color: #173b52 !important;
    font-size: 13px;
    font-weight: 700;
}

#gpt-chat-container #essay-paragraphs {
    background: #ffffff !important;
    border: 0 !important;
    border-radius: 6px;
    margin: 0 !important;
    padding-top: 0 !important;
}

#gpt-chat-container .ppc-draft-heading {
    margin-bottom: 0 !important;
}

#gpt-chat-container .ppc-draft-heading + #essay-overall-feedback {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

#gpt-chat-container #essay-paragraphs .paragraph-section:first-child {
    margin-top: 0 !important;
}

.ppc-outline-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.ppc-outline-heading button {
    flex: 0 0 auto;
    padding: 7px 12px;
}

.ppc-outline-heading h2 {
    margin: 0;
    color: #173b52;
    font-size: 20px;
}

.ppc-outline-heading p {
    margin: 2px 0 0;
}

.outline-section {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
}

/* Final heading sizes: these rules intentionally come after the legacy
   outline styles so the major learning sections share one visual hierarchy. */
#gpt-chat-container .ppc-outline-heading h2,
#gpt-chat-container .ppc-draft-heading h2,
#gpt-chat-container .ppc-essay-support summary span {
    font-size: 24px !important;
    line-height: 1.2 !important;
}

#gpt-chat-container .ppc-drawer-heading h2,
#gpt-chat-container .ppc-outline-heading h2,
#gpt-chat-container .ppc-draft-heading h2,
#gpt-chat-container .ppc-essay-support summary span {
    font-size: 28px !important;
    line-height: 1.2 !important;
}

.ppc-outline-label {
    font-weight: 700;
    color: #30454b;
}

.outline-input {
    width: 100%;
    min-height: 34px;
    height: 34px;
    box-sizing: border-box;
    padding: 6px 8px;
    resize: vertical;
}

.outline-actions {
    display: flex;
    gap: 3px;
}

.outline-feedback {
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 3px;
    padding: 7px 9px;
    background: #f0f0f0;
    border-left: 3px solid #6aa982;
}

.outline-feedback p {
    margin: 3px 0;
}

.outline-actions button {
    padding: 5px 7px !important;
    min-height: 30px !important;
}

@media (max-width: 760px) {
    .ppc-outline-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .outline-section {
        grid-template-columns: 28px minmax(0, 1fr);
    }

    .outline-actions {
        grid-column: 2;
    }
}

/* Setup and Section A remain contextual panels, never sticky page content. */
#gpt-chat-container #essay-task-panel.ppc-drawer,
#gpt-chat-container #ppc-vce-section-a.ppc-drawer {
    position: fixed !important;
    top: 88px !important;
    z-index: 1000 !important;
}

@media (max-width: 760px) {
    #gpt-chat-container {
        padding: 0 14px 14px !important;
    }

    #gpt-chat-container #essay-task-panel.ppc-drawer,
    #gpt-chat-container #ppc-vce-section-a.ppc-drawer {
        top: 72px !important;
    }

    #gpt-chat-container #essay-container.ppc-essay-setup-open #essay-task-panel.ppc-drawer {
        grid-template-columns: 1fr !important;
    }
}
