/**
 * Flick Custom Datepicker Styles
 * Minimal light design that fits the FlickApp CI
 */

/* Override jQuery UI Datepicker Base Styles */
.ui-datepicker {
    width: 320px;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    display: none;
    overflow: visible;
}

/* Header */
.ui-datepicker-header {
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    padding: 12px 50px;
    position: relative;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation arrows */
.ui-datepicker-prev,
.ui-datepicker-next,
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    position: absolute;
    top: 10px !important;
    transform: none;
    width: 1.8em;
    height: 1.8em;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover,
.ui-datepicker .ui-datepicker-prev:hover,
.ui-datepicker .ui-datepicker-next:hover {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
}

/* Prevent any icon changes on hover */
.ui-datepicker-prev:hover span,
.ui-datepicker-next:hover span,
.ui-datepicker .ui-datepicker-prev:hover span,
.ui-datepicker .ui-datepicker-next:hover span {
    display: none !important;
}

.ui-datepicker-prev:hover:before,
.ui-datepicker-next:hover:before,
.ui-datepicker .ui-datepicker-prev:hover:before,
.ui-datepicker .ui-datepicker-next:hover:before {
    border-color: #374151 !important;
}

.ui-datepicker-prev,
.ui-datepicker .ui-datepicker-prev {
    left: 10px;
}

.ui-datepicker-next,
.ui-datepicker .ui-datepicker-next {
    right: 10px;
}

/* Hide default arrow text */
.ui-datepicker-prev span,
.ui-datepicker-next span {
    display: none;
}

/* Custom arrows using CSS */
.ui-datepicker-prev:before,
.ui-datepicker-next:before {
    content: '';
    width: 6px;
    height: 6px;
    border-left: 2px solid #374151;
    border-bottom: 2px solid #374151;
    display: inline-block;
}

.ui-datepicker-prev:before {
    transform: rotate(45deg);
    margin-left: 2px;
}

.ui-datepicker-next:before {
    transform: rotate(-135deg);
    margin-right: 2px;
}

/* Title */
.ui-datepicker-title {
    text-align: center;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Roboto Condensed', sans-serif;
}

/* Month/Year dropdowns */
.ui-datepicker-title select {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
    font-family: 'Roboto Condensed', sans-serif;
}

.ui-datepicker-title select:hover {
    border-color: #e5e7eb;
}

.ui-datepicker-title select:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.05);
}

/* Calendar body */
.ui-datepicker-calendar {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 8px;
}

.ui-datepicker-calendar thead {
    background: #ffffff;
}

.ui-datepicker-calendar th {
    padding: 8px 0;
    text-align: center;
    font-weight: 400;
    font-size: 12px;
    color: #9ca3af;
    text-transform: none;
    letter-spacing: normal;
    font-family: 'Roboto Condensed', sans-serif;
}

.ui-datepicker-calendar td {
    padding: 2px;
    text-align: center;
}

.ui-datepicker-calendar td a,
.ui-datepicker-calendar td span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    text-decoration: none;
    color: #000000;
    font-size: 14px;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-radius: 4px;
    margin: 0 auto;
    font-family: 'Roboto Condensed', sans-serif;
    border: 1px solid transparent;
}

/* Hover state */
.ui-datepicker-calendar td a:hover {
    background: #f3f4f6;
    color: #dc2626;
    border-color: #e5e7eb;
}

/* Current day (today) */
.ui-datepicker-today a {
    background: #fbbf24 !important;
    color: #ffffff !important;
    font-weight: 500;
    border-color: #fbbf24 !important;
}

/* Selected day */
.ui-datepicker-current-day a {
    background: #f3f4f6;
    color: #dc2626;
    border-color: #e5e7eb;
}

/* Other month days */
.ui-datepicker-other-month {
    opacity: 0.4;
}

.ui-datepicker-other-month a {
    color: #9ca3af !important;
}

.ui-datepicker-unselectable {
    color: #d1d5db;
    cursor: not-allowed;
}

.ui-datepicker-unselectable span {
    color: #d1d5db !important;
}

/* Remove all jQuery UI default backgrounds and borders */
.ui-datepicker.ui-widget-content {
    border: 1px solid #e5e7eb !important;
    background: #ffffff !important;
}

.ui-datepicker .ui-widget-header {
    border: none;
    background: #ffffff !important;
}

.ui-datepicker .ui-state-default {
    border: none;
    background: none;
}

.ui-datepicker .ui-state-hover {
    border: none;
    background: none;
}

.ui-datepicker .ui-state-active {
    border: none;
    background: none;
    color: white;
}

.ui-datepicker .ui-state-highlight {
    border: none;
    background: none;
}

/* Override any inline styles */
.ui-datepicker[style] {
    background-color: #ffffff !important;
}

/* Make default state text black */
.ui-state-default, 
.ui-widget-content .ui-state-default, 
.ui-widget-header .ui-state-default, 
.ui-button, 
html .ui-button.ui-state-disabled:hover, 
html .ui-button.ui-state-disabled:active {
    color: #000000;
}

/* Override jQuery UI highlight state for selected date */
.ui-state-highlight, 
.ui-widget-content .ui-state-highlight, 
.ui-widget-header .ui-state-highlight {
    border: 1px solid #dc2626 !important;
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* Prevent jQuery UI hover icons on navigation */
.ui-datepicker .ui-icon {
    display: none !important;
}

.ui-datepicker-prev.ui-state-hover,
.ui-datepicker-next.ui-state-hover,
.ui-datepicker .ui-datepicker-prev.ui-state-hover,
.ui-datepicker .ui-datepicker-next.ui-state-hover {
    background-image: none !important;
    background-color: #f9fafb !important;
}

/* Input field styling when datepicker is active */
input.flick-datepicker {
    position: relative;
}

input.flick-datepicker:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Add calendar icon to datepicker inputs */
.flick-datepicker {
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231e90ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px 20px;
}

/* Animation */
.ui-datepicker {
    animation: datepickerFadeIn 0.2s ease-out;
}

@keyframes datepickerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ui-datepicker {
        width: 260px;
        font-size: 13px;
    }
    
    .ui-datepicker-calendar td a,
    .ui-datepicker-calendar td span {
        padding: 6px;
        font-size: 13px;
    }
}

/* Ensure white background for the entire datepicker */
.ui-datepicker,
.ui-datepicker table {
    background-color: #ffffff !important;
}

.ui-datepicker td,
.ui-datepicker th {
    background-color: transparent;
}

/* Ensure the calendar body has white background */
.ui-datepicker-calendar tbody {
    background: #ffffff;
}

/* Fix for arrow positioning */
.ui-datepicker-header {
    overflow: visible;
}

/* Additional styling for better light theme */
.ui-datepicker {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
}

/* Ensure arrows are always visible */
.ui-datepicker-prev,
.ui-datepicker-next {
    z-index: 1;
}