form.mailform {

    --primary-color: #0e5bce;
    --holiday: rgb(255, 236, 245);
    --saturday: rgb(228, 241, 253);
    --error: #da2424;

    &.loading {
        pointer-events: none;
        opacity: .7;
    }

    * {
        box-sizing: border-box;
    }

    .required {
        background: var(--error);
        color: white;
        display: inline-block;
        padding: 3px 6px;
        font-weight: 700;
        font-size: 12px;
        line-height: 1.2;
        border-radius: 3px;
    }

    fieldset {
        position: relative;
        border: none;
        margin: 0;
        padding: 0;

        .datepicker-mat {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
    }

    .input-form {
        border: none;

        .form-group {
            display: flex;
            padding: 10px;
            border-bottom: 1px solid #dedede;

            @media (max-width: 768px) {
                display: block;
                padding: 15px 10px;
            }

            &:first-child {
                border-top: 1px solid #dedede;
            }

            &.has-error {
                background-color: #ffeeee;
            }

            >.control-label {
                flex: 0 0 200px;
                display: flex;
                justify-content: space-between;
                margin-right: 20px;

                .title {
                    flex: 1 1 auto;
                    font-weight: 700;
                    white-space: pre-wrap;
                }

                .icon {
                    display: block;
                    flex: 0 0 50px;
                    text-align: right;
                }

                @media (max-width: 768px) {
                    margin: 0 0 5px;
                    justify-content: flex-start;
                    align-items: center;

                    .title {
                        order: 2;
                        flex: 0 0 auto;
                        line-height: 1;
                        margin-top: -2px;
                    }

                    .icon {
                        order: 1;
                        flex: 0 0 auto;
                        display: flex;
                        margin-right: 5px;
                    }
                }
            }

            >.controls {
                position: relative;
                flex: 1 1 auto;

                input[type=text],
                input[type=email],
                textarea,
                select,
                button.zip-search {
                    border: 1px solid #ccc;
                    font-size: 16px;
                    line-height: 1.3;
                    padding: 5px 10px;
                    border-radius: 4px;
                    background: #f5f5f5;

                    &:focus {
                        background: #fff;
                    }
                }

                input[type=text],
                input[type=email] {

                    &.size-sss {
                        width: 60px;
                    }

                    &.size-ss {
                        width: 120px;
                    }

                    &.size-s {
                        width: 200px;
                    }

                    &.size-m {
                        width: 300px;

                        @media (max-width: 768px) {
                            width: 100%;
                        }
                    }

                    &.size-l {
                        width: 400px;

                        @media (max-width: 768px) {
                            width: 100%;
                        }
                    }

                    &.size-ll {
                        width: 100%;
                    }

                    &.zip-search {
                        display: inline-block;
                        margin-left: 5px;
                        cursor: pointer;

                        &:hover {
                            background: #ddd;
                        }

                        &.loading {
                            opacity: .7;
                        }
                    }
                }

                input[type="text"] {
                    &.zip1 {
                        width: 60px;
                    }

                    &.zip2 {
                        width: 90px;
                    }

                    &.phone1,
                    &.phone2,
                    &.phone3 {
                        width: 90px;
                    }

                    &.type11,
                    &.type12 {
                        width: 120px;
                    }
                }

                textarea {
                    width: 100%;

                    &.size-sss {
                        height: 45px;
                    }

                    &.size-ss {
                        height: 70px;
                    }

                    &.size-s {
                        height: 120px;
                    }

                    &.size-m {
                        height: 180px;
                    }

                    &.size-l {
                        height: 250px;
                    }

                    &.size-ll {
                        height: 350px;
                    }
                }

                .radios {
                    display: flex;
                    align-items: center;
                    gap: 5px 20px;
                    flex-wrap: wrap;

                    .item {
                        display: flex;
                        align-items: center;
                        gap: 0 10px;

                        label {
                            cursor: pointer;
                        }

                        .radio {
                            display: flex;
                            gap: 0 5px;
                        }

                        &.etc {
                            flex-basis: 100%;

                            .input {
                                flex-basis: 60%;
                            }
                        }
                    }
                }

                .date {
                    position: relative;

                    .input-wrapper {
                        position: relative;
                        display: inline-block;

                        .clear {
                            position: absolute;
                            top: 50%;
                            right: 5px;
                            transform: translateY(-50%);
                            border-radius: 20px;
                            width: 18px;
                            height: 18px;
                            border: none;
                            background: #aaa;
                            cursor: pointer;
                            transition-duration: .3s;

                            &:hover {
                                background: #444;
                            }

                            &::before,
                            &::after {
                                position: absolute;
                                top: calc(50% - 1px);
                                left: calc(50% - 5px);
                                display: block;
                                content: '';
                                width: 10px;
                                height: 2px;
                                background-color: white;
                                transform: rotate(45deg);
                            }

                            &::after {
                                transform: rotate(-45deg);
                            }
                        }
                    }
                }

                .help {
                    display: block;
                    margin: 10px 0 0;

                    p {
                        color: #666;
                        margin: 0;
                        line-height: 1.2;
                        white-space: pre-wrap;
                    }
                }

                .error {
                    color: var(--error);
                    margin: 10px 0 0;

                    p {
                        margin: 0;
                        line-height: 1.2;
                    }
                }

                label.error-tooltip {
                    position: absolute;
                    z-index: 10;
                    background: var(--error);
                    border-radius: 3px;
                    padding: 4px 6px;
                    margin-top: 3px;
                    color: white;
                    opacity: .85;
                    box-shadow: 1px 1px 3px rgba(black, .4);
                    font-size: 12px;

                    &::before {
                        position: absolute;
                        top: -6px;
                        left: 10px;
                        content: '';
                        width: 0;
                        height: 0;
                        border: 0 solid transparent;
                        border-right-width: 6px;
                        border-left-width: 6px;
                        border-bottom: 6px solid var(--error);
                    }
                }

                span.sub {
                    display: inline-block;
                    margin-right: 5px;
                }

                *+span.sub {
                    margin-left: 10px;
                }

                button.zip-search {
                    background: var(--primary-color);
                    border-color: var(--primary-color);
                    color: white;
                    cursor: pointer;

                    &:disabled {
                        opacity: .6;
                        pointer-events: none;
                    }

                    &:focus {
                        background: var(--primary-color);
                        opacity: .8;
                    }
                }
            }

            /* メールアドレス（確認用フォーム付き） */
            &.type-7 {
                .confirm {
                    margin-top: 10px;
                }
            }

            /* 電話番号 */
            &.type-8 {
                .controls {
                    .input {
                        display: flex;
                        align-items: center;
                        gap: 0 5px;
                    }
                }
            }

            /* 郵便番号 */
            &.type-9 {
                .controls {
                    .input {
                        display: flex;
                        align-items: center;
                        gap: 0 5px;
                    }
                }
            }

            /* 都道府県 */
            &.type-10 {
                .controls {}
            }

            /* 日付選択 */
            &.type-11,
            &.type-12,
            &.type-17 {
                @media (max-width: 768px) {
                    input[type="text"] {
                        width: 130px;
                    }

                    select {
                        width: 130px;
                    }
                }
            }

            /* 日付選択 */
            &.type-12 {
                .datetime {
                    display: flex;
                    gap: 10px;
                }
            }

            /* 添付ファイル */
            &.type-14 {
                .input {
                    display: flex;
                    gap: 0 10px;

                    button {
                        border: none;
                        font-size: 12px;
                        line-height: 1.3;
                        padding: 5px 10px;
                        border-radius: 4px;
                        background: var(--primary-color);
                        color: white;
                        cursor: pointer;

                        &:hover {
                            opacity: .8;
                        }
                    }
                }
            }

            /* 姓名 */
            &.type-19 {
                .controls {
                    .input {
                        display: flex;
                        align-items: center;
                        gap: 0 10px;

                        @media (max-width: 768px) {

                            .family,
                            .first {
                                flex: 0 0 calc(50% - 5px);

                                input {
                                    width: 100%;
                                }
                            }
                        }
                    }
                }
            }

            /* 日付選択（ラジオボタン） */
            &.type-17 {
                .radios {
                    margin-top: 5px;
                }
            }

            /* 同意 */
            &.type-18 {
                margin: 30px 0;
                border-bottom: none;

                .agree {
                    flex: 0 0 100%;

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

            /* 生年月日 */
            &.type-20 {
                .input {
                    display: flex;
                    gap: 0 5px;
                    align-items: center;

                    @media (max-width: 768px) {
                        select {
                            width: 90px;
                        }
                    }
                }
            }

            /* 見出し */
            &.type-21 {

                &:first-child {
                    border-top: none;

                    .title {
                        margin-top: 0;
                    }
                }

                .title {
                    flex: 0 0 100%;
                    margin: 15px 0;

                    h3 {
                        white-space: pre-wrap;
                        text-align: center;
                        margin: 0;
                        font-size: 18px;
                        line-height: 1.4;
                    }

                    .comment {
                        margin: 15px 0 0;
                    }
                }
            }

            p.multiple {
                margin: 0;
                color: black;
                white-space: pre-wrap;
                line-height: 1.4;
            }
        }

        .agree {}
    }

    .datepicker {
        position: absolute;
        top: 35px;
        left: 0;
        z-index: 10;
        background: white;
        border: 1px solid #eee;
        box-shadow: 5px 5px 10px rgba(black, .1);
        padding: 10px;
        border-radius: 4px;

        --hover-color: #0894d4;

        .calendar-header {
            position: relative;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 0 10px;
            font-size: 15px;
            width: 100%;
            height: auto;

            .title {
                display: flex;
                gap: 5px;
            }

            .ui {
                display: flex;
                gap: 10px;

                span {
                    display: block;
                    font-size: 13px;
                    padding: 4px 4px;
                    border-radius: 3px;
                    line-height: 1.1;
                    color: #333;
                    cursor: pointer;
                    background-color: #eee;
                    transition-duration: .2s;

                    i {
                        display: block;
                        border: 6px solid #888;
                        border-top-color: transparent;
                        border-bottom-color: transparent;
                        width: 0;
                        height: 0;
                    }

                    &.prev {
                        i {
                            border-left-color: transparent;
                            transform: scaleY(0.8) translateX(-3px);
                        }
                    }

                    &.next {
                        i {
                            border-right-color: transparent;
                            transform: scaleY(0.8) translateX(3px);
                        }
                    }

                    &:hover {
                        background-color: var(--hover-color);

                        &.prev i {
                            border-right-color: white;
                        }

                        &.next i {
                            border-left-color: white;
                        }
                    }
                }
            }
        }

        .dates {
            --width: 32px;
            display: flex;
            flex-wrap: wrap;
            width: calc(var(--width) * 7);

            >span {
                display: block;
                width: var(--width);
                height: var(--width);
                line-height: var(--width);
                text-align: center;
                cursor: pointer;
                font-size: 14px;
                transition-property: background-color;
                transition-duration: .2s;

                &.disabled {
                    color: #666;
                    background-color: #f4f4f4;
                    pointer-events: none;
                }

                &:hover {
                    background-color: var(--hover-color);
                    color: white !important;
                    font-weight: 700;
                }

                &.active {
                    background-color: #f5f562;

                    &:hover {
                        background-color: #ffff0b;
                        color: #444 !important;
                    }
                }

                &.week-0 {
                    color: #d80808;
                    font-weight: 600;
                }

                &.week-6 {
                    color: #0e77ce;
                    font-weight: 600;
                }

                &.holiday {
                    color: #d80808;
                    font-weight: 600;
                }

                &:first-child.week-1 {
                    margin-left: calc(var(--width) * 1);
                }

                &:first-child.week-2 {
                    margin-left: calc(var(--width) * 2);
                }

                &:first-child.week-3 {
                    margin-left: calc(var(--width) * 3);
                }

                &:first-child.week-4 {
                    margin-left: calc(var(--width) * 4);
                }

                &:first-child.week-5 {
                    margin-left: calc(var(--width) * 5);
                }

                &:first-child.week-6 {
                    margin-left: calc(var(--width) * 6);
                }

                &:first-child.week-7 {
                    margin-left: calc(var(--width) * 7);
                }
            }
        }
    }

    .submit {
        margin: 20px;
        text-align: center;

        button {
            display: inline-block;
            border: none;
            border-radius: 4px;
            padding: 10px 20px;
            cursor: pointer;
            min-width: 200px;
            color: white;
            background-color: var(--primary-color);
            transition-duration: .3s;

            &:disabled {
                opacity: .6;
                pointer-events: none;
                background-color: #999;
            }

            &:hover {
                background-color: #1770f5;
            }
        }
    }

    .modify {
        margin: 30px 0 40px;
        text-align: center;

        span {
            color: #777;
            font-size: 13px;
            line-height: 1.4;
            border-bottom: 1px solid #888;
            padding-bottom: 1px;
            cursor: pointer;
        }
    }

    div.reserve-calendar {

        --hover: rgb(255, 255, 177);
        --selected: rgb(146, 218, 132);
        --disabled: rgb(194, 120, 120);

        .wrapper {
            margin: 30px 0;

            >.title {
                border: 1px solid #ccc;
                padding: 3px 6px;
            }
        }

        table {
            width: auto;
            margin: 20px auto;
            border: none;

            caption {
                nav {
                    display: flex;
                    padding: 5px 0 10px;

                    span.month {
                        flex: 1 1 auto;
                        text-align: left;
                        font-size: 18px;
                    }

                    span.next,
                    span.prev {
                        color: #aaa;
                        border-radius: 3px;
                        border: 1px solid #ccc;
                        padding: 3px 6px;
                        font-size: 13px;
                        background: #f0f0f0;

                        &.active {
                            cursor: pointer;
                            color: #333;
                            background: white;

                            &:hover {
                                background: var(--hover);
                            }

                            &:active {
                                background: rgb(255, 255, 82);
                                border-color: #ddd;
                                color: #999;
                            }
                        }
                    }

                    span.prev {
                        margin-right: 15px;
                    }
                }
            }

            thead {
                th {
                    text-align: center;
                    padding: 3px 0;
                    border-bottom: 3px double #ccc;

                    &.week-0 {
                        background-color: var(--holiday);
                    }

                    &.week-6 {
                        background-color: var(--saturday);
                    }
                }
            }

            tbody {
                td {
                    padding: 10px 20px;
                    text-align: center;
                    font-family: Helvetica, Arial, sans-serif;

                    @media screen and (max-width: 500px) {
                        padding: 10px 15px;
                    }

                    &.disabled {
                        background: #eee;
                        color: #777;
                    }

                    &.enabled {
                        background: white;
                        transition-duration: .3s;
                        cursor: pointer;

                        &:hover {
                            background: rgb(233, 255, 153) !important;
                        }

                        &.active {
                            background: var(--selected) !important;
                            color: white;
                        }

                        &.week-0 {
                            background-color: var(--holiday);
                        }

                        &.holiday {
                            background-color: var(--holiday);
                            color: rgb(224, 20, 20);
                            font-weight: 700;
                        }

                        &.week-6 {
                            background-color: var(--saturday);
                        }
                    }
                }
            }
        }

        .time_options {
            ul {
                padding: 0;
                text-align: center;

                li {
                    display: inline-block;
                    list-style: none;
                    margin: 5px 5px;
                    border: 1px solid #ccc;
                    border-radius: 3px;
                    padding: 3px 6px;
                    white-space: nowrap;

                    &.enabled {
                        color: rgb(46, 155, 73);
                        border-color: var(--selected);
                        cursor: pointer;
                        transition-duration: .3s;

                        &:hover {
                            background: var(--hover);
                        }

                        &.active {
                            background: var(--selected);
                            border-color: var(--selected);
                            color: white;
                        }
                    }

                    &.disabled {
                        color: var(--disabled);
                        border-color: var(--disabled);
                    }

                    span.entry,
                    span.capacity {
                        display: inline-block;
                        background: #ddd;
                        padding: 0 4px;

                        /* 標準では隠す */
                        display: none;
                    }

                    span.entry {
                        margin-left: 5px;
                        border-radius: 3px 0 0 3px;
                        padding-right: 0;

                        &::after {
                            content: '/';
                            padding-left: 4px;
                        }
                    }

                    span.capacity {
                        margin-right: 5px;
                        border-radius: 0 3px 3px 0;
                    }

                    span.status {
                        display: inline-block;
                        margin-left: 5px;
                        font-family: Osaka, Meiryo;
                    }
                }
            }
        }
    }
}

form.mailform {
    .confirm {
        .form-group {
            .controls {
                .time {
                    display: inline-block;
                    margin-left: 12px;
                }
            }
        }
    }
}