/* Reusable Datepicker Styles */

.datepicker-input,
.datepicker-btn {
    cursor: pointer;
    user-select: none;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: white;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.datepicker-input:hover,
.datepicker-btn:hover {
    border-color: #9ca3af;
}

.datepicker-input:focus,
.datepicker-btn:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.datepicker-dropdown {
    position: absolute;
    z-index: 99999 !important;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 1rem;
    min-width: 320px;
    margin-top: 0.5rem;
    left: 0;
    top: 100%;
    border: 1px solid #e5e7eb;
}

/* Ensure datepicker field creates proper stacking context */
.datepicker-field {
    position: relative;
    z-index: 100;
}

.datepicker-field:focus-within {
    z-index: 99999;
}

.datepicker-dropdown.hidden {
    display: none !important;
    visibility: hidden !important;
}

.quick-dates {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.quick-date-btn {
    flex: 1;
    min-width: fit-content;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-date-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.quick-date-btn:active {
    transform: translateY(0);
}

.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.datepicker-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.datepicker-select {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.datepicker-select:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.datepicker-select:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.datepicker-nav {
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.datepicker-nav:hover {
    background: #e5e7eb;
}

.datepicker-nav svg {
    width: 1rem;
    height: 1rem;
    color: #4b5563;
}

.datepicker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.datepicker-day-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    padding: 0.5rem;
}

.datepicker-day {
    aspect-ratio: 1;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #1f2937;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
}

.datepicker-day:hover:not(.disabled) {
    background: #f3f4f6;
}

.datepicker-day.other-month {
    color: #9ca3af;
}

.datepicker-day.today {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.datepicker-day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.datepicker-day.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    text-decoration: line-through;
}

.datepicker-day.disabled:hover {
    background: transparent;
}

/* RTL Support */
html[dir="rtl"] .datepicker-dropdown {
    direction: rtl;
}

html[dir="rtl"] .datepicker-grid {
    direction: rtl;
}

/* Responsive Design */
@media (max-width: 640px) {
    .datepicker-dropdown {
        min-width: 280px;
        padding: 0.75rem;
    }
    
    .quick-date-btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .datepicker-day {
        font-size: 0.75rem;
        min-height: 2rem;
    }
}

/* Animation */
@keyframes datepicker-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.datepicker-dropdown:not(.hidden) {
    animation: datepicker-fade-in 0.2s ease-out;
}
