/* 
   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;
}

.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;
    /* Standard radius */
    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;
    /* Standard radius */
    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;
}

/* 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;
    /* Light Gray */
    color: #494E53;
}

.cancel_btn:hover {
    background-color: #E6ECF4 !important;
    /* From common.css */
}

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

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

/* ===============================================
   Flatpickr Custom Design
   =============================================== */
.flatpickr-calendar {
    font-family: 'Pretendard', sans-serif !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid #E5E7EB !important;
    width: 320px !important;
}

.flatpickr-day {
    border-radius: 8px !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.flatpickr-months .flatpickr-month {
    background: transparent !important;
    color: var(--text-main) !important;
    fill: var(--text-main) !important;
    height: 40px;
    padding-top: 10px;
}

.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background-color: #fff !important;
    color: var(--text-main) !important;
}

.flatpickr-weekdays {
    background: transparent !important;
}

.flatpickr-weekday {
    color: #9CA3AF !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}

.flatpickr-current-month {
    font-size: 110% !important;
    padding-top: 10px;
}

.flatpickr-day.today {
    border-color: var(--border-color) !important;
}

.flatpickr-day.today:hover {
    background: #EBF5FF !important;
    border-color: #EBF5FF !important;
    color: var(--text-main) !important;
}

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

.date-input-wrapper input {
    flex: 1;
    padding-right: 70px;
    /* Space for age text and icon */
}

.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;
    /* Project hover color */
}

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

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

    .page-body {
        height: auto;
    }
}