/* 공통 스타일 */
.hdbc-form {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}

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

.hdbc-field {
    margin-bottom: 20px;
}

.hdbc-field label,
.hdbc-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.hdbc-required {
    color: #d63638;
    font-weight: normal;
}

.hdbc-field input[type="text"],
.hdbc-field input[type="email"],
.hdbc-field input[type="tel"],
.hdbc-field input[type="date"],
.hdbc-field input[type="file"],
.hdbc-field textarea,
.hdbc-field select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.hdbc-field input[type="text"]:focus,
.hdbc-field input[type="email"]:focus,
.hdbc-field input[type="tel"]:focus,
.hdbc-field input[type="date"]:focus,
.hdbc-field textarea:focus,
.hdbc-field select:focus {
    outline: none;
    border-color: #00003f;
    box-shadow: 0 0 0 3px rgba(0, 0, 63, 0.1);
}

.hdbc-field textarea {
    resize: vertical;
    min-height: 120px;
}

/* 라디오/체크박스 그룹 */
.hdbc-radio-group,
.hdbc-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hdbc-radio-group label,
.hdbc-checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.hdbc-radio-group input[type="radio"],
.hdbc-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 약관 필드 */
.hdbc-terms-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hdbc-terms-field label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.hdbc-terms-field input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top:0;
}

.hdbc-terms-detail {
    color: #afafcf;
    text-decoration: underline;
    font-size: 13px;
}

.hdbc-terms-detail:hover {
    color: #33357a;
}

/* HTML 콘텐츠 */
.hdbc-html-content {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* 필드 설명 */
.hdbc-field-description {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #666;
}

/* 제출 버튼 */
.hdbc-submit-wrap {
    margin-top: 30px;
    text-align: center;
}

.hdbc-submit-btn {
    background: #00003f;
    color: #fff;
    border: none;
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.hdbc-submit-btn:hover {
    background: #33357a;
    transform: translateY(-1px);
}

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

.hdbc-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 에러 스타일 */
.hdbc-field.hdbc-error input,
.hdbc-field.hdbc-error textarea,
.hdbc-field.hdbc-error select {
    border-color: #d63638;
}

.hdbc-error-message {
    color: #d63638;
    font-size: 14px;
    margin-top: 5px;
}

/* 기본형 스킨 (default) */
.hdbc-skin-default {
    max-width: 100%;
    margin: 0 auto;
}

.hdbc-skin-default .hdbc-form-fields-wrap {
    display: block;
}

.hdbc-skin-default .hdbc-submit-btn {
    width: 100%;
}

/* 가로형 스킨 (horizontal) - 완전 재작성 */
.hdbc-skin-horizontal {
    max-width: 100%;
}

/* 가로형 메인 컨테이너 */
.hdbc-skin-horizontal .hdbc-horizontal-row {
    display: flex !important;
    gap: 5px;
    align-items: flex-end;
    width: 100%;
}

/* 가로형 필드 컨테이너 */
.hdbc-skin-horizontal .hdbc-form-fields-wrap {
    flex: 1;
    display: flex !important;
    gap: 5px;
    align-items: flex-end;
}

/* 가로형 필드 */
.hdbc-skin-horizontal .hdbc-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    display: block !important; /* 모든 필드 표시 */
}

/* 가로형 라벨 */
.hdbc-skin-horizontal .hdbc-field label,
.hdbc-skin-horizontal .hdbc-field-label {
    font-size: 13px;
    color:#fff;
}

/* 가로형 입력 필드 */
.hdbc-skin-horizontal .hdbc-field input[type="text"],
.hdbc-skin-horizontal .hdbc-field input[type="email"],
.hdbc-skin-horizontal .hdbc-field input[type="tel"],
.hdbc-skin-horizontal .hdbc-field input[type="date"],
.hdbc-skin-horizontal .hdbc-field select,
.hdbc-skin-horizontal .hdbc-field textarea {
    padding: 10px 14px;
    font-size: 15px;
}

/* 가로형 텍스트에어리어 특별 처리 */
.hdbc-skin-horizontal .hdbc-field textarea {
    min-height: 44px;
    resize: none;
}

/* 가로형 제출 버튼 */
.hdbc-skin-horizontal .hdbc-submit-wrap {
    margin-top: 0;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
}

.hdbc-skin-horizontal .hdbc-submit-btn {
    padding: 10px 30px;
    font-size: 16px;
    white-space: nowrap;
    height: 44px;
}

/* 가로형 약관동의 */
.hdbc-skin-horizontal .hdbc-terms-row {
    margin-top: 5px;
    text-align: center;
}

/* 가로형 체크박스/라디오 그룹 */
.hdbc-skin-horizontal .hdbc-radio-group,
.hdbc-skin-horizontal .hdbc-checkbox-group {
    flex-direction: row;
    gap: 5px;
}

/* 반응형 처리 */
@media (max-width: 768px) {
    .hdbc-skin-horizontal .hdbc-horizontal-row {
        align-items: stretch;
    }
    
    .hdbc-skin-horizontal .hdbc-form-fields-wrap {
    }
    
    .hdbc-skin-horizontal .hdbc-field {
    }
    
    .hdbc-skin-horizontal .hdbc-field textarea {
        min-height: 120px;
    }
    
    .hdbc-skin-horizontal .hdbc-submit-wrap {
    }
    
    .hdbc-skin-horizontal .hdbc-submit-btn {
        width: 100%;
        padding: 14px 30px;
    }
}

/* 팝업 (프론트엔드용) */
#hdbc-terms-popup-front {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
}

#hdbc-terms-popup-front .hdbc-popup-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 50px auto;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

#hdbc-terms-popup-front .hdbc-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hdbc-terms-popup-front .hdbc-popup-close:hover {
    color: #000;
}

#hdbc-terms-popup-front .hdbc-terms-title {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #00003f;
    color: #00003f;
}

#hdbc-terms-popup-front .hdbc-terms-content {
    line-height: 1.6;
    color: #333;
}

/* 애니메이션 */
.hdbc-form input,
.hdbc-form textarea,
.hdbc-form select,
.hdbc-form button {
    transition: all 0.2s ease;
}

/* 로딩 상태 */
.hdbc-form.hdbc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.hdbc-form.hdbc-loading .hdbc-submit-btn:after {
    content: '...';
    animation: hdbc-loading 1s infinite;
}

@keyframes hdbc-loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* 스크롤 방지 */
body.hdbc-no-scroll {
    overflow: hidden !important;
}

/* 라벨이 없는 필드 스타일 조정 */
.hdbc-field > input:first-child,
.hdbc-field > textarea:first-child,
.hdbc-field > select:first-child {
    margin-top: 0;
}

/* 가로형에서 라벨이 없는 필드 */
.hdbc-skin-horizontal .hdbc-field > input:first-child,
.hdbc-skin-horizontal .hdbc-field > textarea:first-child,
.hdbc-skin-horizontal .hdbc-field > select:first-child {
    margin-top: 0;
}

/* 전화번호 필드 스타일 */
.hdbc-field input[type="tel"] {
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* 전화번호 필드 포커스 시 */
.hdbc-field input[type="tel"]:focus {
    background-color: #fafafa;
}