:root {
    /* The brand tokens (main.css), not the step's own purples. */
    --theme-purple-dark: var(--apns-primary-dark, #4C006D);
    --theme-purple: var(--apns-primary, #6A3F8F);
    --theme-purple-light: #F0E9FF;
    --theme-purple-lighter: var(--apns-panel, #FAF7FD);
    --theme-text: var(--apns-text, #1F1B24);
    --theme-danger: var(--apns-danger-text, #B02A37);
}

* {
    box-sizing: border-box;
}

.patient-info-wrapper .card-header-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-purple-dark);
    margin-bottom: 18px;
}
.patient-info-wrapper .card-header-custom i {
    font-size: 22px;
    color: var(--theme-purple);
}
.patient-info-wrapper .card-header-custom h4 {
    margin: 0;
    font-weight: 700;
    font-size: clamp(18px, 4vw, 22px);
}

/* The forms, the checkbox and the signature are part of the page and
   scroll with it. appointment.css gives this box "height: 100vh" and a
   scrollbar of its own, which hid the signature and Continue below an
   inner scroll on phones (walkthrough re-check, Sep 28, 2026). */
.appointment-wrapper .consent-scroll-bar,
.consent-scroll-bar {
    height: auto;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}
.consent-scroll-bar::-webkit-scrollbar {
    width: 6px;
}
.consent-scroll-bar::-webkit-scrollbar-thumb {
    background: var(--theme-purple-light);
    border-radius: 10px;
}

/* Policy link card */
.policy-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--theme-purple-lighter);
    border: 1px solid var(--theme-purple-light);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.policy-link-card .policy-text {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--theme-text);
    min-width: 200px;
    flex: 1 1 240px;
}
.policy-link-card .policy-text i {
    font-size: 20px;
    color: var(--theme-purple);
    margin-top: 2px;
    flex-shrink: 0;
}
.policy-link-card .policy-text strong {
    display: block;
    font-size: 16px;
    word-break: break-word;
}
.policy-link-card .policy-text span {
    font-size: 16px;
    color: #6b5e85;
}
.policy-link-card .btn-view-policy {
    white-space: nowrap;
    background: var(--theme-purple);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    min-height: 48px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.policy-link-card .btn-view-policy:hover,
.policy-link-card .btn-view-policy:active {
    background: var(--theme-purple-dark);
    color: #fff;
}

/* Signature / detail fields card */
.signature-detail-card {
    background: #fff;
    border: 1px solid var(--theme-purple-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.signature-detail-card .form-label {
    color: var(--theme-text);
    font-weight: 600;
    font-size: 16px;
}
.signature-detail-card .custom-input {
    border-radius: 8px;
    border: 1px solid #ddd2ef;
    padding: 10px 14px;
    width: 100%;
    font-size: 16px; /* prevents iOS zoom-on-focus */
}
.signature-detail-card .custom-input:focus {
    border-color: var(--theme-purple);
    box-shadow: 0 0 0 3px var(--theme-purple-light);
    outline: none;
}
.signature-detail-card .custom-input[readonly] {
    background: var(--theme-purple-lighter);
    border: 1px solid var(--theme-purple-light);
    color: var(--theme-purple-dark);
    font-weight: 600;
    cursor: default;
}
.signature-detail-card .label-with-icon {
    display: flex;
    align-items: center;
    gap: 6px;
}
.signature-detail-card .label-with-icon i {
    font-size: 16px;
    color: var(--theme-purple);
}

/* Behavior consent checkbox */
.behavior-consent-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--theme-purple-lighter);
    border: 1px solid var(--theme-purple-light);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 20px 0;
}
.behavior-consent-box input[type="checkbox"] {
    margin-top: 3px;
    width: 22px;
    height: 22px;
    accent-color: var(--theme-purple);
    flex-shrink: 0;
    cursor: pointer;
}
.behavior-consent-box input[type="checkbox"]:checked {
    accent-color: var(--theme-purple-dark);
}
.behavior-consent-box label {
    color: var(--theme-text);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    cursor: pointer;
}

/* Digital signature section */
.digital-signature-wrapper {
    background: #fff;
    border: 1px solid var(--theme-purple-light);
    border-radius: 12px;
    padding: 22px;
}
.signature-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--theme-purple-dark);
    font-weight: 700;
    font-size: 16px;
    flex-wrap: wrap;
}
.signature-label i {
    color: var(--theme-purple);
}
.signature-note {
    color: #6b5e85;
    font-size: 16px;
    margin: 6px 0 14px;
}
.signature-canvas-wrapper {
    position: relative;
    width: 100%;
    border: 2px dashed #38bdf8;
    border-radius: 10px;
    background: #f8fafc;
    padding: 15px;
    touch-action: none; /* allow smooth drawing on touch devices */
}
.signature-canvas-wrapper::before {
    content: 'Sign here';
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: #b9a9d8;
    font-size: 16px;
    font-style: italic;
    pointer-events: none;
}
.signature-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 220px;
    background: #fff;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.signature-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.btn-signature {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    min-height: 48px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1 1 auto;
}
.btn-clear {
    background: #fff;
    color: var(--theme-purple);
    border: 1px solid var(--theme-purple-light);
}
.btn-clear:hover {
    background: var(--theme-purple-light);
}
.btn-save {
    background: var(--theme-purple);
    color: #fff;
}
.btn-save:hover {
    background: var(--theme-purple-dark);
}

/* Modal theming */
.modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    max-height: 90vh;
}
.modal-header {
    background: linear-gradient(135deg, var(--theme-purple) 0%, var(--theme-purple-dark) 100%);
    color: #fff;
    padding: 18px 24px;
    border: none;
    gap: 12px;
}
.modal-title {
    font-weight: 700;
    font-size: clamp(16px, 4vw, 19px);
    line-height: 1.3;
    color: #fff;
}
.btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.9;
    flex-shrink: 0;
}
.modal-body {
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 28px;
    text-align: left;
    font-size: clamp(14px, 2.2vw, 16px);
}
#behaviorPolicyModal .modal-body h4 {
    text-align: center;
    color: var(--theme-purple-dark);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.3px;
    margin-bottom: 16px;
}
#behaviorPolicyModal .modal-body > p {
    text-align: left;
    color: #564b6e;
    line-height: 1.7;
    margin-bottom: 20px;
}
.policy-list {
    text-align: left;
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.policy-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 14px;
    line-height: 1.7;
    color: #3a3450;
    text-align: left;
    word-break: break-word;
}
.policy-list li::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--theme-purple);
}
.policy-list li strong {
    color: var(--theme-danger);
}
#behaviorPolicyModal .modal-body hr {
    border-color: var(--theme-purple-light);
    margin: 22px 0;
}
#behaviorPolicyModal .modal-footer {
    border-top: 1px solid var(--theme-purple-light);
    padding: 14px 24px;
}

.modal-footer {
    flex-wrap: wrap;
    gap: 10px;
}
.modal-footer .btn-secondary {
    background: #fff;
    color: var(--theme-purple);
    border: 1px solid var(--theme-purple-light);
    border-radius: 8px;
    padding: 10px 20px;
    min-height: 48px;
    font-weight: 600;
    flex: 1 1 auto;
}
.modal-footer .btn-secondary:hover {
    background: var(--theme-purple-lighter);
}
.modal-footer .btn-primary {
    background: var(--theme-purple);
    border-color: var(--theme-purple);
    border-radius: 8px;
    padding: 10px 22px;
    min-height: 48px;
    font-weight: 600;
    flex: 1 1 auto;
}
.modal-footer .btn-primary:hover {
    background: var(--theme-purple-dark);
    border-color: var(--theme-purple-dark);
}

/* Continue button on-theme */
.patient-info-wrapper .continue-btn-d {
    background: var(--theme-purple);
    border-color: var(--theme-purple);
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 22px;
    min-height: 48px;
    width: auto;
}
.patient-info-wrapper .continue-btn-d:hover {
    background: var(--theme-purple-dark);
    border-color: var(--theme-purple-dark);
}
.modal-title {
    color: white;
}
.left {
    text-align: left;
}

/* ---------------------------------------------- */
/* Responsive breakpoints                          */
/* ---------------------------------------------- */

/* Tablets */
@media (max-width: 768px) {
    .modal-dialog.modal-xl {
        max-width: 94vw;
        margin: 8px auto;
    }
    .modal-body {
        padding: 20px 18px;
        max-height: 60vh;
    }
    .signature-detail-card,
    .digital-signature-wrapper {
        padding: 16px;
    }
    .signature-canvas-wrapper canvas {
        height: 180px;
    }
}

/* Phones */
@media (max-width: 576px) {
    .consent-scroll-bar {
        max-height: none;
        padding-right: 0;
    }

    /* Stack policy cards and make the button full width for easy tapping */
    .policy-link-card {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }
    .policy-link-card .btn-view-policy {
        width: 100%;
        text-align: center;
    }

    /* Full-screen style modal for small viewports */
    .modal-dialog.modal-xl,
    .modal-dialog.modal-dialog-scrollable {
        max-width: 100vw;
        width: 100%;
        margin: 0;
        height: 100dvh;
    }
    .modal-content {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-title {
        font-size: 16px;
    }
    .modal-body {
        padding: 16px;
        max-height: none;
        flex: 1 1 auto;
    }
    #behaviorPolicyModal .modal-body h4 {
        font-size: 16px;
    }
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }
    .modal-footer .btn-secondary,
    .modal-footer .btn-primary {
        width: 100%;
    }

    .signature-actions {
        flex-direction: column;
    }
    .btn-signature {
        width: 100%;
    }

    .patient-info-wrapper .continue-btn-d {
        width: 100%;
    }

    .signature-canvas-wrapper canvas {
        height: 160px;
    }
}

#signature-pad{
    display:block;
    width:100%;
    height:200px;
    background:#fff;
    border:1px solid #d1d5db;
    border-radius:10px;
    touch-action:none;
    cursor:crosshair;
}