/* ============================================================================
   Datepicker Component Styles
   jQuery UI Datepicker customization to match modern UI design
   ============================================================================ */

/* jQuery UI Datepicker Customization
   ========================================================================== */
.ui-datepicker {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif) !important;
    font-size: 0.875rem !important;
    border: 1px solid var(--color-border, #e5e7eb) !important;
    border-radius: var(--radius-md, 0.375rem) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 0.75rem !important;
    background: white !important;
    width: 280px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.ui-datepicker-header {
    background: var(--color-bg-secondary, #f9fafb) !important;
    border: none !important;
    border-radius: var(--radius-sm, 0.25rem) !important;
    margin-bottom: 0.5rem !important;
    padding: 0.5rem !important;
}

.ui-datepicker-title {
    line-height: 1.8 !important;
    font-weight: 600 !important;
    color: var(--color-text, #111827) !important;
}

.ui-datepicker-prev,
.ui-datepicker-next {
    top: 0.5rem !important;
    width: 1.8rem !important;
    height: 1.8rem !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover {
    background: var(--color-gray-200, #e5e7eb) !important;
    border-radius: var(--radius-sm) !important;
}

.ui-datepicker-prev {
    left: 0.25rem !important;
}

.ui-datepicker-next {
    right: 0.25rem !important;
}

.ui-datepicker-prev span,
.ui-datepicker-next span {
    background-image: none !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
}

.ui-datepicker-prev span:before {
    content: "‹" !important;
    font-size: 1.25rem !important;
    color: var(--color-text-muted) !important;
}

.ui-datepicker-next span:before {
    content: "›" !important;
    font-size: 1.25rem !important;
    color: var(--color-text-muted) !important;
}

.ui-datepicker-calendar {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 2px !important;
    table-layout: fixed !important;
}

.ui-datepicker-calendar th {
    padding: 0.375rem 0.25rem !important;
    font-weight: 500 !important;
    color: var(--color-text-muted, #9ca3af) !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    width: 14.28% !important;
    text-align: center !important;
}

.ui-datepicker-calendar td {
    padding: 2px !important;
    width: 14.28% !important;
    text-align: center !important;
}

.ui-datepicker-calendar td a,
.ui-datepicker-calendar td span {
    display: block !important;
    padding: 0.5rem 0.25rem !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: var(--radius-sm) !important;
    color: var(--color-text, #111827) !important;
    border: 1px solid transparent !important;
    transition: all 0.2s !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 32px !important;
}

.ui-datepicker-calendar td a:hover {
    background: var(--color-primary, #dbfa5e) !important;
    border-color: var(--color-primary, #dbfa5e) !important;
    color: var(--color-text, #111827) !important;
}

.ui-state-hover {
    background: var(--color-primary, #dbfa5e) !important;
    border-color: var(--color-primary, #dbfa5e) !important;
    color: var(--color-text, #111827) !important;
}

.ui-state-active {
    background: var(--color-primary-dark, #c4e03a) !important;
    border-color: var(--color-primary-dark, #c4e03a) !important;
    color: var(--color-text, #111827) !important;
}

.ui-datepicker-today a {
    background: var(--color-bg-secondary, #f9fafb) !important;
    font-weight: 600 !important;
}

.ui-datepicker-unselectable span {
    color: var(--color-text-muted, #9ca3af) !important;
    opacity: 0.5 !important;
}

.ui-datepicker-buttonpane {
    border-top: 1px solid var(--color-border, #e5e7eb) !important;
    margin-top: 0.5rem !important;
    padding-top: 0.5rem !important;
}

.ui-datepicker-buttonpane button {
    margin: 0.25rem !important;
    padding: 0.375rem 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.875rem !important;
}

/* Date Input Wrapper Styles
   ========================================================================== */
.date-input-wrapper {
    position: relative;
}

.date-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    width: 18px;
    height: 18px;
}

.datepicker {
    padding-right: 40px !important;
    cursor: pointer;
}

/* Ensure icon shows properly with form input styling */
.esim-form-group .date-input-wrapper .esim-form-input {
    width: 100%;
    box-sizing: border-box;
}

/* Calendar Icon SVG Default (if not provided inline) */
.date-input-icon svg {
    width: 100%;
    height: 100%;
}

/* Time Picker Extension Styles
   ========================================================================== */
.ui-timepicker-wrapper {
    overflow-y: auto;
    max-height: 150px;
    width: 6.5em;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1001;
}

.ui-timepicker-wrapper.ui-timepicker-with-duration {
    width: 13em;
}

.ui-timepicker-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ui-timepicker-list li {
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    color: var(--color-text);
    font-size: 0.875rem;
}

.ui-timepicker-list li:hover,
.ui-timepicker-list li.ui-timepicker-selected {
    background: var(--color-primary);
    color: var(--color-text);
}

/* Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .ui-datepicker {
        font-size: 0.8125rem !important;
        padding: 0.375rem !important;
    }

    .ui-datepicker-calendar td a,
    .ui-datepicker-calendar td span {
        padding: 0.25rem !important;
        font-size: 0.875rem !important;
    }
}