/*
New Patient - Project Design System Applied

Font: Pretendard

Colors: Standard Project Blue (#1B66C9) & Gray (#494E53)
Layout: Compact 1080p Fit
*/

/* Font is loaded globally via head.html -> font.css, so just reference it */

:root {
    --primary-color: #1B66C9; /* Project Standard Blue */
    --primary-hover: #1652a3;
    --bg-color: #F8FBFF; /* Project Standard Background */
    --card-bg: #ffffff;
    --text-main: #494E53; /* Project Standard Text */
    --text-sub: #777d85;
    --border-color: #DDE2E8;
    --input-bg: #FFFFFF;

    /* Layout Variables */
    --header-height: 60px;
    --footer-height: 70px;
    --input-height: 40px;
}

/* Base Setup */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif !important;
    background-color: var(--bg-color);
    overflow-y: auto; /* Prevent clip */
    color: var(--text-main);
}

input,
button,
select,
textarea {
    font-family: inherit;
}

/* Layout Container */
.new-patient-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-color);
}

/* Header */
.page-header {
    height: var(--header-height);
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 0 40px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.page-header .title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Body Area */
.page-body {
    flex: 1;
    padding: 24px;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

/* Grid Layout */
.form-grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Fixed 3 columns */
    gap: 20px;
    width: 100%;
    max-width: 1800px;
}

/* Cards */
.form-section-card {
    background-color: var(--card-bg);
    border-radius: 8px; /* Border radius matching standard inputs often */
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #EEF2F7;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: fit-content;
    box-sizing: border-box;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

/* Form Rows - 기본 세로 레이아웃 유지 */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 체크박스 라인 - radio-group 스타일 적용 */
.checkbox-row .checkbox-line {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--input-bg);
    border-radius: 4px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    width: 100%;
}

.checkbox-line input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-line p {
    margin: 0;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    flex: 1;
    text-decoration: underline;
    padding-top: 1px;
}

.checkbox-line p:hover {
    color: var(--primary-color);
}

.checkbox-line:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(27, 102, 201, 0.1);
}

.form-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.form-row label.required::after {
    content: ' *';
    color: #FF5A5A;
}

/* Inputs */
input[type="text"],
input[type="tel"],
input[type="password"],
.select_box {
    width: 100%;
    height: var(--input-height);
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    border-radius: 4px;
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-main);
    box-sizing: border-box;
    outline: none;
    transition: 0.2s;
    font-family: 'Pretendard', sans-serif;
}

input:focus,
.select_box.focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(27, 102, 201, 0.1);
}

input::placeholder {
    color: #AAB2B9;
}

/* ===============================================
Choices.js Custom Design
=============================================== */
.choices {
    margin-bottom: 0;
    font-family: 'Pretendard', sans-serif;
    overflow: visible;
}

.choices__inner {
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(27, 102, 201, 0.1);
}

.choices__list--single {
    padding: 0;
    color: var(--text-main);
}

.choices__list--single .choices__item {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown Container */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    margin-top: 6px;
    background-color: #ffffff;
    padding: 6px;
    z-index: 100 !important;
}

/* Dropdown Items */
.choices__list--dropdown .choices__item {
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-main);
    margin-bottom: 2px;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: linear-gradient(135deg, #EBF5FF 0%, #E0F0FF 100%);
    color: var(--primary-color);
}

.choices__list--dropdown .choices__item--selectable.is-selected {
    background: linear-gradient(135deg, #1B66C9 0%, #2563EB 100%);
    color: #ffffff;
    font-weight: 600;
}

/* Search Input inside Dropdown */
.choices__input {
    background-color: #F8FAFC;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    margin-bottom: 8px;
    font-size: 13px;
    padding: 8px 12px;
}

/* Arrow Icon */
.choices[data-type*="select-one"]::after {
    content: '' !important;
    height: 8px !important;
    width: 8px !important;
    border-style: solid !important;
    border-color: #9CA3AF !important;
    border-width: 0 2px 2px 0 !important;
    transform: translateY(-70%) rotate(45deg) !important;
    position: absolute !important;
    right: 18px !important;
    top: 50% !important;
    pointer-events: none !important;
    transition: all 0.2s ease !important;
    margin-top: 0 !important;
    background-image: none !important;
    z-index: 5 !important;
    display: block !important;
}

.choices[data-type*="select-one"].is-open::after {
    transform: translateY(0%) rotate(225deg) !important;
    border-color: var(--primary-color) !important;
}

/* Input Placeholder Color */
.choices__placeholder {
    opacity: 1;
    color: #9CA3AF;
}

/* Radio */
.radio-group {
    display: flex;
    gap: 20px;
    height: var(--input-height);
    align-items: center;
    background-color: var(--input-bg);
    border-radius: 4px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-item label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
}

.radio-item input {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Textarea */
textarea {
    width: 100%;
    height: 80px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    border-radius: 4px;
    padding: 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
    color: var(--text-main);
}

textarea:focus {
    border-color: var(--primary-color);
}

/* Split Input */
.split-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.split-inputs input {
    text-align: center;
}

/* Helper classes */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper input {
    flex: 1;
    padding-right: 70px;
}

.date-input-wrapper img {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    opacity: 0.6;
    cursor: pointer;
}

.age-text {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Dropdown */
.dropdown-menu {
    border-radius: 4px;
    border: 1px solid #DDE2E8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-menu li {
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Pretendard', sans-serif;
}

.dropdown-menu li:hover {
    background-color: #ebf3fd;
}

.dropdown-menu li.selected {
    background-color: #ebf3fd;
    color: var(--primary-color);
    font-weight: 600;
}

/* Footer */
.page-footer {
    height: var(--footer-height);
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 40px;
    gap: 12px;
}

/* Buttons - Matching Global Design */
button {
    height: 44px;
    padding: 0 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: 'Pretendard', sans-serif;
    transition: background-color 0.2s;
}

.cancel_btn {
    background-color: #F0F2F5;
    color: #494E53;
}

.cancel_btn:hover {
    background-color: #E6ECF4 !important;
}

.registration_bth {
    background-color: var(--primary-color);
    color: #fff;
}

.registration_bth:hover {
    background-color: #1652a3 !important;
}

/* Responsive Mobile */
@media (max-width: 1199px) {
    .form-grid-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .page-body {
        height: auto;
        padding: 16px;
    }
}



/* 동의서 링크 스타일 */
.consent-link {
    color: #1a73e8;
    text-decoration: none;
    margin-left: 8px;
}

.consent-link:hover {
    text-decoration: underline;
    color: #1557b0;
}

/* 체크박스 라인 레이아웃 */
.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 로딩 스타일 */
.loading {
    padding: 50px;
    text-align: center;
    font-size: 16px;
    color: #666;
}

/* 동의서 전체 박스 스타일링 */
.consent_box {
    font-family: 'Pretendard', 'Malgun Gothic', sans-serif;
    color: #333;
    line-height: 1.6;
    padding: 10px;
    max-width: 100%;
}

/* 제목 스타일 */
.consent_title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
    color: #000;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
}

/* 중앙 강조 문구 */
.txt_center {
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 0.95em;
    word-break: keep-all;
}

/* 항목별 제목 (1, 2, 3...) */
.article {
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
    color: #d32f2f; /* 포인트 컬러 */
}

/* 본문 텍스트 */
.consent_box p {
    margin-bottom: 10px;
    font-size: 15px;
    text-align: justify;
}

/* 서명 영역 박스 */
.sign_box {
    margin-top: 40px;
    padding: 30px;
    border: 1px solid #eee;
    background-color: #fdfdfd;
    text-align: center;
}

.sign_box .date {
    font-size: 18px;
    margin: 0 10px;
}

.sign_box .last {
    margin-top: 25px;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

/* 서명 패드 스타일 */
.signPad {
    width: 200px;
    height: 80px;
    border-bottom: 2px solid #333;
    display: inline-block;
    position: relative;
    background: #fff;
}

.signPad canvas {
    width: 100%;
    height: 100%;
}

/* 로고 영역 */
.logo_box {
    margin-top: 30px;
    text-align: center;
    opacity: 0.7;
}

.logo_box img {
    height: 24px;
    vertical-align: middle;
    margin-right: 5px;
}

.logo_box p {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
}




/* 고객 검색 모달 커스텀 스타일 */
.user-select-dialog {
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    border: none !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

.search-header {
    padding: 24px 24px 16px;
    background: #ffffff;
}

.search-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: #f1f3f5;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #4dabf7;
    box-shadow: 0 0 0 4px rgba(77, 171, 247, 0.1);
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
}

.btn-search {
    background: #228be6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-search:hover { background: #1c7ed6; }

.table-wrapper {
    padding: 0 24px 20px;
    max-height: 380px;
    overflow-y: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table thead th {
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 12px 10px;
    text-align: left;
    font-size: 13px;
    color: #868e96;
    border-bottom: 2px solid #f1f3f5;
    z-index: 1;
}

.user-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.user-table tbody tr:hover { background: #f8f9fa; }

.user-table tbody td {
    padding: 16px 10px;
    font-size: 15px;
    color: #343a40;
    border-bottom: 1px solid #f1f3f5;
}

.user-name { font-weight: 700; color: #212529; }

.gender-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.gender-M { background: #e7f5ff; color: #1971c2; }
.gender-F { background: #fff0f6; color: #d6336c; }

.modal-footer-ui {
    padding: 16px 24px;
    background: #f8f9fa;
    text-align: right;
    border-top: 1px solid #e9ecef;
}

.btn-close-ui {
    background: #dee2e6;
    color: #495057;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content:间-between; /* 제목은 왼쪽, 메시지는 오른쪽 혹은 적절한 간격 */
}

.validation-msg {
    font-size: 0.8rem;
    color: #ff4d4f; /* 경고 빨간색 */
    font-weight: normal;
    margin-left: 10px;
    display: inline-block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}