/* ==========================================================================
   Custom Date & Android Time Picker Styles
   Theme: Modern Dark Material Design
   ========================================================================== */

:root {
    --picker-bg: #1e1e24;
    --picker-card-bg: #252630;
    --picker-surface: #2d2e3d;
    --picker-primary: #00E676; /* Accent green sáng */
    --picker-primary-hover: #00c853;
    --picker-primary-text: #000000;
    --picker-text: #f0f0f3;
    --picker-text-secondary: #a0a2b5;
    --picker-sunday: #ff5252; /* Màu đỏ nổi bật cho cột Chủ Nhật */
    --picker-today-mark: #00E676; /* Đánh dấu ngày hiện tại */
    --picker-border: rgba(255, 255, 255, 0.1);
    --picker-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    --picker-radius: 18px;
}

/* Dialog Picker (HTML5 <dialog> để luôn hiển thị trên Top Layer của trình duyệt, đè lên mọi modal khác) */
dialog.custom-picker-dialog {
    background: transparent;
    border: none;
    padding: 0;
    margin: auto;
    width: auto;
    color: var(--picker-text);
    overflow: visible;
    max-width: 95vw;
    max-height: 95vh;
    box-shadow: none;
    outline: none;
}

dialog.custom-picker-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Modal Picker Box */
.custom-picker-modal {
    background: var(--picker-bg);
    border: 1px solid var(--picker-border);
    border-radius: var(--picker-radius);
    box-shadow: var(--picker-shadow);
    width: 330px;
    max-width: 92vw;
    color: var(--picker-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    overflow: hidden;
    animation: picker-appear 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes picker-appear {
    from {
        transform: scale(0.92);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   DATE PICKER STYLES
   ========================================================================== */

.date-picker-header {
    background: var(--picker-card-bg);
    padding: 14px 18px;
    border-bottom: 1px solid var(--picker-border);
}

.date-picker-subtitle {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--picker-text-secondary);
    margin-bottom: 4px;
}

.date-picker-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--picker-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-picker-nav-btn {
    background: transparent;
    border: none;
    color: var(--picker-text);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s ease;
}

.date-picker-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.date-picker-body {
    padding: 14px 16px;
}

/* Lưới thứ trong tuần: T2 -> CN */
.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--picker-text-secondary);
    margin-bottom: 8px;
}

/* CỘT CHỦ NHẬT (SUNDAY) TÔ ĐỎ */
.date-picker-weekdays .weekday-sunday {
    color: var(--picker-sunday) !important;
    font-weight: 700;
}

/* Lưới các ngày */
.date-picker-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.date-picker-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--picker-text);
    position: relative;
    transition: background 0.15s ease, transform 0.1s ease;
}

.date-picker-day:hover:not(.empty):not(.disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.date-picker-day:active:not(.empty):not(.disabled) {
    transform: scale(0.92);
}

.date-picker-day.other-month {
    color: rgba(255, 255, 255, 0.25);
}

/* Cột Chủ Nhật tô đỏ cho số ngày */
.date-picker-day.day-sunday:not(.other-month):not(.selected) {
    color: var(--picker-sunday);
    font-weight: 600;
}

.date-picker-day.day-sunday.other-month {
    color: rgba(255, 82, 82, 0.35);
}

/* ĐÁNH DẤU NGÀY HIỆN TẠI (MARK TODAY) */
.date-picker-day.today:not(.selected) {
    outline: 2px solid var(--picker-today-mark);
    outline-offset: -2px;
    font-weight: 700;
}

.date-picker-day.today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    background-color: var(--picker-today-mark);
    border-radius: 50%;
}

.date-picker-day.today.day-sunday::after {
    background-color: var(--picker-sunday);
}

/* NGÀY ĐANG ĐƯỢC CHỌN (SELECTED DATE) */
.date-picker-day.selected {
    background: var(--picker-primary) !important;
    color: var(--picker-primary-text) !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 230, 118, 0.4);
}

.date-picker-day.selected::after {
    display: none;
}

/* ==========================================================================
   ANDROID TIME PICKER STYLES (Material Radial Clock)
   ========================================================================== */

.time-picker-header {
    background: var(--picker-card-bg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--picker-border);
}

.time-picker-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-picker-val {
    font-size: 2.6rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
    line-height: 1;
}

.time-picker-val.active {
    background: var(--picker-surface);
    color: var(--picker-primary);
    box-shadow: inset 0 0 0 1px rgba(0, 230, 118, 0.3);
}

.time-picker-colon {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--picker-text-secondary);
    margin: 0 2px;
    line-height: 1;
}

/* Vòng tròn đồng hồ Android (Clock Face) */
.time-picker-clock-wrap {
    padding: 16px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.time-picker-clock {
    width: 256px;
    height: 256px;
    background: var(--picker-card-bg);
    border-radius: 50%;
    position: relative;
    user-select: none;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    touch-action: none;
}

/* Tâm đồng hồ */
.clock-center-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--picker-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

/* Kim đồng hồ Android */
.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 2px;
    height: 98px;
    background: var(--picker-primary);
    transform-origin: bottom center;
    z-index: 3;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Núm tròn ở đầu kim ôm lấy số được chọn */
.clock-hand-knob {
    position: absolute;
    top: -16px;
    left: 50%;
    width: 32px;
    height: 32px;
    background: var(--picker-primary);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 230, 118, 0.4);
    transition: width 0.2s ease, height 0.2s ease, top 0.2s ease;
}

/* Các số trên mặt đồng hồ */
.clock-number {
    position: absolute;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--picker-text);
    border-radius: 50%;
    cursor: pointer;
    z-index: 4;
    transition: color 0.15s ease;
}

.clock-number-inner {
    font-size: 0.78rem;
    color: var(--picker-text-secondary);
}

.clock-number.selected {
    color: var(--picker-primary-text);
    font-weight: 700;
}

/* Footer nút bấm (Actions) */
.custom-picker-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--picker-border);
    background: var(--picker-bg);
    width: 100%;
    box-sizing: border-box;
}

.picker-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.picker-btn-secondary {
    color: var(--picker-text-secondary);
}

.picker-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--picker-text);
}

.picker-btn-primary {
    background: var(--picker-primary);
    color: var(--picker-primary-text);
}

.picker-btn-primary:hover {
    background: var(--picker-primary-hover);
}

.picker-btn-today {
    margin-right: auto;
    color: var(--picker-primary);
}

.picker-btn-today:hover {
    background: rgba(0, 230, 118, 0.1);
}

/* ==========================================================================
   Giao diện kết hợp trong Edit Modal (index.html)
   ========================================================================== */

.datetime-group-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.picker-trigger-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-color, #1e1e1e);
    border: 1px solid var(--primary-color, #bb86fc);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--on-surface-color, #ffffff);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent !important;
}

.picker-trigger-input:hover {
    background: rgba(255, 255, 255, 0.05);
}

.picker-trigger-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.picker-trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hiệu ứng khi nhấp vào ô trong bảng manage.html */
input.picker-active {
    border-color: var(--picker-primary) !important;
    box-shadow: none !important;
    outline: none !important;
}
