/* ================================================================
   Custom Date & Time Picker - Avant-Garde Minimal
   ================================================================ */

.dtp-wrap {
    position: relative;
    display: block;
}
.dtp-wrap .dtp-input {
    cursor: pointer;
    padding-right: 40px !important;
    background-image: none !important;
}
.dtp-wrap .dtp-input::-webkit-calendar-picker-indicator {
    display: none !important;
    -webkit-appearance: none;
    appearance: none;
}
.dtp-wrap .dtp-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary, #1a1a1a);
    opacity: 0.65;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s ease;
}
.dtp-wrap .dtp-input:focus + .dtp-icon,
.dtp-wrap:hover .dtp-icon { opacity: 1; }

/* --------- Popup Base --------- */
.dtp-popup {
    position: fixed;
    z-index: 10000;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #1a1a1a);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 14px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    user-select: none;
    animation: dtpFadeIn .16s ease-out;
    border: 1px solid var(--border-color, #e5e7eb);
}
@keyframes dtpFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dtp-btn-primary,
.dtp-btn-ghost {
    font-family: inherit;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
    border: 1px solid transparent;
    padding: 10px 16px;
    font-size: 13px;
}
.dtp-btn-primary {
    background: #0a0a0a;
    color: #fff;
    width: 100%;
}
.dtp-btn-primary:hover { background: #222; }
.dtp-btn-ghost {
    background: transparent;
    color: var(--text-primary, #1a1a1a);
    border-color: var(--border-color, #e5e7eb);
}
.dtp-btn-ghost:hover { background: var(--input-bg, #f5f5f5); }
.dtp-btn-ghost.dtp-disabled { opacity: .4; cursor: not-allowed; }

/* ================== DATE PICKER ================== */
.dtp-popup-date { width: 290px; }

.dtp-dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 2px;
}
.dtp-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
}
.dtp-nav {
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary, #1a1a1a);
    transition: background-color .15s ease;
}
.dtp-nav:hover { background: var(--input-bg, #f5f5f5); }

.dtp-dp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dtp-dp-wd {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    padding: 6px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dtp-dp-day {
    background: transparent;
    border: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1a1a1a);
    transition: background-color .12s ease, color .12s ease, transform .12s ease;
}
.dtp-dp-day:hover:not(:disabled) { background: var(--input-bg, #f3f4f6); }
.dtp-dp-day.dtp-muted { color: var(--text-secondary, #9ca3af); opacity: .45; }
.dtp-dp-day.dtp-today {
    outline: 1.5px solid #fbbf24;
    outline-offset: -2px;
}
.dtp-dp-day.dtp-selected {
    background: #fbbf24 !important;
    color: #1a1a1a !important;
    font-weight: 700;
}
.dtp-dp-day.dtp-disabled {
    color: #d1d5db;
    cursor: not-allowed;
    opacity: .4;
}
.dtp-dp-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: flex-end;
}

/* ================== TIME PICKER (Wheel) ================== */
.dtp-popup-time { width: 260px; }

.dtp-tp-header {
    display: flex;
    justify-content: center;
    padding: 4px 0 12px;
}
.dtp-tp-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.dtp-tp-wheels {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.dtp-tp-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.dtp-tp-arrow {
    background: transparent;
    border: none;
    width: 40px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #6b7280);
    transition: background-color .15s ease, color .15s ease;
}
.dtp-tp-arrow:hover { background: var(--input-bg, #f5f5f5); color: var(--text-primary, #1a1a1a); }

.dtp-tp-list-wrap {
    position: relative;
    width: 72px;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* height set dynamically */
}
.dtp-tp-list-wrap::-webkit-scrollbar { display: none; }
.dtp-tp-center {
    position: absolute;
    left: 4px;
    right: 4px;
    background: #fbbf24;
    border-radius: 8px;
    pointer-events: none;
    z-index: 0;
    /* top + height set dynamically */
}
.dtp-tp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}
.dtp-tp-list li {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    scroll-snap-align: center;
    cursor: pointer;
    transition: color .15s ease, font-weight .15s ease;
}
.dtp-tp-list li.dtp-tp-pad { pointer-events: none; }
.dtp-tp-list li.dtp-tp-sel {
    color: #1a1a1a;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
}
.dtp-tp-list li:not(.dtp-tp-pad):not(.dtp-tp-sel):hover {
    color: var(--text-primary, #1a1a1a);
}

.dtp-tp-sep {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin-top: 4px;
}

.dtp-tp-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

/* Dark theme support */
body.dark-mode .dtp-popup,
[data-theme="dark"] .dtp-popup {
    background: #1f2937;
    color: #f3f4f6;
    border-color: #374151;
}
body.dark-mode .dtp-dp-day,
[data-theme="dark"] .dtp-dp-day { color: #f3f4f6; }
body.dark-mode .dtp-dp-day:hover:not(:disabled),
[data-theme="dark"] .dtp-dp-day:hover:not(:disabled) { background: #374151; }
body.dark-mode .dtp-nav:hover,
[data-theme="dark"] .dtp-nav:hover { background: #374151; }
body.dark-mode .dtp-btn-ghost,
[data-theme="dark"] .dtp-btn-ghost {
    color: #f3f4f6;
    border-color: #374151;
}
body.dark-mode .dtp-btn-ghost:hover,
[data-theme="dark"] .dtp-btn-ghost:hover { background: #374151; }
body.dark-mode .dtp-tp-list li,
[data-theme="dark"] .dtp-tp-list li { color: #6b7280; }
body.dark-mode .dtp-tp-list li.dtp-tp-sel,
[data-theme="dark"] .dtp-tp-list li.dtp-tp-sel { color: #1a1a1a; font-weight: 800; font-size: 22px; }

/* Responsive */
@media (max-width: 480px) {
    .dtp-popup-date { width: calc(100vw - 24px); max-width: 320px; }
    .dtp-popup-time { width: 260px; }
}
