/* ============================================================
   CASE-TAKING QUESTIONNAIRE — Patient-facing styles
   Mobile-first, works on Chrome & Safari iOS/Android
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────── */
.ct-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1100;
    align-items: flex-end;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}
.ct-overlay.open {
    display: flex;
}
@media (min-width: 560px) {
    .ct-overlay {
        align-items: center;
    }
}

/* ── Modal shell ─────────────────────────────────────────── */
.ct-modal {
    background: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 32px rgba(0,0,0,.18);
    animation: ct-slide-up .28s ease;
}
@media (min-width: 560px) {
    .ct-modal {
        border-radius: 20px;
        max-height: 85vh;
        animation: ct-fade-in .22s ease;
    }
}
@keyframes ct-slide-up {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes ct-fade-in {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1);   }
}

/* ── Header ──────────────────────────────────────────────── */
.ct-header {
    padding: 1.1rem 1.25rem .75rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ct-header-left { display: flex; flex-direction: column; gap: .15rem; }
.ct-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}
.ct-subtitle {
    font-size: .78rem;
    color: #888;
    margin: 0;
}
.ct-close-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #555;
    -webkit-tap-highlight-color: transparent;
}
.ct-close-btn:active { background: #e0e0e0; }

/* ── Progress bar ────────────────────────────────────────── */
.ct-progress-wrap {
    padding: .5rem 1.25rem .35rem;
    flex-shrink: 0;
}
.ct-progress-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}
.ct-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    border-radius: 2px;
    transition: width .35s ease;
}
.ct-progress-label {
    font-size: .72rem;
    color: #aaa;
    margin-top: .3rem;
    text-align: right;
}

/* ── Scrollable body ─────────────────────────────────────── */
.ct-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.1rem 1.25rem 1.25rem;
}

/* ── Question ────────────────────────────────────────────── */
.ct-question-icon {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: .4rem;
}
.ct-question-text {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    margin: 0 0 .25rem;
    line-height: 1.4;
}
.ct-question-hint {
    font-size: .8rem;
    color: #888;
    text-align: center;
    margin: 0 0 1rem;
}

/* ── Single-select cards ─────────────────────────────────── */
.ct-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .65rem;
    margin-bottom: .5rem;
}
.ct-card {
    background: #f9f9f9;
    border: 2px solid #e8e8e8;
    border-radius: 14px;
    padding: .85rem .6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    min-height: 80px;
}
.ct-card:active { transform: scale(.97); }
.ct-card.selected {
    border-color: #4caf50;
    background: #e8f5e9;
}
.ct-card-icon { font-size: 1.6rem; line-height: 1; }
.ct-card-label {
    font-size: .8rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}
.ct-card.selected .ct-card-label { color: #2e7d32; }

/* ── Multi-select chips ──────────────────────────────────── */
.ct-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
}
.ct-chip {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: .45rem .9rem;
    font-size: .82rem;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: .3rem;
}
.ct-chip:active { transform: scale(.96); }
.ct-chip.selected {
    border-color: #4caf50;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

/* ── Severity slider ─────────────────────────────────────── */
.ct-slider-wrap { margin-bottom: .5rem; }
.ct-slider-emoji-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    margin-bottom: .4rem;
    padding: 0 .2rem;
}
.ct-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #4caf50 var(--pct,50%), #e0e0e0 var(--pct,50%));
    outline: none;
    cursor: pointer;
}
.ct-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 2px 6px rgba(76,175,80,.4);
    cursor: pointer;
}
.ct-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4caf50;
    border: none;
    cursor: pointer;
}
.ct-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: .72rem;
    color: #aaa;
    margin-top: .35rem;
    padding: 0 .2rem;
}
.ct-slider-value {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #4caf50;
    margin-top: .5rem;
}

/* ── Free text ───────────────────────────────────────────── */
.ct-textarea {
    width: 100%;
    min-height: 90px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: .75rem 1rem;
    font-size: 1rem; /* min 16px — prevents iOS auto-zoom */
    font-family: inherit;
    color: #333;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
    -webkit-appearance: none;
}
.ct-textarea:focus { border-color: #4caf50; }
.ct-optional-tag {
    font-size: .75rem;
    color: #aaa;
    margin-bottom: .4rem;
    display: block;
}

/* ── Footer ──────────────────────────────────────────────── */
.ct-footer {
    padding: .85rem 1.25rem 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    flex-shrink: 0;
}
.ct-btn-next {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: .85rem 1.5rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}
.ct-btn-next:active { transform: scale(.98); background: #43a047; }
.ct-btn-next:disabled { background: #ccc; cursor: not-allowed; }
.ct-btn-back {
    background: none;
    border: none;
    color: #888;
    font-size: .85rem;
    cursor: pointer;
    text-align: center;
    padding: .25rem;
    -webkit-tap-highlight-color: transparent;
}
.ct-btn-back:active { color: #555; }

/* ── Error / failure state ───────────────────────────────── */
.ct-error-state {
    text-align: center;
    padding: 1.5rem .5rem;
}
.ct-error-icon { font-size: 2.4rem; margin-bottom: .6rem; }
.ct-error-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 .35rem;
}
.ct-error-msg {
    font-size: .85rem;
    color: #888;
    margin: 0 0 1.25rem;
    line-height: 1.5;
}
.ct-error-actions {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: 300px;
    margin: 0 auto;
}
.ct-btn-retry {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: .75rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.ct-btn-callback {
    background: #fff3e0;
    color: #e65100;
    border: 2px solid #ffe0b2;
    border-radius: 12px;
    padding: .75rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.ct-btn-skip {
    background: none;
    border: none;
    color: #aaa;
    font-size: .8rem;
    cursor: pointer;
    padding: .25rem;
    -webkit-tap-highlight-color: transparent;
}
.ct-skip-note {
    font-size: .75rem;
    color: #bbb;
    text-align: center;
    margin-top: .2rem;
    line-height: 1.4;
}

/* ── Callback confirmation ───────────────────────────────── */
.ct-callback-confirm {
    text-align: center;
    padding: 1.5rem .5rem;
}
.ct-callback-icon { font-size: 2.4rem; margin-bottom: .6rem; }
.ct-callback-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2e7d32;
    margin: 0 0 .4rem;
}
.ct-callback-msg {
    font-size: .85rem;
    color: #666;
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

/* ── Booking modal & dashboard summary card ──────────────── */
.ct-booking-summary {
    margin-bottom: 1.1rem;
}
.ct-booking-summary--order {
    margin-top: .75rem;
    margin-bottom: 0;
}
.ct-sum-inner {
    background: #f0f7f0;
    border: 1.5px solid #c8e6c9;
    border-radius: 12px;
    padding: .75rem 1rem;
}
.ct-sum-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .45rem;
}
.ct-sum-title {
    font-size: .85rem;
    font-weight: 700;
    color: #2e7d32;
}
.ct-sum-edit-btn {
    background: none;
    border: 1.5px solid #4caf50;
    border-radius: 8px;
    color: #2e7d32;
    font-size: .78rem;
    font-weight: 600;
    padding: .2rem .6rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 30px;
}
.ct-sum-edit-btn:active { background: #e8f5e9; }
.ct-sum-locked {
    font-size: .75rem;
    color: #aaa;
    font-weight: 500;
}
.ct-sum-body {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.ct-sum-chip {
    background: #fff;
    border: 1px solid #c8e6c9;
    border-radius: 20px;
    padding: .2rem .65rem;
    font-size: .78rem;
    color: #333;
    line-height: 1.5;
}
.ct-sum-chip strong {
    color: #2e7d32;
    font-weight: 600;
}

/* ── Inline case-taking editor ───────────────────────────────────────────── */
.ct-inline-form {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    padding-top: .35rem;
}

.ct-inline-field {}

.ct-inline-label {
    font-size: .75rem;
    font-weight: 700;
    color: #555;
    margin: 0 0 .35rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Single / multi chips inside the inline editor */
.ct-inline-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.ct-inline-chip {
    background: #f5f5f5;
    border: 1.5px solid #e0e0e0;
    border-radius: 20px;
    padding: .3rem .7rem;
    font-size: .78rem;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    transition: border-color .12s, background .12s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.4;
}
.ct-inline-chip:active { transform: scale(.96); }
.ct-inline-chip.selected {
    border-color: #4caf50;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

/* Slider row */
.ct-inline-slider-wrap {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.ct-inline-slider-wrap .ct-slider { flex: 1; }
.ct-inline-slider-val {
    font-size: .82rem;
    font-weight: 700;
    color: #4caf50;
    white-space: nowrap;
    min-width: 36px;
    text-align: right;
}

/* Textarea */
.ct-inline-textarea {
    width: 100%;
    min-height: 70px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: .55rem .75rem;
    font-size: .88rem;
    font-family: inherit;
    color: #333;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
    -webkit-appearance: none;
}
.ct-inline-textarea:focus { border-color: #4caf50; }

/* Save button variant */
.ct-inline-save-btn {
    background: #4caf50 !important;
    color: #fff !important;
    border-color: #4caf50 !important;
}
.ct-inline-save-btn:active { background: #43a047 !important; }
