/* ===== 공통 카드 그리드 ===== */
.client-grid,
.loan-grid {
    --gap: 1rem;
    display: grid;
    gap: var(--gap);
    width: 100%;
    box-sizing: border-box;
}

.client-grid > *,
.loan-grid > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .client-grid, .loan-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}
@media (min-width: 992px) {
    .client-grid, .loan-grid {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
}
@media (min-width: 1400px) {
    .client-grid, .loan-grid {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }
}

/* ===== 공통 카드 프레임 ===== */
.client-card.card,
.loan-card.card { height: 100%; display: flex; flex-direction: column; }
.client-card .card-header,
.loan-card .card-header { background: var(--bs-light); }

/* ===== 타이틀/서브/메타 ===== */
.client-title, .lc-title { font-weight: 700; }
.client-sub, .lc-sub { color: var(--bs-secondary-color, #6c757d); font-size: .95rem; }
.client-meta, .lc-meta { font-size: .9rem; }

/* ===== 금액 박스 그리드 ===== */
.client-amounts,
.lc-amounts,
.lc-amounts2 { display: grid; gap: .5rem; }
.client-amounts,
.lc-amounts { grid-template-columns: 1fr 1fr 1fr; }
.lc-amounts2 { grid-template-columns: 1fr 1fr; }
@media (min-width: 768px) {
    .lc-amounts2 { grid-template-columns: 1fr 1fr 1fr; }
}
.client-amounts .box,
.lc-amounts .box,
.lc-amounts2 .box,
.lc-paid { background: var(--bs-gray-100); border-radius: .5rem; padding: .5rem .75rem; }
.client-amounts .label,
.lc-amounts .label,
.lc-amounts2 .label { font-size: .8rem; color: #6c757d; }
.client-amounts .value,
.lc-amounts .value,
.lc-amounts2 .value { font-weight: 700; text-align: right; }

/* ===== 액션 그리드 ===== */
.client-actions, .lc-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.client-actions .btn,
.lc-actions .btn {
    white-space: normal !important;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: clip;
    min-height: 2.5rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
    margin: 0;
}

@media (min-width: 576px) {
    .client-actions, .lc-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .client-actions .btn,
    .lc-actions .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (min-width: 768px) {
    .client-actions .btn,
    .lc-actions .btn {
        font-size: 0.9rem;
        padding: 0.5rem 0.875rem;
    }
}

/* ===== 배지/테두리 강조 ===== */
.badge-due, .badge-deli { font-size: .75rem; }
.lc-border-danger { border: 1.5px solid var(--bs-danger); }
.lc-border-warning { border: 1.5px solid var(--bs-warning); }

/* ===== 메모 상태 라인 높이 통일 ===== */
.memo-status { min-height: 1.1rem; }


/* ===== Payment Pair Card (이자·주차비 세트) ===== */
.payment-grid {
    --gap: 1rem;
    display: grid;
    gap: var(--gap);
    width: 100%;
    box-sizing: border-box;
}

.payment-grid > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .payment-grid {
        grid-template-columns: repeat(1, minmax(0,1fr));
    }
}
@media (min-width: 992px) {
    .payment-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}
@media (min-width: 1400px){
    .payment-grid {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
}

.payment-card.card {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 400px; /* 최소 높이 설정 */
}
.payment-card .card-header { background: var(--bs-light); }
.payment-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.payment-card .pair-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
@media (min-width: 576px) {
    .payment-card .pair-grid {
        flex-direction: row;
    }
}
.pay-meta { font-size: .9rem; color: #6c757d; }

.pair-grid { display: grid; gap: .75rem; }
@media (min-width: 576px) { .pair-grid { grid-template-columns: 1fr 1fr; } }

.pair-box {
    background: var(--bs-gray-100);
    border-radius: .75rem;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 200px; /* 최소 높이 설정으로 카드 높이 통일 */
    flex: 1; /* flex로 높이 맞춤 */
}
.pair-head { display:flex; align-items:center; justify-content:space-between; }
.pair-title { font-weight:700; }
.pair-amount { font-weight:800; font-size:1.05rem; text-align:right; }
.pair-sub { font-size:.85rem; color:#6c757d; display:flex; gap:.5rem; align-items:center; }
.pair-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto; /* 하단 정렬 */
}

.pair-actions .btn {
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
}

/* 날짜 입력 필드가 잘리지 않도록 */
.pair-actions form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.pair-actions input[type="date"] {
    width: 100% !important;
    min-width: 140px !important;
    box-sizing: border-box;
}

/* 일부상환 버튼이 겹치지 않도록 */
.pair-actions > button {
    width: 100%;
    margin: 0;
}

.badge-pay { font-size:.75rem; }
.bg-overdue { background-color: var(--bs-danger-bg-subtle)!important; }

.client-name-xl { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.2px; }
.client-subline { font-size: .92rem; color: #6c757d; }

.parking-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .55rem; border-radius: 999px;
    background: #e7f1ff; color: #0d6efd; font-weight: 700; font-size: .85rem;
    border: 1px solid rgba(13,110,253,.25);
}
.parking-chip .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: .75; }


@media (max-width: 576px) {
    h2.fw-bold { font-size: 1.25rem; }
    .card .display-6 { font-size: 1.5rem; }
    .fc .fc-toolbar-title { font-size: 1rem; }
    .fc .fc-button { padding: .25rem .5rem; font-size: .875rem; }
    .legend .chip { display:inline-flex; align-items:center; gap:.25rem; margin-right:.5rem; font-size:.85rem; }
}
/* FullCalendar 고정 이벤트 텍스트 컬러 */
.fc-sticky { color:#111; }

/* 레전드 공통 */
.legend { display:flex; flex-wrap:wrap; gap:.5rem 1rem; align-items:center; }
.legend .chip { display:inline-flex; align-items:center; gap:.375rem; }
.legend .swatch { display:inline-block; width:.9rem; height:.9rem; border-radius:.15rem; }

/* 색상 스와치(대시보드 범례) */
.swatch-int-unpaid   { background:#FFB3B3; }
.swatch-int-paid     { background:#A5C8FF; }
.swatch-park-unpaid  { background:#FFE7A1; }
.swatch-park-paid    { background:#A8E6A1; }
.swatch-principal    { background:#D7B9FF; }
.swatch-refund       { background:#FF6B6B; }

/* 상단 배지 모음 줄바꿈 간격 */
.badge-row { display:flex; flex-wrap:wrap; gap:.35rem .5rem; align-items:center; }

/* 카드 4분할 영역 공통 여백 균일화 */
.dash-cards .card { height:100%; }
/* ===== 버튼 개선 ===== */
.btn {
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    border-radius: 0.375rem;
    box-sizing: border-box !important;
    max-width: 100%;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* 버튼이 컨테이너를 벗어나지 않도록 */
.btn,
.btn-group .btn,
.input-group .btn {
    max-width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
    border: none;
}

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.lc-border-danger {
    background-color: var(--bs-danger-bg-subtle) !important;
}

.lc-border-warning {
    background-color: var(--bs-warning-bg-subtle) !important;
}

/* ===== 반응형 테이블 ===== */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

/* ===== 차량관리 페이지 모바일 최적화 ===== */
.vehicle-table-wrapper {
    width: 100%;
    box-sizing: border-box;
    overflow-x: visible;
}

.vehicle-location-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.vehicle-location-form .form-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.vehicle-update-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .vehicle-location-form {
        flex-direction: row;
        gap: 0.5rem;
    }

    .vehicle-location-form .form-select {
        flex: 1;
        min-width: 0;
    }

    .vehicle-update-btn {
        width: auto;
        flex-shrink: 0;
    }
}

@media (max-width: 575px) {
    .vehicle-table-wrapper {
        overflow-x: visible;
        width: 100%;
        max-width: 100%;
    }

    .vehicle-table-wrapper .table {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .vehicle-table-wrapper .table thead {
        display: none;
    }

    .vehicle-table-wrapper .table tbody {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .vehicle-table-wrapper .table tbody tr {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-bottom: 1rem;
        border: 1px solid var(--bs-gray-300);
        border-radius: 0.375rem;
        padding: 0.75rem;
        box-sizing: border-box;
        background: white;
    }

    .vehicle-table-wrapper .table tbody td {
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 0.5rem 0;
        border: none;
        white-space: normal;
        text-align: left;
        box-sizing: border-box;
    }

    .vehicle-table-wrapper .table tbody td:first-child:before {
        content: "고객명: ";
        font-weight: 600;
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--bs-secondary);
        font-size: 0.85rem;
    }

    .vehicle-table-wrapper .table tbody td:nth-child(2):before {
        content: "모델: ";
        font-weight: 600;
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--bs-secondary);
        font-size: 0.85rem;
    }

    .vehicle-table-wrapper .table tbody td:nth-child(3):before {
        content: "차량번호: ";
        font-weight: 600;
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--bs-secondary);
        font-size: 0.85rem;
    }

    .vehicle-table-wrapper .table tbody td:nth-child(4):before {
        content: "차량 위치: ";
        font-weight: 600;
        display: block;
        margin-bottom: 0.5rem;
        color: var(--bs-secondary);
        font-size: 0.85rem;
    }
}

/* ===== 반응형 폼 ===== */
@media (max-width: 576px) {
    .form-control,
    .form-select {
        font-size: 16px; /* iOS 줌 방지 */
    }

    .btn {
        width: 100%;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    .row.g-2 > *,
    .row.g-3 > * {
        margin-bottom: 0.5rem;
    }
}

/* ===== 반응형 카드 그리드 개선 ===== */
@media (max-width: 575px) {
    .client-grid,
    .loan-grid,
    .payment-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .client-actions,
    .lc-actions {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.375rem;
    }

    .client-actions .btn,
    .lc-actions .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
        min-height: 2rem;
    }
}

/* ===== Loan Card 추가 스타일 ===== */
.lc-extra {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: .5rem;
    width: 100%;
    box-sizing: border-box;
}

.lc-extra .box {
    background: var(--bs-gray-100);
    border-radius: .5rem;
    padding: .5rem .75rem;
}

.lc-extra .label {
    font-size: .8rem;
    color: #6c757d;
}

.lc-extra .value {
    font-weight: 700;
    text-align: right;
}

.lc-paid {
    font-size: .92rem;
    background: var(--bs-gray-100);
    border-radius: .5rem;
    padding: .5rem .75rem;
}

/* ===== FullCalendar 스타일 ===== */
.fc-sticky {
    color: #111;
}

/* ===== 모바일 최적화 ===== */
@media (max-width: 576px) {
    .card .display-6 {
        font-size: 1.5rem;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem;
    }

    .fc .fc-button {
        padding: .25rem .5rem;
        font-size: .875rem;
    }
}

/* ===== 모바일 네비게이션 개선 ===== */
@media (max-width: 991px) {
    .navbar-nav {
        padding-top: 1rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 0;
    }
}

/* ===== 네비게이션 활성 상태 ===== */
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    font-weight: 600;
}

.navbar-nav .nav-link span {
    margin-right: 0.25rem;
}

.dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
}

.dropdown-item.active {
    background-color: var(--bs-primary);
    color: white;
}

/* ===== 접근성 개선 ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* ===== 인쇄 스타일 ===== */
@media print {
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }
}

/* ===== 폼 레이아웃 개선 ===== */
.form-section {
    background: var(--bs-gray-50);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bs-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-primary);
}

/* ===== 폼 컨트롤 개선 ===== */
.form-control,
.form-select {
    transition: all 0.2s ease;
    border: 1px solid #ced4da;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* 모달 내부 폼 컨트롤은 transform 효과 없음 */
.modal .form-control:focus,
.modal .form-select:focus {
    transform: none;
}

.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) {
    border-color: #adb5bd;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* ===== 입력 그룹 개선 ===== */
.input-group .form-control:focus {
    z-index: 3;
}

.input-group-text {
    background-color: var(--bs-gray-100);
    border-color: #ced4da;
}

/* ===== 버튼 그룹 개선 ===== */
.btn-group-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.btn-group-responsive .btn {
    max-width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 576px) {
    .btn-group-responsive {
        flex-direction: column;
    }

    .btn-group-responsive .btn {
        width: 100%;
        max-width: 100%;
    }
}

/* d-grid d-sm-flex 같은 유틸리티 클래스와 함께 사용되는 버튼 */
.d-grid .btn,
.d-sm-flex .btn {
    max-width: 100%;
    box-sizing: border-box;
}

.d-grid .btn {
    width: 100%;
}

/* ===== 카드 액션 버튼 개선 ===== */
.card-footer {
    padding: 1rem;
    overflow: hidden;
    box-sizing: border-box;
}

.card-footer .btn {
    white-space: normal !important;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: clip;
    min-height: 2.5rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.card-footer form {
    width: 100%;
    margin: 0;
}

.card-footer form .btn {
    width: 100%;
}

@media (max-width: 576px) {
    .card-footer {
        padding: 0.75rem;
    }

    .card-footer .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.5rem;
        min-height: 2.25rem;
    }
}

/* ===== 버튼 텍스트 잘림 방지 ===== */
.btn {
    white-space: normal !important;
    word-break: keep-all;
    overflow: hidden !important;
    text-overflow: clip !important;
    box-sizing: border-box !important;
    max-width: 100%;
}

/* 그리드 내부 버튼은 컨테이너에 맞춤 */
.client-actions,
.lc-actions {
    width: 100%;
    box-sizing: border-box;
}

.client-actions > *,
.lc-actions > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}


/* ===== 카드 개선 ===== */
.card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--bs-primary);
}

/* 모달 내부 카드는 hover 효과 없음 */
.modal .card:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.client-card:hover,
.loan-card:hover,
.payment-card:hover {
    border-color: var(--bs-primary);
}

.card-header {
    font-weight: 600;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1rem;
    overflow: hidden;
    box-sizing: border-box;
}

.card-body {
    overflow: hidden;
    box-sizing: border-box;
    padding: 1rem;
}

@media (max-width: 576px) {
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.5rem 0.75rem;
    }
}

/* ===== 테이블 개선 ===== */
.table th {
    font-weight: 600;
    background-color: var(--bs-gray-100);
    border-bottom: 2px solid var(--bs-gray-300);
    padding: 0.75rem;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--bs-gray-50);
    cursor: pointer;
}

.table tbody tr {
    border-bottom: 1px solid var(--bs-gray-200);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table-bordered {
    border: 1px solid var(--bs-gray-300);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--bs-gray-300);
}

/* ===== 모달 개선 ===== */
.modal-header {
    border-bottom: 2px solid var(--bs-gray-200);
    background-color: var(--bs-gray-50);
    border-radius: 0.375rem 0.375rem 0 0;
}

.modal-footer {
    border-top: 2px solid var(--bs-gray-200);
    background-color: var(--bs-gray-50);
    border-radius: 0 0 0.375rem 0.375rem;
}

.modal-content {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 1.5rem;
    overflow: auto;
}

.btn-close {
    transition: transform 0.2s ease;
}

.btn-close:hover {
    transform: rotate(90deg);
}

/* ===== 모달 개선 ===== */
/* 모달은 항상 viewport 기준으로 고정 위치 - 부모 요소의 transform/perspective/filter 영향 제거 */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1055 !important;
    display: none;
    width: 100vw !important;
    height: 100vh !important;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    margin: 0 !important;
    padding: 0 !important;
    /* 부모 요소의 transform/perspective/filter 영향 제거 */
    transform: none !important;
    perspective: none !important;
    filter: none !important;
    /* containing block 생성 방지 */
    contain: none !important;
}

.modal.show {
    display: block !important;
}

.modal-dialog {
    position: relative !important;
    width: auto;
    margin: 1.75rem auto !important;
    pointer-events: none;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    will-change: auto !important;
    /* transition 완전 제거 */
    transition: none !important;
    animation: none !important;
}

.modal.show .modal-dialog {
    pointer-events: auto;
}

.modal-content {
    position: relative !important;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.375rem;
    outline: 0;
    /* 위치 고정 */
    transform: none !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    will-change: auto !important;
}

.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1050 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #000;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* 모달 애니메이션 완전 제거 - 깜빡임 방지 */
.modal.fade .modal-dialog {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

.modal.show .modal-dialog {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

/* 모달 자체의 transition도 제거 */
.modal.fade {
    transition: none !important;
    animation: none !important;
}

/* 모달 내부 요소는 정상 동작 */
.modal-content * {
    pointer-events: auto;
}

/* 모달이 카드 hover 효과의 영향을 받지 않도록 */
.modal .card {
    transform: none !important;
    transition: none !important;
}

.modal .card:hover {
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* 모달 내부 버튼 hover 효과 제거 */
.modal .btn:hover {
    transform: none !important;
}

.modal .btn:active {
    transform: none !important;
}

/* 모달 내부 모든 요소의 transform 효과 제거 */
.modal * {
    will-change: auto;
}

.modal .form-control:hover,
.modal .form-select:hover {
    transform: none !important;
}

/* 모달이 절대 위치로 이동하지 않도록 */
.modal.show .modal-dialog {
    position: relative !important;
    transform: none !important;
    margin: 1.75rem auto !important;
    transition: none !important;
    animation: none !important;
}

/* 모달과 관련된 모든 transition/transform/animation 완전 제거 */
.modal,
.modal *,
.modal-dialog,
.modal-content,
.modal-backdrop {
    transition: none !important;
    animation: none !important;
}

/* 모달이 마우스 이벤트에 반응하지 않도록 */
.modal.show {
    pointer-events: auto;
}

.modal.show .modal-dialog {
    pointer-events: auto;
    /* 위치 강제 고정 */
    position: relative !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 1.75rem !important;
    margin-bottom: 1.75rem !important;
}

.modal.fade:not(.show) {
    opacity: 0;
}

.modal.fade.show {
    opacity: 1;
}

/* ===== 검색 폼 개선 ===== */
.search-form {
    background: var(--bs-gray-50);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ===== 검색 입력 개선 ===== */
input[type="search"],
input[type="text"].form-control:not([readonly]) {
    transition: all 0.2s ease;
}

input[type="search"]:focus,
input[type="text"].form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ===== 배지 개선 ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ===== 반응형 텍스트 ===== */
@media (max-width: 576px) {
    .text-responsive {
        font-size: 0.875rem;
    }

    h1, h2, h3 {
        word-break: keep-all;
    }
}

/* ===== 로딩 상태 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

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

.btn.loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 토스트 알림 ===== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1055;
}

.toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
}

.toast-header {
    font-weight: 600;
}

.toast-success {
    background-color: var(--bs-success);
    color: white;
}

.toast-error {
    background-color: var(--bs-danger);
    color: white;
}

.toast-info {
    background-color: var(--bs-info);
    color: white;
}

/* ===== 스크롤바 개선 ===== */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bs-gray-100);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* ===== 배지 개선 ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

.badge-row .badge {
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-row .badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== 알림/알림 개선 ===== */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
}

.alert-dismissible .btn-close {
    padding: 0.5rem 0.5rem;
}

/* ===== 페이지 헤더 개선 ===== */
h2.fw-bold {
    color: #212529;
    letter-spacing: -0.5px;
}

/* ===== 간격 개선 ===== */
.mb-3 {
    margin-bottom: 1.25rem !important;
}

.mt-3 {
    margin-top: 1.25rem !important;
}

.gap-2 {
    gap: 0.75rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

/* ===== 애니메이션 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===== 포커스 링 개선 ===== */
*:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* ===== 선택 텍스트 색상 ===== */
::selection {
    background-color: var(--bs-primary);
    color: white;
}

::-moz-selection {
    background-color: var(--bs-primary);
    color: white;
}
