/**
 * CSU Health Connect - Form & Results Stylesheet
 * Brand colors: CSU Dark Green #004e49, Accent Green #009975, Dark #1e293b, Border #cbd5e1
 */

.csu-hc-wrapper {
    max-width: 860px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 78, 73, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    padding: 36px 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}

.csu-hc-wrapper * {
    box-sizing: border-box;
}

/* Header */
.csu-hc-header {
    text-align: center;
    margin-bottom: 32px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 24px;
}

.csu-hc-badge {
    display: inline-block;
    background: #e6f6f4;
    color: #004e49;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 9999px;
    margin-bottom: 12px;
}

.csu-hc-title {
    font-size: 26px;
    font-weight: 800;
    color: #004e49;
    margin: 0 0 10px 0;
    line-height: 1.25;
}

.csu-hc-subtitle {
    font-size: 14px;
    color: #64748b;
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Stepper Navigation */
.csu-hc-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    position: relative;
}

.csu-hc-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 2;
    cursor: pointer;
}

.csu-hc-step-item:hover .csu-hc-step-bubble {
    border-color: #004e49;
    transform: scale(1.06);
}

.csu-hc-step-bubble {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid #cbd5e1;
    transition: all 0.25s ease;
}

.csu-hc-step-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    transition: color 0.25s ease;
}

.csu-hc-step-item.active .csu-hc-step-bubble {
    background: #004e49;
    color: #ffffff;
    border-color: #004e49;
    box-shadow: 0 0 0 4px rgba(0, 78, 73, 0.18);
}

.csu-hc-step-item.active .csu-hc-step-label {
    color: #004e49;
    font-weight: 700;
}

.csu-hc-step-item.completed .csu-hc-step-bubble {
    background: #009975;
    color: #ffffff;
    border-color: #009975;
}

.csu-hc-step-item.completed .csu-hc-step-label {
    color: #009975;
}

.csu-hc-step-line {
    flex: 1;
    height: 3px;
    background: #e2e8f0;
    margin: 0 -8px 20px -8px;
    z-index: 1;
    transition: background 0.3s ease;
}

.csu-hc-step-line.active {
    background: #009975;
}

/* Steps Display */
.csu-hc-step {
    display: none;
    border: none;
    padding: 0;
    margin: 0;
    animation: csuFadeIn 0.35s ease;
}

.csu-hc-step.active {
    display: block;
}

@keyframes csuFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.csu-hc-step-title {
    display: block;
    width: 100%;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 24px;
}

.csu-hc-step-num {
    color: #009975;
    font-weight: 800;
    margin-right: 8px;
}

/* Form Groups & Labels */
.csu-form-group {
    margin-bottom: 28px;
}

.csu-label {
    display: block;
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.4;
}

.csu-label.required::after {
    content: " *";
    color: #ef4444;
}

.csu-sublabel {
    display: flex !important;
    align-items: flex-end !important;
    min-height: 36px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 8px !important;
    line-height: 1.35 !important;
}

.csu-help-text {
    font-size: 12.5px;
    color: #64748b;
    margin: -4px 0 12px 0;
    line-height: 1.4;
}

/* Standard Inputs - Locked Height & Vertical Alignment */
.csu-hc-wrapper input.csu-input,
.csu-input {
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    line-height: 46px !important;
    padding: 0 16px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 14.5px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    background: #f8fafc !important;
    box-sizing: border-box !important;
    display: block !important;
    vertical-align: middle !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: all 0.2s ease !important;
}

.csu-hc-wrapper input.csu-input:focus,
.csu-input:focus {
    outline: none !important;
    border-color: #004e49 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(0, 78, 73, 0.12) !important;
}

/* Date input specific WebKit alignment */
.csu-hc-wrapper input[type="date"].csu-input,
input[type="date"].csu-input {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 46px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.csu-hc-wrapper input[type="date"].csu-input::-webkit-date-and-time-value,
input[type="date"].csu-input::-webkit-date-and-time-value {
    text-align: left !important;
    line-height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.csu-hc-wrapper input[type="date"].csu-input::-webkit-datetime-edit,
input[type="date"].csu-input::-webkit-datetime-edit {
    line-height: 46px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Number input spinners alignment */
.csu-hc-wrapper input[type="number"].csu-input::-webkit-inner-spin-button,
.csu-hc-wrapper input[type="number"].csu-input::-webkit-outer-spin-button {
    height: 28px !important;
    margin: auto 0 !important;
}

/* Grid Layouts - Fixed Baseline Alignment */
.csu-grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
    align-items: flex-end !important;
}

.csu-grid-3 > div {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

@media (max-width: 640px) {
    .csu-grid-3 {
        grid-template-columns: 1fr !important;
    }
}

/* Radio & Checkbox Card Layouts */
.csu-radio-grid, .csu-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.csu-radio-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csu-radio-card, .csu-checkbox-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    transition: all 0.2s ease;
    user-select: none;
}

.csu-radio-card:hover, .csu-checkbox-card:hover {
    border-color: #009975;
    background: #f0fdf9;
}

.csu-radio-card input, .csu-checkbox-card input {
    accent-color: #004e49;
    width: 17px;
    height: 17px;
    margin: 0;
    cursor: pointer;
}

.csu-radio-card:has(input:checked), .csu-checkbox-card:has(input:checked),
.csu-radio-card.is-selected, .csu-checkbox-card.is-selected {
    background: #ecfdf5;
    border-color: #004e49;
    color: #004e49;
    font-weight: 600;
}

/* Sub-question Cards (es. Q7 A-F) */
.csu-subquestion-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
}

.csu-subq-title {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: #004e49;
    margin-bottom: 4px;
}

.csu-subq-desc {
    font-size: 13px;
    color: #475569;
    margin: 0 0 10px 0;
}

.csu-radio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
}

.csu-radio-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #334155;
}

.csu-radio-options input {
    accent-color: #004e49;
}

/* Conditional Boxes */
.csu-conditional-box {
    margin-top: 14px;
    padding: 16px;
    background: #f8fafc;
    border-left: 4px solid #009975;
    border-radius: 0 8px 8px 0;
}

/* Dynamic Live BMI Preview */
.csu-bmi-preview {
    margin-top: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.csu-bmi-val-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.csu-bmi-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.csu-bmi-num {
    font-size: 24px;
    font-weight: 800;
    color: #004e49;
}

.csu-bmi-unit {
    font-size: 12px;
    color: #64748b;
}

.csu-bmi-badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    background: #10b981;
    color: #ffffff;
}

/* Range Slider */
.csu-slider-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.csu-range-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    accent-color: #004e49;
}

.csu-slider-val {
    font-weight: 800;
    font-size: 15px;
    color: #004e49;
    min-width: 50px;
}

/* Actions & Buttons */
.csu-hc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.csu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.csu-btn-primary {
    background: #004e49;
    color: #ffffff;
    margin-left: auto;
}

.csu-btn-primary:hover {
    background: #003834;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 78, 73, 0.25);
}

.csu-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.csu-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.csu-btn-submit {
    background: #009975;
    color: #ffffff;
    margin-left: auto;
}

.csu-btn-submit:hover {
    background: #007f61;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 153, 117, 0.25);
}

/* Feedback & Messages */
.csu-hc-feedback {
    margin-top: 20px;
    padding: 18px 22px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
}

.csu-hc-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.csu-hc-feedback.loading {
    background: #f0fdf4;
    color: #004e49;
    border: 1.5px solid #86efac;
    box-shadow: 0 4px 16px rgba(0, 78, 73, 0.08);
}

.csu-loader-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0, 153, 117, 0.2);
    border-radius: 50%;
    border-top-color: #009975;
    animation: csuSpin 0.8s ease-in-out infinite;
    vertical-align: middle;
    margin-bottom: 6px;
}

@keyframes csuSpin {
    to { transform: rotate(360deg); }
}

.csu-btn.csu-loading-btn {
    opacity: 0.75;
    cursor: not-allowed !important;
    pointer-events: none;
    background: #004e49 !important;
}

/* Footer Note / Disclaimer */
.csu-hc-footer-note {
    margin-top: 36px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.5;
    border: 1px solid #e2e8f0;
}

.csu-hc-footer-note p {
    margin: 0 0 6px 0;
}

.csu-hc-footer-note p:last-child {
    margin-bottom: 0;
}

/* ===================================================
   RESULTS SCREEN STYLES
   =================================================== */
.csu-results-modal {
    animation: csuFadeIn 0.4s ease;
}

.csu-results-header {
    text-align: center;
    margin-bottom: 28px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 18px;
}

.csu-results-header h3 {
    font-size: 24px;
    font-weight: 800;
    color: #004e49;
    margin: 0 0 6px 0;
}

.csu-results-header p {
    font-size: 13.5px;
    color: #64748b;
    margin: 0;
}

.csu-global-score-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    margin-bottom: 28px;
}

.csu-score-circle {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #004e49;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 78, 73, 0.25);
}

.csu-score-number {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.csu-score-denom {
    font-size: 11px;
    opacity: 0.8;
}

.csu-score-band {
    font-size: 18px;
    font-weight: 800;
    color: #004e49;
    margin-bottom: 4px;
}

.csu-score-meta p {
    margin: 0;
    font-size: 13.5px;
    color: #475569;
    line-height: 1.4;
}

/* Domains Bars */
.csu-domain-row {
    margin-bottom: 16px;
}

.csu-domain-info {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

.csu-domain-bar-bg {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.csu-domain-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Red Flags Priority Box (DPO Management) */
.csu-redflags-box {
    margin-top: 28px;
    padding: 20px;
    background: #fff1f2;
    border: 1.5px solid #fecdd3;
    border-left: 5px solid #ef4444;
    border-radius: 10px;
}

.csu-redflags-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.csu-redflags-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #991b1b;
}

.csu-redflags-sub {
    font-size: 12.5px;
    color: #991b1b;
    margin: 0 0 14px 0;
    line-height: 1.45;
}

.csu-redflag-item {
    background: #ffffff;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
}

.csu-redflag-item:last-child {
    margin-bottom: 0;
}

.csu-redflag-title {
    font-size: 14px;
    font-weight: 800;
    color: #b91c1c;
    margin-bottom: 4px;
}

.csu-redflag-desc {
    font-size: 12.5px;
    color: #475569;
    margin-bottom: 6px;
}

.csu-redflag-rec {
    font-size: 12px;
    color: #004e49;
    background: #ecfdf5;
    padding: 6px 10px;
    border-radius: 6px;
}

/* Pathways & Orientation Cards */
.csu-pathways-box {
    margin-top: 32px;
}

.csu-pathways-box h4 {
    font-size: 17px;
    font-weight: 800;
    color: #004e49;
    margin: 0 0 6px 0;
}

.csu-pathways-sub {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 16px 0;
}

.csu-pathways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.csu-pathway-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.csu-pathway-card:hover {
    border-color: #009975;
    transform: translateY(-2px);
}

.csu-pathway-priority {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    margin-right: 8px;
}

.csu-pathway-area {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #004e49;
    background: #ecfdf5;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.csu-pathway-priority.alta {
    background: #fee2e2;
    color: #991b1b;
}

.csu-pathway-priority.moderata {
    background: #fef3c7;
    color: #92400e;
}

.csu-pathway-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #004e49;
    margin: 0 0 6px 0;
}

.csu-pathway-desc {
    font-size: 12.5px;
    color: #334155;
    margin: 0 0 8px 0;
    line-height: 1.45;
}

.csu-pathway-context {
    font-size: 11.5px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

.csu-results-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* AI Explanation Layer Styling */
.csu-ai-explanation-box {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 4px 14px rgba(0, 78, 73, 0.05);
}

.csu-ai-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.csu-ai-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.csu-ai-section h5 {
    color: #004e49;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 6px 0;
}

.csu-ai-section p {
    color: #334155;
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

.csu-ai-disclaimer {
    margin-top: 14px;
    padding: 10px 14px;
    background: #f8fafc;
    border-left: 3px solid #009975;
    border-radius: 0 8px 8px 0;
    font-size: 12px;
    color: #64748b;
    font-style: italic;
}

@media print {
    body * {
        visibility: hidden;
    }
    #csu-results-box, #csu-results-box * {
        visibility: visible;
    }
    #csu-results-box {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    .csu-results-actions {
        display: none !important;
    }
}

