/* DateTimePicker 공통 컴포넌트 CSS */

/* 래퍼 - 비활성 시 숨김 */
.dtp-wrapper {
    display: none;
}
.dtp-wrapper.active {
    display: block;
}

/* 오버레이 */
.dtp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(2px);
}

/* 바텀시트 (모바일 기본) */
.dtp-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 2001;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: dtp-slide-up 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes dtp-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* PC: 중앙 모달 */
@media (min-width: 768px) {
    .dtp-sheet {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        bottom: auto;
        width: 90%;
        max-width: 420px;
        border-radius: 16px;
        max-height: 70vh;
        animation: dtp-fade-in 0.2s ease;
    }

    @keyframes dtp-fade-in {
        from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
        to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
}

/* 헤더 */
.dtp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
}

.dtp-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.dtp-close-btn {
    background: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 32px;
    text-align: center;
}
.dtp-close-btn:hover {
    background: #eee;
    color: #333;
}

/* 바디 */
.dtp-body {
    padding: 0 20px;
    overflow-y: auto;
    flex: 1;
}

/* === 아코디언 섹션 (datetime 모드) === */
.dtp-section {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    transition: border-color 0.3s ease;
}
.dtp-section.expanded {
    border-color: #007bff;
}

.dtp-section-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    background: #fafafa;
    transition: background 0.2s ease;
}
.dtp-section-header:active {
    background: #f0f0f0;
}

.dtp-section-label {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-right: 8px;
    flex-shrink: 0;
}

.dtp-section-value {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: right;
    margin-right: 8px;
}

.dtp-section-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
.dtp-section.expanded .dtp-section-arrow {
    transform: rotate(180deg);
}

.dtp-section-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}
.dtp-section.expanded .dtp-section-content {
    max-height: 600px;
    opacity: 1;
}

/* 섹션 안의 캘린더/타임피커 여백 조정 */
.dtp-section .dtp-calendar {
    margin-bottom: 0;
    padding: 0 8px 12px;
}
.dtp-section .dtp-time-picker {
    padding: 8px 8px 12px;
}

/* === 캘린더 === */
.dtp-calendar {
    margin-bottom: 16px;
}

.dtp-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
}

.dtp-calendar-nav {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    color: #666;
}
.dtp-calendar-nav:hover {
    background: #e9ecef;
}

.dtp-calendar-month {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.dtp-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}

.dtp-calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    padding: 6px 0;
}

.dtp-calendar-dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.dtp-calendar-date {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #333;
}
.dtp-calendar-date:hover:not(.disabled):not(.empty):not(.selected) {
    background: #f0f0f0;
}
.dtp-calendar-date.today {
    border: 1px solid #999;
    font-weight: 600;
}
.dtp-calendar-date.selected {
    background: #007bff;
    color: white;
    font-weight: 600;
}
.dtp-calendar-date.disabled {
    color: #ccc;
    cursor: not-allowed;
}
.dtp-calendar-date.empty {
    cursor: default;
}

/* === 타임피커 === */
.dtp-time-picker {
    display: flex;
    gap: 8px;
    padding: 8px 0 4px;
}

.dtp-time-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dtp-time-column-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.dtp-time-scroll-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.dtp-time-highlight {
    position: absolute;
    top: 50%;
    left: 4px;
    right: 4px;
    height: 40px;
    transform: translateY(-50%);
    background: #f0f0f0;
    border-radius: 8px;
    z-index: 0;
    pointer-events: none;
}

.dtp-time-scroll-wrapper .dtp-time-scroll {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    z-index: 1;
}

/* 스크롤바 숨기기 */
.dtp-time-scroll::-webkit-scrollbar {
    display: none;
}
.dtp-time-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.dtp-time-pad {
    height: 80px; /* (200 - 40) / 2 = 80px 상하 패딩 */
    flex-shrink: 0;
}

.dtp-time-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #999;
    scroll-snap-align: center;
    cursor: pointer;
    transition: color 0.15s ease, font-weight 0.15s ease;
    position: relative;
    z-index: 1;
}

.dtp-time-item.active {
    color: #333;
    font-weight: 600;
}

/* === 푸터 === */
.dtp-footer {
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
}

.dtp-confirm-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dtp-confirm-btn.disabled,
.dtp-confirm-btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.dtp-confirm-btn.enabled {
    background: #28a745;
    color: white;
}
.dtp-confirm-btn.enabled:hover {
    background: #218838;
}

/* 반응형 미세 조정 */
@media (max-width: 768px) {
    .dtp-header {
        padding: 16px 16px 10px;
    }
    .dtp-body {
        padding: 0 16px;
    }
    .dtp-footer {
        padding: 12px 16px;
        /* safe area 대응 */
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .dtp-calendar-date {
        font-size: 13px;
    }
    .dtp-confirm-btn {
        padding: 12px;
        font-size: 15px;
    }
}
