/**
 * 신규 환자 등록 페이지 (patient/register.php)
 */

.patient-register input {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #ccc;
    outline: none;
    width: 100%;
    padding: 0;
}
.patient-register input[type="checkbox"] {
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
}

.patient-register select {
    width: 95%;
    border: 1px solid #ccc;
}

.patient-register .table thead th,
.patient-register .table td {
    padding: 6px;
    border-right: 1px dotted rgba(84, 84, 84, 0.17);
}

.patient-register .table thead th {
    border-bottom: 2px solid #cecece;
    border-top: 1px solid #cecece;
    color: #504f59;
}

.patient-register .table th:last-child,
.patient-register .table td:last-child {
    border-right: 0;
}

.patient-register textarea {
    width: 100%;
    resize: none;
}

/*.patient-register .divider {*/
/*    width: 100% !important;*/
/*    border-bottom: 1px solid #ebebeb !important;*/
/*}*/

/* -- 숫자 화살표 버튼 숨김 -- */

/* Chrome, Safari, Edge */
.patient-register input[type="number"]::-webkit-inner-spin-button,
.patient-register input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* Firefox */
.patient-register input[type="number"] {
    -moz-appearance: textfield;
}

/* -- */

/* 설정 영역 안내 */
.reg-setting-guide {
    color: #484951;
}

/* 탭 네비게이션 */
.reg-tab-nav {
    overflow: hidden;
}

.reg-tab-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f8f8;
}

.reg-tab-nav li {
    flex: 1;
}

.reg-tab-btn {
    border-radius: 0;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    transition: border-color .15s, color .15s;
    position: relative;
    white-space: nowrap;
    padding-left: 6px;
    padding-right: 6px;
    overflow: hidden;
}

.reg-tab-nav li:not(:last-child) .reg-tab-btn {
    border-right: 1px solid #eee;
}

/* 활성 탭 */
.reg-tab-active {
    border-bottom: 3px solid #77a600 !important;
    color: #77a601 !important;
    background: #fff !important;
    font-weight: 700;
}

/* 비활성 탭 (일반) */
.reg-tab-inactive {
    color: #999;
    background: #f8f8f8;
    font-weight: 500;
}

/* 비활성화 탭 (월정액 간병비 포함 시) */
.reg-tab-disabled {
    opacity: 0.45;
}

/* 탭 ON 상태 */
.reg-tab-on-badge {
    display: none;
}

.reg-tab-inactive.reg-tab-is-on {
    border-bottom: 2px solid #a8cc50;
}

/* '월정액' 뱃지 - 간병비 탭 비활성 표시 */
.reg-tab-monthly-badge {
    font-size: 1.2rem;
    font-weight: 500;
    color: #fff;
    background: #888;
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-block;
    line-height: 1.5;
}

/* -- 토글 공통 -- */

/* OFF 상태 안내 박스 */
.reg-off-box {
    padding: 40px 0;
    color: #898989;
}

.reg-off-box-sm {
    padding: 30px 0;
    color: #898989;
}

.reg-off-icon {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 10px;
}

.reg-off-icon-sm {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.reg-off-text {
    font-weight: 600;
}

.reg-off-subtext {
    font-size: 1.3rem;
    font-weight: 400;
}

/* 설정 토글 스위치 */
.patient-register .switch .slider {
    background-color: #af4c4c;
}

.patient-register .switch input:checked + .slider {
    background-color: #77a600;
}

/* -- */

/* 구분할인 탭 */
.reg-type-warn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff8e6;
    border: 1px solid #f0c040 !important;
    border-radius: 4px;
    padding: 8px 12px;
    color: #7a5a00;
    font-size: 1.35rem;
}

.reg-type-warn i {
    color: #e6a800;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* 월정액 탭 */
.reg-monthly-items-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
}

.reg-monthly-check-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px;
    flex: 1;
    min-width: 70px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 500;
    color: #666;
    text-align: center;
    transition: all .15s;
    user-select: none;
    background: #fafafa;
}

.reg-monthly-check-item input[type="checkbox"] {
    display: none;
}

/* 체크 아이콘 */
.reg-monthly-check-item > .fa-check {
    display: none;
    color: #77a600;
    font-size: 1.1rem;
    position: absolute;
    top: 6px;
    right: 8px;
}

/* 항목 아이콘 */
.reg-monthly-check-item > .fa-hospital-user,
.reg-monthly-check-item > .fa-box-open,
.reg-monthly-check-item > .fa-pills,
.reg-monthly-check-item > .fa-hand-holding-heart,
.reg-monthly-check-item > .fa-bed {
    font-size: 2rem;
    color: #bbb;
    transition: color .15s;
}

/* 월정액 활성 상태 */
.reg-monthly-check-item {
    position: relative;
}

.reg-monthly-check-item.is-active {
    border-color: #77a600;
    color: #4a6800;
    background: #f4f9e8;
    font-weight: 700;
}

.reg-monthly-check-item.is-active > .fa-check {
    display: inline-block;
}

.reg-monthly-check-item.is-active > .fa-hospital-user,
.reg-monthly-check-item.is-active > .fa-box-open,
.reg-monthly-check-item.is-active > .fa-pills,
.reg-monthly-check-item.is-active > .fa-hand-holding-heart,
.reg-monthly-check-item.is-active > .fa-bed {
    color: #77a600;
}

/* 월정액 - 비급여 물품 선택 영역 */
.reg-monthly-nonc-wrap {
    background: #f6f9f0;
    border: 1px dashed #b8d070;
    border-radius: 6px;
    padding: 12px;
    margin-top: 8px;
}

/* 월정액 - 비급여 물품 체크박스 목록 */
.reg-monthly-nonc-item-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.reg-monthly-nonc-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.3rem;
    margin-bottom: 7px;
    background: #fff;
    color: #666;
    transition: all .15s;
    user-select: none;
}

.reg-monthly-nonc-item input[type="checkbox"] {
    display: none;
}

.reg-monthly-nonc-item.is-checked {
    background: #e8f0d8;
    border-color: #77a600;
    color: #4a6800;
    font-weight: 600;
}

/* 월정액 - 선택된 비급여 물품 요약 행 */
.reg-monthly-nonc-selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 6px;
    border-top: 1px dashed #c5db8a;
}

/* 총 월정액 금액 섹션 */
.reg-monthly-total-wrap {
    background: #fafafa;
}

.reg-monthly-included-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.reg-monthly-included-label {
    white-space: nowrap;
    padding-top: 3px;
    flex-shrink: 0;
    font-weight: 600;
}

.mt8  { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb8  { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.ml8  { margin-left: 8px; }

/* Chip (태그) */
.reg-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    background: #e8f0d8;
    color: #4a6800;
    border: 1px solid #c5db8a;
    white-space: nowrap;
}

.reg-chip--green {
    background: #e8f0d8;
    color: #4a6800;
    border-color: #c5db8a;
}

.reg-chip--gray {
    background: #f0f0f0;
    color: #999;
    border-color: #ddd;
}

/* 비급여 물품 탭 - 물품 수량 Grid */
.reg-item-qty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.reg-item-qty-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    text-align: center;
    transition: border-color .15s;
}

.reg-item-qty-card:focus-within {
    border-color: #77a600;
}

.reg-item-qty-name {
    font-weight: 600;
    color: #444;
    white-space: nowrap;
}

.reg-item-qty-card input[type="number"] {
    width: 100% !important;
    border: 1px solid #ddd !important;
    border-bottom: 1px solid #ddd !important;
    border-radius: 4px;
    padding: 4px 6px !important;
    text-align: center;
    font-size: 1.3rem;
    background: #fafafa;
}

.reg-item-qty-card input[type="number"]:focus {
    border-color: #77a600 !important;
    background: #fff;
    outline: none;
}

.reg-item-qty-unit {
    color: #999;
}

/* 비급여 물품 탭 - 섹션 분리 */

/* 환자 정보 */
.reg-item-patient-section {
    background: #f8fbf4;
    border-color: #d8e8c0 !important;
}

.reg-item-patient-section .table thead th {
    background: rgb(236 246 214 / 0.4);
}

/* 물품 신청 */
.reg-item-request-section {
    background: #fff;
}

/* 임시저장 목록 모달 */
#modalTempList .modal-dialog {
    width: 90%;
    max-width: 1000px;
}

/* 특이사항 textarea */
.reg-note-textarea {
    height: 100px;
    border-radius: 5px;
}

/* 메모 없을 때 안내 */
.reg-memo-empty {
    padding: 14px 0;
}

/* -- 구분할인 아코디언 -- */

/* 펼침 버튼 */
.reg-dc-accordion-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 1.1rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: background .1s, color .1s;
}

.reg-dc-accordion-btn:hover {
    background: #f0f0f0;
    color: #444;
}

/* 펼쳐진 상태 버튼 */
.reg-dc-accordion-btn.is-open {
    background: #77a600;
    border-color: #77a600;
    color: #fff;
}

/* 펼쳐진 셀 "항목별 설정 중" 뱃지 */
.reg-dc-setting-badge {
    display: inline-block;
    font-weight: 600;
    color: #77a600;
}

/* 접혔을 때 "개별 설정됨" 칩 버튼 */
.reg-dc-used-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid #77a600;
    border-radius: 20px;
    background: #f4f9e8;
    color: #4a6800;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .1s;
}

.reg-dc-used-chip:hover {
    background: #e8f2d0;
}

/* 펼쳐진 상태 th 강조 */
.reg-dc-th-active {
    background: #f4f9e8 !important;
    color: #4a6800 !important;
    border-bottom: 2px solid #77a600 !important;
}

/* 펼침 행 셀 */
.reg-dc-sub-row {
    background: #f6f9f0;
    border-top: 2px dashed #c5db8a !important;
    padding: 12px !important;
}

/* 펼침 행 라벨 */
.reg-dc-sub-label {
    font-weight: 600;
    color: #77a600;
    margin-bottom: 10px;
}

/* 항목 그리드 */
.reg-dc-sub-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 개별 항목 카드 */
.reg-dc-sub-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1px solid #dde8c0;
    border-radius: 6px;
    padding: 8px 10px;
    min-width: 80px;
}

.reg-dc-sub-item span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.reg-dc-sub-item input[type="number"] {
    width: 100% !important;
    border: 1px solid #ddd !important;
    border-bottom: 1px solid #ddd !important;
    border-radius: 4px;
    padding: 3px 6px !important;
    font-size: 1.2rem;
    background: #fafafa;
    text-align: right;
}

.reg-dc-sub-item input[type="number"]:focus {
    border-color: #77a600 !important;
    background: #fff;
    outline: none;
}
/* -- */

/* -- 반응형 -- */

@media screen and (max-width: 1280px) {

    .patient-register .grid_v3 {
        gap: 15px;
        padding: 0 20px 0 10px;
    }

    .reg-tab-btn {
        font-size: 1.3rem;
        padding-left: 4px;
        padding-right: 4px;
    }
}

@media screen and (max-width: 1024px) {

    .patient-register .grid_v3 {
        display: block;
        padding: 0 10px;
    }

    .patient-register .right {
        margin-top: 20px;
    }

    .reg-tab-nav {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .reg-tab-nav ul {
        display: flex;
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .reg-tab-nav li {
        flex: none;
    }

    .reg-tab-btn {
        font-size: 1.3rem;
        padding: 10px 12px;
        white-space: nowrap;
    }

    .reg-monthly-items-grid {
        flex-wrap: wrap;
    }

    .reg-monthly-check-item {
        flex: 0 0 calc(33.33% - 6px);
        min-width: unset;
    }

    .patient-register .table {
        overflow-x: auto;
    }

    .reg-item-qty-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .patient-register nav.panel {
        gap: 8px;
    }
}

@media screen and (max-width: 768px) {

    .patient-register nav.panel .btn-text-hide {
        display: none;
    }

    .reg-monthly-check-item {
        flex: 0 0 calc(50% - 5px);
    }

    .reg-item-qty-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .reg-tab-inactive.reg-tab-is-on {
        border-bottom-width: 3px;
    }

    .reg-off-box {
        padding: 25px 0;
    }

    .reg-off-box-sm {
        padding: 20px 0;
    }

    .patient-register .bg1,
    .patient-register .bg3 {
        padding: 10px;
    }
}

@media screen and (max-width: 640px) {

    .reg-monthly-check-item {
        flex: 0 0 calc(50% - 5px);
    }

    .reg-item-qty-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .reg-tab-btn {
        font-size: 1.2rem;
        padding: 8px 10px;
    }

    .reg-toggle-desc {
        display: none;
    }

    .reg-dc-sub-item {
        min-width: 65px;
    }
}
