/**
 * Orders Filter & Search Styles
 * Enhanced Search and Filter UI
 */

/* ========================================
   Filter Form Container
======================================== */
#ordersFilterForm {
    animation: filterSlideIn 0.4s ease-out;
}

@keyframes filterSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Search Input Styles
======================================== */
.search-input-wrapper {
    position: relative;
    transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
    background-color: #ffffff;
}

.search-input-wrapper input:focus::placeholder {
    color: #d1d5db;
}

/* ========================================
   Filter Select Styles
======================================== */
select[name="status"],
select[name="date_range"],
select[name="amount_range"],
select[name="sort"] {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234f46e5' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

[data-bs-theme="dark"] select[name="status"],
[data-bs-theme="dark"] select[name="date_range"],
[data-bs-theme="dark"] select[name="amount_range"],
[data-bs-theme="dark"] select[name="sort"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%a5b4fc' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Focus state */
select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
   Filter Button Styles
======================================== */
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

button[type="submit"]:active {
    transform: translateY(0);
}

/* Reset button */
.btn-reset {
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background-color: #d1d5db;
    transform: rotate(180deg);
}

/* ========================================
   Filter Badge/Tag
======================================== */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4f46e5;
    animation: badgeAppear 0.3s ease-out;
}

[data-bs-theme="dark"] .filter-badge {
    background: rgba(79, 69, 229, 0.1);
    border-color: rgba(79, 69, 229, 0.3);
}

@keyframes badgeAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Empty State Animation
======================================== */
.empty-state-animation {
    animation: emptyStateFloat 3s ease-in-out infinite;
}

@keyframes emptyStateFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   Results Count
======================================== */
.results-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    animation: slideRight 0.4s ease-out;
}

[data-bs-theme="dark"] .results-count {
    color: #9ca3af;
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Loading State
======================================== */
.filter-loading {
    pointer-events: none;
    opacity: 0.6;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========================================
   Responsive Filter Form
======================================== */
@media (max-width: 768px) {
    #ordersFilterForm {
        padding: 1rem;
    }

    .grid-cols-1 {
        grid-template-columns: 1fr;
    }

    .md\:col-span-2 {
        grid-column: 1;
    }

    select[name="status"],
    select[name="date_range"],
    select[name="amount_range"],
    select[name="sort"] {
        font-size: 16px;
    }

    button[type="submit"] {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #ordersFilterForm {
        padding: 0.75rem;
    }

    select,
    input {
        padding: 0.75rem;
        font-size: 16px;
    }

    .md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .flex.items-end {
        flex-direction: column;
    }

    .flex.items-end button {
        width: 100%;
    }
}

/* ========================================
   Accessibility
======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard users */
select:focus-visible,
input:focus-visible,
button:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ========================================
   Animation for filter results
======================================== */
.order-card {
    animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple cards */
.order-card:nth-child(1) { animation-delay: 0s; }
.order-card:nth-child(2) { animation-delay: 0.1s; }
.order-card:nth-child(3) { animation-delay: 0.2s; }
.order-card:nth-child(n+4) { animation-delay: 0.3s; }

/* ========================================
   Dark Mode Adjustments
======================================== */
[data-bs-theme="dark"] select {
    background-color: #1f2937;
    color: #f3f4f6;
}

[data-bs-theme="dark"] select:focus {
    background-color: #111827;
}

[data-bs-theme="dark"] input {
    background-color: #374151;
    color: #f3f4f6;
}

[data-bs-theme="dark"] input:focus {
    background-color: #1f2937;
}

/* ========================================
   Transition States
======================================== */
.filter-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-fade-enter {
    animation: fadeIn 0.3s ease-out;
}

.filter-fade-exit {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
