/*
 * Do Progetto: Japanese reservation form (WordPress page 247 / CF7 form 246).
 * This stylesheet is enqueued only for the admin responsive preview.
 * Keep the existing CF7 fields, date dropdowns, validations and mail logic.
 */
@media screen and (max-width: 600px) {
    /* Give the form the available width without disturbing the desktop design. */
    #form_area,
    .wpcf7 {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-left: 0;
        box-sizing: border-box;
    }

    .wpcf7 p,
    #info2 p {
        line-height: 1.7;
    }

    /* Only the OUTER layout table becomes stacked form rows. */
    table#info2,
    #info2 > tbody,
    #info2 > tbody > tr,
    #info2 > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        box-sizing: border-box;
    }

    table#info2 {
        margin: 0;
        padding: 0;
        border-spacing: 0;
        overflow: visible !important;
    }

    #info2 > tbody > tr {
        margin: 0 0 17px;
    }

    #info2 > tbody > tr > td {
        padding: 0 !important;
        line-height: 1.7;
        font-size: 14px;
        overflow-wrap: anywhere;
        vertical-align: top;
    }

    /* Preserve single full-width instruction rows. */
    #info2 > tbody > tr > td:first-child:not([colspan]) {
        font-weight: bold;
        margin-bottom: 5px;
    }

    /* Never let single-line text fields or textareas exceed the viewport. */
    #info2 input.text_form,
    #info2 textarea.area_form {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        box-sizing: border-box;
        padding: 9px 10px;
        font-size: 16px;
        line-height: 1.5;
    }

    #info2 input.text_form {
        min-height: 42px;
    }

    #info2 textarea.area_form {
        min-height: 140px;
        resize: vertical;
    }

    /* Existing start/end-date select fields wrap naturally without overflow. */
    #info2 select {
        display: inline-block;
        max-width: 100%;
        min-height: 36px;
        margin: 3px 2px 5px 0;
        padding: 3px 2px;
        vertical-align: middle;
        box-sizing: border-box;
        font-size: 16px;
        line-height: 1.4;
    }

    #info2 .text_70 {
        font-size: 13px;
        line-height: 1.65;
        margin-bottom: 8px;
    }

    /* Checkboxes are spaced for touch without changing their names/values. */
    #info2 .wpcf7-list-item {
        display: block;
        margin: 0 0 7px;
    }

    #info2 .wpcf7-list-item label {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        gap: 8px;
        line-height: 1.5;
    }

    #info2 input[type="checkbox"] {
        width: 18px;
        height: 18px;
        flex: 0 0 auto;
        margin: 0;
    }

    /* Native file picker: allow filename to remain inside the form. */
    #info2 input[type="file"] {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        font-size: 13px;
    }

    /* Preserve the NESTED equipment quantity table as an actual table. */
    #info2 > tbody > tr > td > table {
        display: table !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        margin: 4px 0 0;
        border-collapse: collapse;
        overflow: visible !important;
        box-sizing: border-box;
    }

    #info2 > tbody > tr > td > table > tbody {
        display: table-row-group !important;
    }

    #info2 > tbody > tr > td > table > tbody > tr {
        display: table-row !important;
    }

    #info2 > tbody > tr > td > table > tbody > tr > td {
        display: table-cell !important;
        width: auto;
        padding: 6px 6px 6px 0 !important;
        vertical-align: middle;
        font-size: 13px;
        line-height: 1.55;
        white-space: normal;
    }

    #info2 > tbody > tr > td > table > tbody > tr > td:first-child {
        width: 52%;
    }

    #info2 > tbody > tr > td > table > tbody > tr > td:last-child {
        width: 48%;
    }

    #info2 > tbody > tr > td > table select {
        min-height: 34px;
        font-size: 15px;
    }

    /* Required-field note was positioned 300px from the left on desktop. */
    #cout {
        width: 100%;
        max-width: 100%;
        margin: 8px 0 14px;
        font-size: 13px;
        text-align: left;
        box-sizing: border-box;
    }

    .wpcf7 input[type="submit"] {
        display: block;
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        padding: 10px 16px;
        border: 1px solid #b9a4ab;
        background: #fbf8f9;
        color: #903;
        font-size: 16px;
        font-weight: bold;
        box-sizing: border-box;
        cursor: pointer;
    }
}
