/* ============================================
   BOOKING FLOW - Innkeeper License Agreement
   ============================================ */

/* --------------------------------------------
   PAGE 1 - START
   -------------------------------------------- */
.apply-start {
    text-align: center;
}

.apply-start h1 {
    margin-bottom: 1rem;
}

.apply-start p {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 2rem;
}

.apply-start .btn {
    margin-top: 2rem;
}

/* --------------------------------------------
   PAGE 2 - TERMS
   -------------------------------------------- */
.terms-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 1.5rem;
    margin: 1rem 0;
    background: #fafafa;
    border-radius: 4px;
}

.terms-scroll h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

.terms-scroll h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #444;
    font-size: 1.125rem;
}

.terms-scroll p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #555;
}

.terms-scroll em {
    color: #666;
    display: block;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.terms-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.terms-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.terms-checkbox span {
    font-weight: 500;
    color: #333;
}

.date-field{
    border:0;
    border-bottom:1px solid #222;
    background:transparent;
    padding:2px 4px;
    width:140px;
    font: inherit;
}


/* --------------------------------------------
   PAGE 3 - FORM
   -------------------------------------------- */
fieldset {
    border: 1px solid #ddd;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    background: #fafafa;
}

legend {
    font-weight: bold;
    padding: 0 0.5rem;
    color: #333;
    font-size: 1.125rem;
}

.form label {
    display: block;
    margin-bottom: 1rem;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="number"],
.form input[type="date"],
.form select,
.form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    margin-top: 0.25rem;
}

.form input[type="text"]:focus,
.form input[type="email"]:focus,
.form input[type="tel"]:focus,
.form input[type="number"]:focus,
.form input[type="date"]:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.form textarea {
    resize: vertical;
    min-height: 80px;
}

.error {
    display: block;
    color: #c33;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* `display: block` above beats the user-agent rule for [hidden], so a message
   marked hidden would otherwise still take up a line and be announced. */
.error[hidden] {
    display: none;
}

.error-message {
    background: #fee;
    border: 1px solid #c33;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    color: #c33;
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pet-fields {
    margin-top: 1rem;
    padding: 1rem;
    padding-left: 1.5rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #ddd;
}

.pet-fields.hidden {
    display: none;
}

/* Display-only fields (non-editable) */
.display-field {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    color: #333;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
}

.total-field {
    background-color: #e8f5e9;
    border-color: #4caf50;
    font-weight: 600;
    font-size: 1.1rem;
}

.grand-total {
    background-color: #e3f2fd;
    border-color: #2196f3;
    font-size: 1.2rem;
}

/* --------------------------------------------
   PAGE 4 - REVIEW
   -------------------------------------------- */
.review-intro {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.0625rem;
}

.review-section {
    background: #fafafa;
    border: 1px solid #ddd;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.review-section h2 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    color: #333;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 0.5rem;
}

.review-section dl {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.review-section dt {
    font-weight: 600;
    color: #666;
}

.review-section dd {
    margin: 0;
    color: #333;
}

.review-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* --------------------------------------------
   PAGE 5 - SENT / CONFIRMATION
   -------------------------------------------- */
.apply-sent {
    text-align: center;
}

.apply-sent h1 {
    margin-bottom: 1rem;
    color: #333;
}

.success-icon {
    font-size: 4rem;
    color: #4CAF50;
    margin: 2rem 0;
    line-height: 1;
}

.sent-message {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 500;
}

.sent-description {
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.next-steps {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0f8ff;
    border-radius: 4px;
    border-left: 4px solid #2196F3;
    text-align: left;
}

.next-steps p {
    margin: 0;
    color: #333;
    line-height: 1.8;
}

.next-steps strong {
    display: block;
    margin-bottom: 0.75rem;
    color: #2196F3;
    font-size: 1.0625rem;
}

.sent-actions {
    margin-top: 2rem;
}

/* --------------------------------------------
   BUTTONS
   -------------------------------------------- */
.btn {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #45a049;
}

.btn:active {
    background: #3d8b40;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #4CAF50;
}

.btn:disabled:hover {
    background: #4CAF50;
}

.btn-secondary {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.btn-secondary:active {
    background: #eee;
}

/* --------------------------------------------
   RESPONSIVE
   -------------------------------------------- */
@media (max-width: 768px) {
    .review-section dl {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .review-section dt {
        margin-top: 0.75rem;
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .review-section dd {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
    }

    .review-section dd:last-of-type {
        border-bottom: none;
    }

    .review-actions {
        flex-direction: column;
    }

    .btn,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }

    fieldset {
        padding: 1rem;
    }

    .terms-scroll {
        max-height: 300px;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .success-icon {
        font-size: 3rem;
    }

    .sent-message {
        font-size: 1rem;
    }

    .next-steps {
        padding: 1rem;
    }

    .terms-scroll h2 {
        font-size: 1.25rem;
    }

    .terms-scroll h3 {
        font-size: 1rem;
    }
}

/* --------------------------------------------
   UTILITIES
   -------------------------------------------- */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* --------------------------------------------
   FORM VALIDATION
   -------------------------------------------- */

/* Invalid state for inputs and textareas (after user interaction) */
.form input:invalid:not(:placeholder-shown),
.form textarea:invalid:not(:placeholder-shown) {
    border-color: #c33;
}

/* Valid state for inputs and textareas (after user interaction) */
.form input:valid:not(:placeholder-shown),
.form textarea:valid:not(:placeholder-shown) {
    border-color: #4CAF50;
}

/* Invalid state for select dropdowns */
.form select:invalid,
.form select:required:invalid {
    border-color: #c33;
}

/* Valid state for select dropdowns */
.form select:valid {
    border-color: #4CAF50;
}

/* Show invalid state immediately for required textareas when empty */
.form textarea:required:invalid {
    border-color: #c33;
}

/* --------------------------------------------
   ACCESSIBILITY
   -------------------------------------------- */

/* Focus visible for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
/* --------------------------------------------
   SIGNATURE MODAL
   -------------------------------------------- */
.sig-btn{
    border:1px solid #222;
    background:#f5f7ff;
    padding:8px 12px;
    border-radius:6px;
    cursor:pointer;
}
.sig-preview img{
    height:34px;
    vertical-align:middle;
    margin-left:10px;
    border-bottom:1px solid #ddd;
}

.sig-modal{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.sig-modal.is-open{
    display: flex;
}
.sig-dialog{
    width: min(920px, 95vw);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}
.sig-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
}
.sig-tabs{
    display: flex;
    gap: 8px;
}
.sig-tab{
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.sig-tab.is-active{
    border-color: #2563eb;
    background: #eef2ff;
}
.sig-close{
    border: 1px solid #ddd;
    background: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.sig-body{
    padding: 14px;
}
.sig-panel{
    display: none;
}
.sig-panel.is-active{
    display: block;
}

.sig-row{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.sig-type-input{
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
}

.sig-canvas-wrap,
.sig-type-preview-wrap{
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.sig-canvas-wrap canvas,
.sig-type-preview-wrap canvas{
    width: 100%;
    height: auto;
    display: block;
    touch-action: none; /* important for mobile drawing */
}

.sig-footer{
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid #eee;
}

.sig-link{
    background: transparent;
    border: 0;
    color: #2563eb;
    cursor: pointer;
}

.sig-apply{
    border: 0;
    background: #2563eb;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

/* If you want the signature button/preview to wrap nicely on small screens */
@media (max-width: 480px) {
    .sig-row{
        flex-direction: column;
        align-items: stretch;
    }
}

/* ---- booking signing page ---- */

.sign-meta{
    margin: 1rem 0;
    line-height: 1.6;
}
.sign-meta dt{ font-weight: 600; }
.sign-meta dd{ margin: 0 0 .5rem 0; }

/* The agreement is shown in full. It is long, so it scrolls in place rather
   than pushing the signature pad below three screens of text — but it is the
   real text, selectable and searchable, not an image or a summary. */
.contract-text{
    max-height: 22rem;
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    white-space: pre-wrap;
    word-break: break-word;
    font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.contract-digest{
    margin-top: .5rem;
    font-size: 12px;
    color: var(--muted);
}
.contract-digest code{
    word-break: break-all;
}

.field--check label{
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    font-weight: 400;
    line-height: 1.5;
}
.field--check input[type="checkbox"]{
    margin-top: .25rem;
    flex: none;
    width: 18px;
    height: 18px;
}

/* touch-action:none stops a drag on the pad from scrolling the page, which on
   a phone is the difference between signing and panning. */
.signature-pad{
    display: block;
    width: 100%;
    height: 200px;
    border: 1px solid #999;
    border-radius: 4px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.sign-actions{
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1rem;
}
