/* Hanshek Styled Date Picker (Matches global theme) */

.date-picker-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: row;
    z-index: 9999;
    font-family: inherit;
    color: var(--text);
    overflow: hidden;
    width: min(38.75rem, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    /* Consistent width */
}

.date-picker-wrapper {
    position: relative;
    display: inline-block;
}

.date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    min-width: 8.75rem;
}

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

[x-cloak] {
    display: none !important;
}

/* Sidebar Presets */
.dp-sidebar {
    width: 10rem;
    border-right: 1px solid var(--border);
    padding: 0.5rem 0;
    background: var(--surface);
    flex-shrink: 0;
}

.dp-preset {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
    font-weight: 500;
}

.dp-preset:hover {
    background: #F8FAFC;
}

.dp-preset.active {
    color: var(--brand-dark);
    background: #F1F5F9;
    font-weight: 600;
    position: relative;
}

.dp-preset.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--brand-dark);
}

/* Main Content Area */
.dp-main {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Important for flex child */
}

/* Inputs Header */
.dp-inputs {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    /* Align labels and fields better */
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.dp-input-group {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dp-label {
    font-size: 0.6875rem;
    color: var(--muted);
    margin-bottom: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dp-field {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    width: 8.125rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
}

.dp-field:focus {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 3px rgba(21, 187, 209, 0.1);
}

.dp-sep {
    color: var(--border);
    font-size: 1.125rem;
    padding-bottom: 0.5rem;
}

/* Time Inputs */
.dp-time-inputs {
    display: flex;
    gap: 0.75rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
}

.dp-time-field {
    width: 5.3125rem;
}

.dp-placeholder {
    flex: 1;
    display: grid;
    place-items: center;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    color: var(--muted);
    font-size: 0.75rem;
    text-align: center;
    padding: 1rem;
}

/* Footer Actions */
.dp-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.dp-btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.dp-btn-cancel {
    color: var(--muted);
    background: transparent;
}

.dp-btn-cancel:hover {
    color: var(--text);
    background: #F1F5F9;
}

.dp-btn-apply {
    background: #15BBD1;
    /* Brand Primary */
    color: #fff;
    border: 1px solid #15BBD1;
}

.dp-btn-apply:hover {
    background: #12A4B8;
    border-color: #12A4B8;
}

/* Native Date Input Styling Override */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 700px) {
    .date-picker-dropdown {
        flex-direction: column;
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        top: auto;
        transform: none;
        width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .dp-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        overflow-x: auto;
        gap: 0.25rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .dp-preset {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .dp-sidebar::-webkit-scrollbar {
        display: none;
    }

    .dp-inputs {
        flex-direction: column;
        align-items: flex-start;
    }

    .dp-sep {
        display: none;
    }

    .dp-field {
        width: 100%;
    }

    .dp-time-inputs {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 0.75rem;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dp-main {
        padding: 1rem;
        gap: 1rem;
    }

    .dp-footer {
        padding-top: 1rem;
    }
}
