/**
 * Professional Date Input Styles
 * Enhances the visual appearance and user experience of date inputs
 */

/* Date input styling */
input[type="date"] {
    position: relative;
}

/* Focus state with better visual feedback */
input[type="date"]:focus {
    box-shadow: 0 0 0 2px rgba(105, 108, 255, 0.25);
    border-color: #696cff;
    outline: none;
}

/* Invalid date input styling */
input[type="date"].is-invalid {
    border-color: #ff3e1d;
    box-shadow: 0 0 0 2px rgba(255, 62, 29, 0.25);
}

/* Valid date input styling */
input[type="date"].is-valid {
    border-color: #71dd37;
    box-shadow: 0 0 0 2px rgba(113, 221, 55, 0.25);
}

/* Date input container styling */
.date-input-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Calendar icon for date inputs */
.date-input-container::after {
    content: "📅";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
    opacity: 0.7;
}

/* Remove default calendar icon in some browsers */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    width: 30px;
    height: 100%;
    cursor: pointer;
}

/* Custom date picker button */
.date-picker-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #696cff;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.date-picker-btn:hover {
    opacity: 1;
}

/* Date format hint */
.date-format-hint {
    display: block;
    font-size: 0.8rem;
    color: #8592a3;
    margin-top: 4px;
    font-style: italic;
}

/* Loading state for date inputs */
.date-input-loading {
    position: relative;
    pointer-events: none;
}

.date-input-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #696cff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .date-input-container::after {
        right: 8px;
        font-size: 14px;
    }
    
    .date-format-hint {
        font-size: 0.7rem;
    }
}

/* Dark mode support */
.dark input[type="date"] {
    background-color: #2b2b40;
    border-color: #464955;
    color: #e0e0e0;
}

.dark input[type="date"]:focus {
    border-color: #696cff;
    box-shadow: 0 0 0 2px rgba(105, 108, 255, 0.3);
}

.dark .date-format-hint {
    color: #a1acb8;
}

/* Animation for date value changes */
@keyframes dateValueChange {
    0% { background-color: transparent; }
    50% { background-color: rgba(105, 108, 255, 0.1); }
    100% { background-color: transparent; }
}

.date-value-changed {
    animation: dateValueChange 0.5s ease;
}

/* Error message styling */
.invalid-feedback.date-error {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #ff3e1d;
    font-weight: 400;
}

/* Success message styling */
.valid-feedback.date-success {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #71dd37;
    font-weight: 400;
}

/* Date range styling */
.date-range-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-range-container .date-range-separator {
    color: #8592a3;
    font-weight: 500;
}

.date-range-container input[type="date"] {
    flex: 1;
}

/* Date input groups */
.date-input-group {
    position: relative;
    margin-bottom: 1rem;
}

.date-input-group .input-group-text {
    background-color: #f8f9fa;
    border-color: #d9dee3;
}

/* Floating label for date inputs */
.date-floating-label {
    position: relative;
}

.date-floating-label input[type="date"]:focus + label,
.date-floating-label input[type="date"]:not(:placeholder-shown) + label {
    transform: translateY(-20px) scale(0.85);
    color: #696cff;
}

.date-floating-label label {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0 4px;
    background-color: white;
    transition: all 0.2s ease;
    pointer-events: none;
    color: #8592a3;
    font-size: 0.9rem;
}