/**
 * ================================================================
 * Hostex Date Picker Styles - Litepicker
 * Copyright (c) 2025 Hostex. All rights reserved.
 * 
 * Beautiful, modern styling for Litepicker date picker integration
 * Better than Flatpickr with superior design and performance
 * ================================================================
 */

/* Global rules to hide all native date picker controls */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0 !important;
    position: absolute !important;
    right: -9999px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-outer-spin-button,
input[type="datetime-local"]::-webkit-inner-spin-button,
input[type="datetime-local"]::-webkit-outer-spin-button {
    display: none !important;
    opacity: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

input[type="date"]::-webkit-clear-button,
input[type="datetime-local"]::-webkit-clear-button {
    display: none !important;
    opacity: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Firefox */
input[type="date"]::-moz-focus-inner,
input[type="datetime-local"]::-moz-focus-inner {
    border: 0 !important;
}

/* Edge/IE */
input[type="date"]::-ms-clear,
input[type="datetime-local"]::-ms-clear {
    display: none !important;
}

/* Litepicker wrapper styling */
.litepicker-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Modern input styling - Hide native date picker */
.litepicker-input {
    padding-right: 50px !important;
    padding-left: 16px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    cursor: pointer;
    background-color: white !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: #1f2937 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* Hide native date picker controls */
.litepicker-input::-webkit-calendar-picker-indicator {
    display: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.litepicker-input::-webkit-inner-spin-button,
.litepicker-input::-webkit-outer-spin-button {
    display: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.litepicker-input::-webkit-clear-button {
    display: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Firefox */
.litepicker-input::-moz-focus-inner {
    border: 0 !important;
}

/* Edge/IE */
.litepicker-input::-ms-clear {
    display: none !important;
}

/* Hide all native date/time controls */
input[type="date"].litepicker-input,
input[type="datetime-local"].litepicker-input {
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
}

.litepicker-input:hover {
    border-color: #d1d5db !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

.litepicker-input:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

/* Dark mode support */
.dark .litepicker-input {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #f9fafb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.dark .litepicker-input:hover {
    border-color: #4b5563 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

.dark .litepicker-input:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1), 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Modern calendar icon styling */
.litepicker-icon {
    color: #6b7280 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 18px !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.dark .litepicker-icon {
    color: #9ca3af !important;
}

.litepicker-input:hover + .litepicker-icon {
    transform: translateY(-50%) scale(1.1) !important;
    opacity: 1 !important;
}

/* Litepicker calendar container */
.litepicker-container {
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    border: none !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    z-index: 9999 !important;
    background-color: white !important;
    color: #1f2937 !important;
    overflow: hidden !important;
    backdrop-filter: blur(10px) !important;
    animation: litepicker-slide-down 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding: 0 !important;
}

.dark .litepicker-container {
    background-color: #1f2937 !important;
    border-color: transparent !important;
    color: #f9fafb !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

@keyframes litepicker-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modern calendar header */
.litepicker-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    padding: 20px !important;
    position: relative !important;
    overflow: hidden !important;
}

.litepicker-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

.dark .litepicker-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%) !important;
}

.litepicker-header-title {
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    z-index: 1 !important;
}

.litepicker-header-action {
    color: white !important;
    padding: 8px !important;
    border-radius: 8px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    z-index: 1 !important;
    background: none !important;
    border: none !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.litepicker-header-action:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.05) !important;
}

/* Modern calendar months */
.litepicker-months {
    padding: 20px !important;
    background-color: white !important;
}

.dark .litepicker-months {
    background-color: #1f2937 !important;
}

.litepicker-month {
    width: 100% !important;
    border: none !important;
}

/* Modern calendar days */
.litepicker-day {
    border-radius: 10px !important;
    border: none !important;
    font-weight: 600 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 2px !important;
    color: #374151 !important;
    background-color: transparent !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 14px !important;
    text-align: center !important;
    position: relative !important;
}

.litepicker-day:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
    color: #1e40af !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2) !important;
}

.dark .litepicker-day {
    color: #f9fafb !important;
}

.dark .litepicker-day:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%) !important;
    color: #dbeafe !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3) !important;
}

.litepicker-is-selected {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4) !important;
}

.litepicker-is-selected:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
    transform: scale(1.1) !important;
}

.litepicker-is-today {
    border: 2px solid #3b82f6 !important;
    color: #3b82f6 !important;
    font-weight: 700 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.litepicker-is-today:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.3) 100%) !important;
}

.dark .litepicker-is-today {
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background-color: rgba(96, 165, 250, 0.1) !important;
}

.dark .litepicker-is-today:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(96, 165, 250, 0.3) 100%) !important;
}

.litepicker-is-disabled {
    color: #d1d5db !important;
    background-color: transparent !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.dark .litepicker-is-disabled {
    color: #6b7280 !important;
}

.litepicker-is-in-range {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
    color: #1e40af !important;
}

.dark .litepicker-is-in-range {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%) !important;
    color: #dbeafe !important;
}

/* Modern footer */
.litepicker-footer {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    padding: 16px 20px !important;
    border-top: none !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 8px !important;
}

.dark .litepicker-footer {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
}

.litepicker-footer-action {
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    cursor: pointer !important;
}

.litepicker-footer-action-apply {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
}

.litepicker-footer-action-apply:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3) !important;
}

.litepicker-footer-action-cancel {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

.litepicker-footer-action-cancel:hover {
    background-color: #e5e7eb !important;
    transform: translateY(-1px) !important;
}

.dark .litepicker-footer-action-cancel {
    background-color: #4b5563 !important;
    color: #f9fafb !important;
}

.dark .litepicker-footer-action-cancel:hover {
    background-color: #6b7280 !important;
}

/* Tooltip styling */
.litepicker-tooltip {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Form integration */
.form-group .litepicker-wrapper {
    width: 100%;
}

.form-group .litepicker-input {
    width: 100%;
    margin-top: 0.25rem;
}

/* Modal integration */
.modal .litepicker-container {
    z-index: 10000;
}

/* Responsive design */
@media (max-width: 640px) {
    .litepicker-container {
        width: 320px !important;
        font-size: 14px !important;
        margin: 0 10px !important;
    }
    
    .litepicker-day {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 13px !important;
    }
    
    .litepicker-header {
        padding: 16px !important;
    }
    
    .litepicker-header-title {
        font-size: 1.1rem !important;
    }
    
    .litepicker-months {
        padding: 16px !important;
    }
    
    .litepicker-footer {
        padding: 12px 16px !important;
    }
}

/* Focus states for accessibility */
.litepicker-input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .litepicker-day {
        border: 1px solid currentColor;
    }
    
    .litepicker-is-selected {
        background-color: #000;
        color: #fff;
    }
    
    .litepicker-is-today {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .litepicker-container {
        animation: none;
    }
    
    .litepicker-day,
    .litepicker-header-action {
        transition: none;
    }
}

/* Custom scrollbar for month navigation */
.litepicker-container::-webkit-scrollbar {
    width: 6px;
}

.litepicker-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.litepicker-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.litepicker-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .litepicker-container::-webkit-scrollbar-track {
    background: #374151;
}

.dark .litepicker-container::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.dark .litepicker-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}