/* ========== apply.css ========== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", sans-serif;
    background: #fafafa;
    line-height: 1.6; /* 稍微缩小行高 */
    margin: 0;
}

/* 1. 容器加宽 & 减少上下内边距 */
.box {
    max-width: 900px;
    margin: 20px auto; /* 顶部间距 40px 减半 */
    background: #fff;
    padding: 20px 40px 30px; /* 减少顶部内边距 */
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* 加一点淡淡的阴影增加立体感 */
}

h1 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 24px;
}

label {
    display: block;
    font-weight: 700;
}

/* 输入框整体变矮 */
input:not([type="radio"]):not([type="checkbox"]),
textarea {
    width: 100%;
    padding: 6px 12px; /* 上下 padding 从 12px 缩减到 6px */
    border: 1px solid #ccc;
    border-radius: 7px;
    font: inherit;
    box-sizing: border-box;
}

#submit-btn {
    margin-top: 15px; /* 按钮上间距缩小 */
    width: 100%;
    padding: 12px;
    background: #111;
    color: #fff;
    border: 0;
    border-radius: 7px;
    font-weight: 700;
    cursor: pointer;
}

#submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error {
    background: #fee;
    padding: 12px;
    border-radius: 7px;
}

/* ========== 横並びレイアウト ========== */
.field-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-top: 14px; /* 行间距从 18px 缩减到 12px */
}

.field-row > label {
    flex: 0 0 160px;
    font-weight: 700;
    padding-top: 8px; /* 跟输入框的高度对齐 */
}

.field-row > .field-content {
    flex: 1;
    min-width: 0;
}

/*.field-row .field-content input:not([type="radio"]):not([type="checkbox"]),*/
.field-row .field-content select,
.field-row .field-content textarea {
    width: 100%;
    max-width: 100%;
}

/* 注释文字紧凑化 */
.field-content p {
    margin: 2px 0 0; /* 上边距从 4px 缩减到 2px */
    font-size: 0.8rem; /* 字号稍微调小一点 */
    color: #555;
    font-weight: 400;
    line-height: 1.4;
}


/* ========== ラジオボタン ========== */
.radio-group {
    display: flex;
    gap: 30px;
    margin-top: 8px; /* 减小顶部间距 */
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
}

.radio-group input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: #111;
}

/* ========== 所在地 ========== */
.location-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.location-group select {
    /*flex: 0 0 140px;*/
    padding: 8px 12px; /* 高度缩减 */
    border: 1px solid #ccc;
    border-radius: 7px;
    font: inherit;
    box-sizing: border-box;
    background: #fff;
}
.btn-guide {
    /* 覆盖全局 button 样式 */
    width: 80px !important;             /* 固定宽度 80px */
    height: 30px !important;            /* 固定高度 30px */
    margin-top: 0 !important;           /* 清除全局的上边距 */
    padding: 0 !important;              /* 清除内边距，用 line-height 撑开高度 */

    /* 排版与配色 */
    background: #f5f5f5;                /* 浅灰背景，看起来像次级按钮 */
    color: #333;                        /* 文字颜色 */
    border: 1px solid #ccc;             /* 边框 */
    border-radius: 7px;                 /* 圆角与输入框保持一致 */
    font-size: 0.85rem;                 /* 字体稍微小一点 */
    font-weight: 500;
    line-height: 28px;                  /* 高度(30px) - 上下边框(2px) = 28px，保证文字完美居中 */
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;

    /* 确保它在 flex 布局中不被挤压 */
    flex-shrink: 0;
}
.btn-guide:hover {
    background: #e8e8e8;
    border-color: #bbb;
}
.btn-guide:active {
    background: #ddd;
}

.location-group input {
    flex: 1;
    margin: 0;
}
#gmap-confirm {
    width: auto !important;
    padding: 0 10px !important;
    min-width: 80px !important;
}
#gmap-confirm:disabled,
#gmap-confirm:disabled:hover {
    background: #eee !important;
    color: #aaa !important;
    border-color: #ddd !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

/* ========== チェックボックス ========== */
.checkbox-row {
    margin-top: 15px; /* 缩小间距 */
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #111;
}


/* ========== 新增：输入框与旁注同行排版 ========== */

/* 包裹层：让输入框和旁注在同一行 */
.input-with-note {
    display: flex;
    align-items: center; /* 垂直居中对齐 */
    gap: 16px; /* 输入框和文字的间距 */
    flex-wrap: nowrap; /* 不允许换行 */
}

/* 限制输入框的最大宽度，腾出空间给文字 */
.input-with-note input {
    max-width: 320px; /* 可根据需要调整这里，或者调大 */
    flex-shrink: 0;
}

/* 旁注文字的样式，高度与大文本框对齐 */
.inline-note {
    margin: 0;
    font-size: 0.8rem;
    color: #555;
    font-weight: 400;
    line-height: 1.4;
    flex: 1; /* 占据剩余空间 */
    max-width: 400px; /* 防止文字太长拉到屏幕边缘 */
    /* 保证文字高度无论行数多少，都与输入框的 30px 左右高度对齐 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.email-group .inline-note{
    color: #cd242c;
    /*color: #f2bf2e;*/
}

    /* 覆盖掉原本导致所有 p 标签占一行的 margin */
.input-with-note .inline-note p {
    margin: 0;
}
.title-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.title-row h1 { margin: 0; }
.title-row p { margin: 0; }
/* ========== 表单校验错误样式 ========== */

/* 错误红框 */
.input-error {
    border-color: #cd242c !important;
    background-color: #fffafa !important;
}

/* 错误时占位符文字变红 */
.input-error::placeholder {
    color: #cd242c !important;
    opacity: 1 !important;
}

/* 针对下拉框+输入框+按钮组合的情况 */
.error-field .location-group select,
.error-field .location-group input {
    border-color: #cd242c !important;
    background-color: #fffafa !important;
}
.row-inline {
    display: flex;
    align-items: center;   /* 垂直居中 */
    gap: 8px;              /* 两者间距 */
}

.pref-select {
    flex: 0 0 34%;
    width: 120px;          /* 或 auto，视下拉项文字长度定 */
    max-width: 40%;        /* 防止太宽 */
}

.addr-input {
    flex: 1 1 auto;        /* 占满剩余空间 */
    min-width: 0;          /* 关键！防止 input 撑破 flex 容器 */
}
/* ========== 针对移动端 ========== */
@media (max-width: 700px) {

    .field-row {
        display: block !important; /* 手机上放弃 flex，改为块级布局 */
        margin-top: 18px !important;
        margin-bottom: 0 !important;
    }

    .field-content {
        display: block !important;
        width: 100% !important;
        margin-top: 4px !important; /* 标签和输入框之间的间距 */
    }

    /* 取消 label 可能带来的多余高度 */
    .field-row > label {
        display: block;
        padding-top: 0 !important;
        margin-bottom: 2px !important;
        line-height: 1.2 !important;
    }

    /* 将输入框和旁注改为上下排列，并挤压掉多余空间 */
    .input-with-note {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px !important; /* 输入框和红色提示文字的间距 */
    }

    .input-with-note input {
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* 清理掉所有段落（包括红色提示）的默认边距 */
    .inline-note,
    .inline-note p,
    .field-content p {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
    }

    /* 修复单选框（土地/建物）的间距 */
    .radio-group {
        display: flex !important;
        gap: 20px !important;
        margin-top: 4px !important;
    }

    /* 修复顶部标题排版（截图里标题上下也很大） */
    .box > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        margin-bottom: 10px !important;
    }

    .box > div:first-child h1 {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 20px !important;
    }

    .box > div:first-child p {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 14px !important;
    }
    .title-row {
        gap: 4px;
        flex-direction: column;
        align-items: flex-start;
    }
    /* 修复所在地下拉框（select）过高的问题 */
    .field-content .location-group select {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 8px !important;
        box-sizing: border-box !important;
        font-size: 14px !important;
        line-height: normal !important;
    }

    .field-content .location-group input {
        height: 40px !important;
        /*padding: 0 8px !important;*/
        box-sizing: border-box !important;
    }

    .field-content .location-group .btn-guide {
        height: 40px !important;
        min-height: 40px !important;
        line-height: 38px !important;
        margin: 0 !important;
    }

    .field-content .location-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    /* 土地の地番：输入框一行，两个按钮并排一行 */
    .lot-group {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .lot-group input {
        flex: 1 1 100% !important;   /* 输入框独占一行 */
        max-width: 100% !important;
        order: 1;
    }

    .lot-group #gmap-confirm,
    .lot-group #chiban-guide {
        flex: 1 1 0 !important;      /* 两个按钮平分一行 */
        width: auto !important;
        min-width: 0 !important;
        height: 40px !important;
        line-height: 38px !important;
        padding: 0 8px !important;
        order: 2;
        white-space: nowrap;
        font-size: 0.8rem !important; /* 避免文字被截断 */
    }

    .addr-input  { flex: 1; min-width: 0; }
    .pref-select { flex: 0 0 30%; }
    .row-inline   { gap: 6px; }
}
