/* 폼 컨테이너 */
.form-container {
    max-width: 900px;
    margin: 0 auto;
}

/* 폼 섹션 */
.form-section {
    background: #ffffff;
    padding: 2rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
    font-weight: 700;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

/* 폼 행 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
}

/* 폼 그룹 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9375rem;
}

.required {
    color: #dc3545;
    font-weight: 700;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9375rem;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* 라디오 버튼 그룹 */
.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.radio-label input[type="radio"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.radio-label input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

.radio-label span {
    color: var(--gray-700);
}

/* 체크박스 그룹 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9375rem;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.625rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* 파일 입력 */
input[type="file"] {
    padding: 1rem !important;
    border: 2px dashed var(--gray-300) !important;
    background: var(--gray-50);
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--primary) !important;
    background: var(--gray-100);
}

/* 버튼 기본 스타일 */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Noto Sans KR', sans-serif;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-700);
}

/* 버튼 영역 */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-200);
}

.form-actions .btn {
    min-width: 140px;
}

/* 결과 메시지 */
.result-message {
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease;
    border: 1px solid;
}

.result-message.success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.result-message.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

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

/* 반응형 디자인 */
@media (max-width: 768px) {
    .form-section {
        padding: 1.5rem;
    }

    .form-section h3 {
        font-size: 1.125rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* 입력 검증 스타일 */
input:invalid:not(:placeholder-shown),
select:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

input:valid:not(:placeholder-shown):not([type="file"]),
select:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
}

/* 로딩 상태 */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Select 박스 스타일 개선 */
.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Textarea 스타일 */
.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 주민등록번호 입력 그룹 */
.id-number-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.id-number-group input {
    flex: 0 0 auto;
    text-align: center;
}

.id-number-group input:first-child {
    width: 150px;
}

.id-number-group input:nth-child(3) {
    width: 50px;
}

.id-number-group span {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 1.25rem;
}

/* 우편번호 검색 그룹 */
.postcode-group {
    display: flex;
    gap: 0.5rem;
}

.postcode-group input {
    flex: 1;
}

.btn-postcode {
    padding: 0.75rem 1.25rem;
    background: var(--gray-600);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: 'Noto Sans KR', sans-serif;
}

.btn-postcode:hover {
    background: var(--gray-700);
}

/* 반응형: 주민등록번호 */
@media (max-width: 480px) {
    .id-number-group {
        flex-wrap: nowrap;
    }

    .id-number-group input:first-child {
        width: 120px;
    }

    .id-number-group input:nth-child(3) {
        width: 40px;
    }
}
