/**
 * 통합 생년월일 피커 컴포넌트
 * 모든 v2 서비스 페이지에서 공통 사용
 *
 * 사용법:
 * <link rel="stylesheet" href="css/birthdate-picker.css">
 * <div id="birthdatePicker"></div>
 * <script src="js/birthdate-picker.js"></script>
 * BirthdatePicker.create('birthdatePicker', { showTime: true, showCalendar: true });
 */

/* Wrapper */
.bp-wrap {
    width: 100%;
    margin-bottom: 12px;
}

/* Label */
.bp-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #6B7280);
    margin-bottom: 8px;
}

/* Date row - 3 selects in a row */
.bp-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Select base */
.bp-sel {
    flex: 1;
    min-width: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 48px;
    padding: 0 30px 0 14px;
    border: 1.5px solid var(--border-light, #E5E7EB);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Pretendard', sans-serif;
    font-weight: 500;
    color: var(--text-primary, #1F2937);
    background-color: var(--bg-card, #FFFFFF);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bp-sel:focus {
    outline: none;
    border-color: var(--primary, #8B5CF6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.bp-sel:invalid,
.bp-sel option[value=""] {
    color: var(--text-hint, #9CA3AF);
}

/* Small select (calendar type) */
.bp-sel-sm {
    flex: 0 0 auto;
    width: auto;
    min-width: 100px;
    padding-left: 12px;
    padding-right: 28px;
    font-size: 14px;
    height: 42px;
}

/* Option row (time / calendar type) */
.bp-opt-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

/* Status message */
.bp-status {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary, #8B5CF6);
    transition: opacity 0.2s;
}

.bp-status.hidden {
    display: none;
}

/* Leap month checkbox (음력 선택 시에만 노출) */
.bp-leap-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.bp-leap-wrap.hidden {
    display: none;
}

.bp-leap-check {
    width: 18px;
    height: 18px;
    accent-color: var(--primary, #8B5CF6);
    cursor: pointer;
}

.bp-leap-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #6B7280);
    user-select: none;
}

/* ============================================
   Dark Mode
   ============================================ */
html.dark .bp-sel {
    background-color: #1E1F35;
    border-color: rgba(139, 92, 246, 0.25);
    color: #E5E7EB;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B5CF6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

html.dark .bp-sel:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

html.dark .bp-label {
    color: #9CA3AF;
}

html.dark .bp-status {
    color: #A78BFA;
}

html.dark .bp-leap-label {
    color: #9CA3AF;
}
