:root {
    --primary-color: #2b2b2b;
    --text-color: #333333;
    --border-color: #d1d5db;
    --bg-color: #f9fafb;
    --error-color: #ef4444;
    --brand-blue: #3b82f6;
    --font-family: 'Inter', 'Noto Sans JP', sans-serif;
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    padding: 20px;
}

.form-wrapper {
    max-width: 800px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 40px;
}

.form-header {
    margin-bottom: 40px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 30px;
}

.form-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.form-header .description {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 20px;
}

.info-box {
    background-color: #f3f4f6;
    padding: 20px;
    border-radius: 8px;
    font-size: 13px;
    color: #4b5563;
}

.info-box h4 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-size: 14px;
}

.info-box h4:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 30px;
    border: none;
    padding: 0;
}

.form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.hint {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    line-height: 1.4;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-required {
    background-color: #fee2e2;
    color: var(--error-color);
}

.badge-optional {
    background-color: #e5e7eb;
    color: #4b5563;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--text-color);
    transition: var(--transition);
    background-color: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-blue);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: #9ca3af;
}

/* Radio buttons grouping */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.radio-horizontal {
    flex-direction: row;
    gap: 24px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
}

.radio-group input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--brand-blue);
}

.box-style label {
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: 6px;
    transition: var(--transition);
    background-color: #fafafa;
}

.box-style label:hover {
    border-color: #9ca3af;
    background-color: #f3f4f6;
}

.box-style input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--brand-blue);
}

.box-style input[type="radio"]:checked ~ label {
    border-color: var(--brand-blue);
    background-color: #eff6ff;
}

/* Flex rows */
.flex-row {
    display: flex;
    gap: 16px;
}

.flex-half {
    flex: 1;
}

/* Address Box */
.address-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 200px;
}

.zip-input {
    flex: 1;
}

.select-input {
    appearance: none;
    max-width: 300px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234B5563%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 10px auto;
}

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

/* Terms box */
.terms-box-wrapper {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

.terms-scroll-box {
    margin-top: 16px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 16px;
    height: 200px;
    overflow-y: auto;
    font-size: 13px;
    color: #4b5563;
    border-radius: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: var(--brand-blue);
}

.checkbox-label a {
    color: var(--brand-blue);
    text-decoration: underline;
}

/* Submit Section */
.submit-wrapper {
    margin-top: 50px;
    text-align: center;
}

.btn-submit {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 18px 60px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.btn-submit:hover {
    background-color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.15);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Validation Styles */
.error-msg {
    color: var(--error-color);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    display: none;
    animation: fadeIn 0.3s;
}

.form-group.has-error .form-control {
    border-color: var(--error-color);
    background-color: #fef2f2;
}

.form-group.has-error .error-msg {
    display: block;
}

/* Hide conditional sections initially */
.item-detail-box {
    display: none;
    margin-top: 20px;
    padding: 24px;
    background-color: #f8fafc;
    border-left: 4px solid var(--brand-blue);
    border-radius: 0 8px 8px 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
    .form-wrapper {
        padding: 24px;
        margin: 20px auto;
    }
    .flex-row {
        flex-direction: column;
        gap: 12px;
    }
    .radio-horizontal {
        flex-direction: column;
        gap: 12px;
    }
    .btn-submit {
        width: 100%;
        padding: 16px 20px;
    }
}

/* Site Navbar & Footer */
.site-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1000px;
    margin: 0 auto;
}

.site-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.site-footer {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 30px 20px;
    text-align: center;
    margin-top: 60px;
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    font-size: 13px;
    color: #9ca3af;
}

main {
    min-height: calc(100vh - 200px);
}

/* Dynamics Sub-fields */
.sub-fields-wrapper {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    margin-top: 15px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sub-form-group {
    margin-bottom: 20px;
    padding: 0;
    border: none;
}
.sub-form-group:last-child {
    margin-bottom: 0;
}
