@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Inter:wght@400;500;700&display=swap');

/* Reset and Base */
.form-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 10px auto 40px;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: #374151; /* gray-700 */
    font-size: 15px;
    line-height: 1.6;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
}

.form-wrapper * {
    box-sizing: border-box;
}

/* Header */
.form-main-title {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #ffffff;
    text-align: center;
    padding: 30px 20px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.05em;
    position: relative;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom: 4px solid #facc15; /* subtle accent */
}

/* Form Container */
.custom-contact-form {
    display: flex;
    flex-direction: column;
}

/* Rows (CSS Grid for modern layout) */
.custom-form-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    border-bottom: 1px solid #f3f4f6; /* gray-100 */
    transition: background-color 0.2s ease;
}

.custom-form-row:hover {
    background-color: #f8fafc; /* slate-50 */
}

.custom-form-row:last-of-type {
    border-bottom: none;
}

/* Left Column (Labels) */
.custom-form-label {
    padding: 30px 40px;
    font-weight: 700;
    color: #111827; /* gray-900 */
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap; /* allow badge to go next line if tight */
}

/* Required Badge */
.badge-required, .required-badge {
    background-color: #ff4d4d;
    color: #ffffff;
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 9999px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

/* Optional Badge */
.badge-optional, .optional-badge {
    background-color: #94a3b8;
    color: #ffffff;
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 9999px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

/* Hint Text */
.field-hint {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
    font-weight: 400;
}

/* Right Column (Inputs) */
.custom-form-inputs {
    padding: 30px 40px 30px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Alignments inside inputs */
.input-line {
    display: flex;
    align-items: center;
    gap: 16px;
}

.flex-inline-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Labels inline with inputs */
.label-width-1 {
    width: auto;
    min-width: 140px;
    color: #4b5563; /* gray-600 */
    font-weight: 600;
    font-size: 14px;
}
.label-width-2 {
    width: auto;
    min-width: 80px;
    color: #4b5563;
    font-weight: 600;
    font-size: 14px;
}

/* Specific Sizes */
.input-w-xs { width: 80px; text-align: center; }
.input-w-sm { width: 100px; text-align: center; }
.input-w-md { flex: 1; max-width: 250px; }
.input-w-lg { flex: 1; max-width: 400px; }
.input-w-xl { flex: 1; max-width: 400px; }
.input-textarea { width: 100%; min-height: 180px; resize: vertical; }
.input-select { width: 220px; max-width: 100%; }

/* Inputs and Textareas */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="file"],
textarea,
select {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2937;
    background-color: #f8fafc;
    transition: all 0.2s ease-in-out;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3b82f6; /* blue-500 */
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); /* blue glow */
}

input::placeholder, textarea::placeholder {
    color: #9ca3af;
}

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

/* Inline texts */
.inline-text {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
}

.hyphen {
    color: #9ca3af;
    font-weight: 700;
}

/* Address search Button */
.btn-zip-search {
    background-color: #f3f4f6; /* gray-100 */
    border: 1px solid #d1d5db;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #4b5563;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-zip-search:hover {
    background-color: #e5e7eb;
    color: #1f2937;
    border-color: #9ca3af;
}

/* Checkboxes and Radios */
.checkbox-group, .radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-label, .radio-label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 18px;
    border-radius: 10px;
    transition: all 0.2s ease;
    color: #334155;
    user-select: none;
    margin-bottom: 2px;
}

.checkbox-label:hover, .radio-label:hover {
    background-color: #f1f5f9;
}

/* Hide the native input but keep it accessible and clickable */
.checkbox-label input, .radio-label input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
    margin: 0;
}

/* The container for the text and custom graphic */
.checkbox-label > span, .radio-label > span {
    position: relative;
    padding-left: 32px; /* Space for custom button */
    font-weight: 500;
    font-size: 15px;
    line-height: 1.4;
    display: inline-block;
}

/* Common style for the custom box/circle */
.checkbox-label > span::before, .radio-label > span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-color: #fff;
    border: 2px solid #cbd5e1;
    transition: all 0.2s ease;
}

.radio-label span::before { border-radius: 50%; }
.checkbox-label span::before { border-radius: 4px; }

/* Checked State - Outer Box/Circle */
.checkbox-label input:checked + span::before,
.radio-label input:checked + span::before {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* Radio Dot */
.radio-label > span::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.15s;
}

/* Checkbox Checkmark */
.checkbox-label > span::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: translateY(-60%) rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s;
}

.checkbox-label input:checked + span::after,
.radio-label input:checked + span::after {
    opacity: 1;
}

/* Highlight the whole label when checked */
.checkbox-label:has(input:checked), .radio-label:has(input:checked) {
    background-color: #eff6ff;
    border-color: #3b82f6;
}

/* Section Divider */
.form-section-title {
    padding: 40px 40px 10px;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background-color: #3b82f6;
    border-radius: 999px;
}

/* Annotations */
.form-annotation {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

/* Submit Button */
.submit-row {
    padding: 40px;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.btn-submit {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    border: none;
    padding: 18px 80px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    border-radius: 9999px;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -5px rgba(59, 130, 246, 0.5);
}

/* Responsive */
@media screen and (max-width: 800px) {
    .custom-form-row { grid-template-columns: 1fr; }
    .custom-form-label { padding: 16px 16px 5px; }
    .custom-form-inputs { padding: 8px 16px 20px; }
    .label-width-1, .label-width-2 { min-width: unset; width: auto; margin-bottom: 4px; }
    .input-line {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    /* 郵便番号行だけ横並びを維持 */
    .input-line.align-center {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .input-w-xs { width: 70px; }
    .input-w-sm { width: 90px; }
    .input-w-md,
    .input-w-lg,
    .input-w-xl { max-width: 100%; width: 100%; flex: 1 1 100%; }
    .input-textarea { min-height: 140px; }
    .input-select { width: 100%; max-width: 100%; }
    .checkbox-group, .radio-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .section-footer-notes {
        font-size: 12px;
        line-height: 1.6;
    }
    .annotation-small {
        display: block;
        margin-top: 3px;
        font-size: 11px;
    }
    .form-section-title { padding: 20px 16px 8px; font-size: 15px; }
    .submit-row { padding: 24px 16px; }
    .btn-submit { width: 100%; padding: 16px; font-size: 16px; }
    .form-main-title { font-size: 17px; padding: 20px 16px; }
}
