/* ============================================
   CSS 변수 정의
   ============================================ */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #5ba3f5;
    --accent-color: #6bb6ff;
    --dark-color: #357abd;
    --light-color: #e8f4fd;
}

/* ============================================
   기본 레이아웃
   ============================================ */
.row {
    --bs-gutter-x: 5px !important;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.main-content {
    flex: 1;
    padding-bottom: 20px;
}

footer {
    background-color: #212529;
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

.page-header {
    margin-top: 20px;
}

/* ============================================
   네비게이션
   ============================================ */
.navbar {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 50%, var(--dark-color) 100%);
    position: relative;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
}

.navbar-nav .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* ============================================
   버튼
   ============================================ */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.creditor-add-btn {
    padding: 0;
}

/* ============================================
   카드
   ============================================ */
.card {
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 
        0 4px 12px rgba(74, 144, 226, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(74, 144, 226, 0.1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 50%, var(--dark-color) 100%);
    opacity: 0.8;
}

.card-header.bg-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 50%, var(--dark-color) 100%) !important;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.2),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    position: relative;
}

.card-header.bg-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
}

.card-body {
    padding: 8px 12px;
}

.card-body .creditor-modify-btn:focus {
    background-color: var(--primary-color);
    color: white;
}

/* ============================================
   히어로 섹션
   ============================================ */
.hero-section {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 50%, var(--dark-color) 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 3rem;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
}

/* ============================================
   폼 관련
   ============================================ */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.required-field::after {
    content: " *";
    color: red;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--primary-color);
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.2;
}

.form-section-title i {
    color: var(--primary-color);
    font-size: 0.85rem;
}

input::placeholder {
    color: #ddd !important;
}

/* ============================================
   테이블
   ============================================ */
/* 테이블 셀 텍스트 말줄임표 처리 */
.card-body .table td {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-body .table td:first-child,
.card-body .table td:last-child {
    max-width: none;
    white-space: normal;
}

/* 특정 컬럼에 최대 너비 설정 */
.card-body .table td:nth-child(2) { /* 신청서 제목 */
    max-width: 150px;
}

.card-body .table td:nth-child(3) { /* 신청자명 */
    max-width: 100px;
}

.card-body .table td:nth-child(4) { /* 주소 */
    max-width: 200px;
}

.card-body .table td:nth-child(5) { /* 핸드폰 */
    max-width: 120px;
}

.card-body .table td:nth-child(6) { /* 사건번호 */
    max-width: 120px;
}

.card-body .table td:nth-child(7) { /* 작성일 */
    max-width: 140px;
}

/* 테이블 내 버튼 호버 효과 */
.card-body .table .btn {
    transition: all 0.2s ease;
}

.card-body .table .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* ============================================
   페이지네이션
   ============================================ */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
}

.pagination .page-link:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
    cursor: not-allowed;
}

/* ============================================
   아코디언
   ============================================ */
.accordion-section {
    padding: 5px 10px;
    margin-bottom: 0.4rem !important;
}

.accordion-header {
    cursor: pointer;
    user-select: none;
    padding: 0.3rem 0.4rem;
    margin: -0.25rem -0.4rem;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    margin-bottom: 0 !important;
    min-height: auto;
}

.accordion-header:hover {
    background-color: rgba(74, 144, 226, 0.1);
}

.accordion-header[aria-expanded="true"] .accordion-icon {
    transform: rotate(180deg);
}

.accordion-icon {
    transition: transform 0.3s ease;
    font-size: 0.7rem;
    color: #6c757d;
}

.accordion-body {
    padding-top: 0.5rem;
    padding-bottom: 10px;
}

/* ============================================
   사이드바 폼
   ============================================ */
.sticky1 {
    position: sticky;
    top: 0px;
    z-index: 400;
    background: white;
}

.sidebar-form {
    background: #fff;
    padding: 0px 15px 10px;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 75vh;
    position: sticky;
    top: 130px;
    z-index: 400;
}

.sidebar-form h5 {
    background: #fff;
    position: sticky;
    top: 0px;
    padding-top: 10px;
    z-index: 400;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.sidebar-form .form-label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.sidebar-form .form-control {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.sidebar-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.15);
    outline: none;
}

.sidebar-form .mb-3 {
    margin-bottom: 1rem !important;
}

.sidebar-form .nav-tabs {
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.sidebar-form .nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: 0.25rem;
    border-top-right-radius: 0.25rem;
    padding: 0.5rem 1rem;
    color: #495057;
    background-color: transparent;
    border-color: transparent;
}

.sidebar-form .nav-tabs .nav-link.active {
    color: #495057;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

.sidebar-form .tab-content {
    width: 100%;
}

/* ============================================
   템플릿 관련
   ============================================ */
.template-highlight {
    background-color: #fff3cd !important;
    border: 1px solid #ffc107 !important;
    border-radius: 3px !important;
    animation: highlightPulse 0.5s ease-in-out;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5) !important;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.9);
    }
    100% {
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    }
}

.one_page {
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    width: 210mm;
    min-height: 297mm;
    padding: 20mm 15mm;
}

.template-content {
    font-size: 14px;
    background: white;
    margin: 0 auto;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    transform: scale(0.9);
    transform-origin: top left;
}

.template-content span {
    display: inline-block;
    min-width: 70px;
    min-height: 20px;
    box-sizing: border-box;
    cursor: pointer;
}

.template-content td span {
    min-width: 20px;
    min-height: 20px;
}

/* 템플릿 반응형 스타일 */
@media (max-width: 1400px) {
    .template-content {
        transform: scale(0.78);
        transform-origin: top left;
    }
}

@media (max-width: 1200px) {
    .template-content {
        transform: scale(0.67);
        transform-origin: top left;
    }
}

@media (max-width: 992px) {
    .template-content {
        transform: scale(0.8);
        transform-origin: top left;
    }
}

@media (max-width: 768px) {
    .template-content {
        transform: scale(0.7);
        transform-origin: top left;
    }
}

@media (max-width: 576px) {
    .template-content {
        transform: scale(0.6);
        transform-origin: top left;
    }
}

/* ============================================
   주소찾기 팝업
   ============================================ */
.addr-popup-body {
    font-family: "Malgun Gothic", "맑은 고딕", sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
}

.addr-popup-header {
    background: #1e3a8a;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.addr-popup-header-title {
    font-size: 16px;
    font-weight: bold;
}

.addr-popup-close-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.addr-popup-close-btn:hover {
    background: #2563eb;
}

.addr-popup-container {
    max-width: 600px;
    padding: 20px;
}

.addr-popup-search-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#daumPostcodeContainer {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.addr-popup-search-example {
    color: #666;
    font-size: 12px;
    margin-top: 10px;
    line-height: 1.5;
}

.addr-popup-address-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.addr-popup-section-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.addr-popup-address-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.addr-popup-address-row:last-child {
    margin-bottom: 0;
}

.addr-popup-address-label {
    width: 120px;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}

.addr-popup-address-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.addr-popup-address-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.addr-popup-address-input[readonly] {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

.addr-popup-address-hint {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.addr-popup-submit-btn {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.addr-popup-submit-btn:hover {
    background: #2563eb;
}

.addr-popup-submit-btn:active {
    background: #1d4ed8;
}

/* ============================================
   모달
   ============================================ */
/* 채권자 추가 모달이 비활성화될 때 회색 처리 */
#creditorViewModal.modal-disabled {
    pointer-events: none;
}

#creditorViewModal.modal-disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1056;
    border-radius: 0.375rem;
}

#creditorViewModal.modal-disabled .modal-content {
    filter: grayscale(80%);
    position: relative;
}

#creditorListModal .modal-body {
    min-height: 590px;
    overflow-y: auto;
}

/* ============================================
   리스트 아이템
   ============================================ */
.card-body .item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

.card-body .item .form-label {
    margin-bottom: 0;
}

/* 경력 아이템 */
.card-body .career-item.item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .career-item.item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

.card-body .career-item .middle{
    vertical-align: middle;
}

/* 재산 아이템 */
.card-body .property-item.item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .property-item.item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

/* 법적 조치 아이템 */
.card-body .legal-action-item.item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .legal-action-item.item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

/* 파산 후 채무 아이템 */
.card-body .debt-after-insolvency-item.item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .debt-after-insolvency-item.item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

/* 가족 아이템 */
.card-body .family-item.item {
    padding-top: 15px;
    padding-bottom: 15px;
}

.card-body .family-item.item:not(:last-child) {
    border-bottom: 1px solid #dee2e6;
}

.card-body .family-item.item .form-label {
    margin-bottom: 0;
    vertical-align: middle;
    margin-top: 5px;
}

/* ============================================
   유틸리티
   ============================================ */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

#alertContainer{
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
}