.bbc-contract { max-width: 860px; margin: 0 auto; }
.bbc-contract-title { margin: 0 0 16px; }
.bbc-contract-body { margin-bottom: 24px; }
.bbc-contract-pdf { width: 100%; height: 600px; border: 1px solid #d1d5db; border-radius: 6px; }
.bbc-contract-text { line-height: 1.6; background: #fff; padding: 18px 22px; border: 1px solid #e5e7eb; border-radius: 6px; }
.bbc-contract-empty { padding: 18px; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 6px; }

.bbc-contract-form fieldset.bbc-contract-party {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 14px 18px;
    margin: 0 0 16px;
    background: #fff;
}
.bbc-contract-party legend { padding: 0 8px; font-weight: 600; }
.bbc-party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}
.bbc-party-cell label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.bbc-party-cell input[type="text"],
.bbc-party-cell input[type="date"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-sizing: border-box;
}
.bbc-party-cell-sig { grid-column: 1 / -1; }
.bbc-readonly {
    padding: 8px 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px;
    color: #374151; min-height: 18px;
}
.bbc-prefilled-signature {
    background: #fff; border: 1px solid #d1d5db; border-radius: 4px; padding: 6px;
    max-width: 320px; max-height: 110px;
}

.bbc-signature-canvas-wrap {
    border: 1px dashed #6b7280;
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 500px;
    height: 160px;
    cursor: crosshair;
}
.bbc-signature-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.bbc-signature-actions { margin-top: 6px; }
.bbc-signature-clear {
    background: transparent; border: 1px solid #d1d5db; padding: 4px 10px;
    border-radius: 4px; cursor: pointer; font-size: 13px;
}
.bbc-signature-clear:hover { background: #f3f4f6; }

.bbc-contract-actions { margin-top: 16px; }
.bbc-contract-submit {
    background: #1e73be; color: #fff; border: 0; border-radius: 6px;
    padding: 12px 22px; font-weight: 600; cursor: pointer; font-size: 15px;
}
.bbc-contract-submit:hover { background: #155a96; }
.bbc-contract-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.bbc-contract-message { margin: 10px 0 0; font-size: 14px; }
.bbc-contract-message.is-error   { color: #b91c1c; }
.bbc-contract-message.is-success { color: #047857; }

/* When opened inside the booking modal, slim down the chrome */
.bbc-contract-in-modal { max-width: 100%; }
.bbc-contract-in-modal .bbc-contract-pdf { height: 420px; }

/* Modal hosted inside the booking widget */
.bbc-contract-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: stretch; justify-content: center;
    z-index: 99999;
}
.bbc-contract-modal {
    background: #fff;
    width: min(940px, 96vw);
    margin: 24px auto;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.bbc-contract-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}
.bbc-contract-modal-header h3 { margin: 0; font-size: 16px; }
.bbc-contract-modal-close {
    background: transparent; border: 0; font-size: 22px; line-height: 1;
    padding: 4px 8px; cursor: pointer; color: #6b7280;
}
.bbc-contract-modal-close:hover { color: #111827; }
.bbc-contract-modal-iframe {
    flex: 1 1 auto;
    border: 0;
    width: 100%;
    min-height: 70vh;
}

/* ============================================================
   Mobile hardening: contract content inside booking modal
   ============================================================ */
.bbc-contract,
.bbc-contract * {
    box-sizing: border-box;
}

.bbc-contract {
    width: 100%;
    padding: 16px;
}

.bbc-contract-title,
.bbc-contract-text,
.bbc-readonly,
.bbc-party-cell,
.bbc-contract-message {
    overflow-wrap: anywhere;
    word-break: normal;
}

.bbc-party-cell,
.bbc-party-cell input[type="text"],
.bbc-party-cell input[type="date"],
.bbc-signature-canvas-wrap,
.bbc-contract-submit {
    max-width: 100%;
}

.bbc-contract-submit,
.bbc-signature-clear {
    min-height: 44px;
}

@media (max-width: 768px) {
    .bbc-contract {
        padding: 14px;
    }

    .bbc-contract-title {
        font-size: 22px;
        line-height: 1.2;
    }

    .bbc-contract-text {
        padding: 14px;
    }

    .bbc-contract-pdf,
    .bbc-contract-in-modal .bbc-contract-pdf {
        height: 56vh;
        height: 56dvh;
    }

    .bbc-party-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .bbc-contract-form fieldset.bbc-contract-party {
        padding: 12px;
    }

    .bbc-signature-canvas-wrap {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .bbc-contract {
        padding: 12px;
    }

    .bbc-contract-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .bbc-contract-body {
        margin-bottom: 18px;
    }

    .bbc-contract-text {
        padding: 12px;
        font-size: 14px;
        line-height: 1.55;
    }

    .bbc-contract-pdf,
    .bbc-contract-in-modal .bbc-contract-pdf {
        height: 50vh;
        height: 50dvh;
    }

    .bbc-contract-form fieldset.bbc-contract-party {
        margin-bottom: 12px;
    }

    .bbc-prefilled-signature {
        width: 100%;
        height: auto;
    }

    .bbc-signature-canvas-wrap {
        height: 170px;
    }

    .bbc-signature-actions,
    .bbc-contract-actions {
        display: grid;
        gap: 8px;
    }

    .bbc-signature-clear,
    .bbc-contract-submit {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .bbc-contract {
        padding: 10px;
    }

    .bbc-contract-title {
        font-size: 18px;
    }

    .bbc-signature-canvas-wrap {
        height: 150px;
    }
}
