/* Estilos completos para el sistema de filtrado de compras del administrador */

/* Contenedor principal de controles */
.purchases-controls {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Filtros por pestañas */
.purchases-filters {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.filter-tab {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
}

.filter-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.filter-tab:hover::before {
    left: 100%;
}

.filter-tab:hover {
    color: #475569;
    background: rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.filter-tab.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* Búsqueda */
.purchases-search {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.search-container {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    padding: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    max-width: 500px;
    width: 100%;
}

.search-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

#purchasesSearchInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: transparent;
    color: #374151;
}

#purchasesSearchInput::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.search-btn, .clear-search-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover, .clear-search-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.clear-search-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.clear-search-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Controles de paginación en la parte superior */
.purchases-pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.purchases-pagination-controls label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.purchases-pagination-controls select {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.purchases-pagination-controls select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.purchases-pagination-controls span {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Información de registros */
.purchases-info {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 10px;
    border: 1px solid #cbd5e0;
}

.purchases-info span {
    color: #475569;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Contenedor de tabla */
.purchases-table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

/* Tabla de compras */
.purchases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.purchases-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.purchases-table th {
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
    position: relative;
}

.purchases-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.purchases-table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f1f5f9;
}

.purchases-table tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.purchases-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.purchases-table tbody tr:nth-child(even):hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.purchases-table td {
    padding: 1rem;
    color: #374151;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* Celda de números con scroll horizontal */
.numbers-cell {
    max-width: 150px;
    overflow-x: auto;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #667eea;
}

.numbers-cell::-webkit-scrollbar {
    height: 4px;
}

.numbers-cell::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.numbers-cell::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.numbers-cell::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Celda de acciones */
.actions-cell {
    white-space: nowrap;
    text-align: center;
    min-width: 200px;
}

/* Badges de estado */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    min-width: 80px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Estados de compra - Corregidos */
.status-pending {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.status-approved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.status-rejected {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Estilos específicos para filtros de estado */
.filter-tab[onclick*="pending"] {
    position: relative;
}

.filter-tab[onclick*="pending"]::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-tab[onclick*="pending"].active::after {
    opacity: 1;
}

.filter-tab[onclick*="approved"] {
    position: relative;
}

.filter-tab[onclick*="approved"]::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-tab[onclick*="approved"].active::after {
    opacity: 1;
}

.filter-tab[onclick*="rejected"] {
    position: relative;
}

.filter-tab[onclick*="rejected"]::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-tab[onclick*="rejected"].active::after {
    opacity: 1;
}

/* Estados de pago */
.status-no-payment {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.status-sin-pago {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

/* Botones de acción */
.detail-btn, .approve-btn, .reject-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.detail-btn::before, .approve-btn::before, .reject-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.detail-btn:hover::before, .approve-btn:hover::before, .reject-btn:hover::before {
    left: 100%;
}

.detail-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.detail-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.approve-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.approve-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.reject-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.reject-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Paginación inferior */
.purchases-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: #6b7280;
    font-weight: 600;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 0.6rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.pagination-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s;
}

.pagination-btn:hover::before {
    left: 100%;
}

.pagination-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
}

.pagination-btn:disabled:hover {
    transform: none;
    box-shadow: none;
    background: #f3f4f6;
    color: #9ca3af;
}

/* Mensaje cuando no hay datos */
.no-data {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
    font-style: italic;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* Animaciones de carga */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.purchases-table tbody tr {
    animation: fadeInUp 0.3s ease;
}

.purchases-table tbody tr:nth-child(1) { animation-delay: 0.1s; }
.purchases-table tbody tr:nth-child(2) { animation-delay: 0.2s; }
.purchases-table tbody tr:nth-child(3) { animation-delay: 0.3s; }
.purchases-table tbody tr:nth-child(4) { animation-delay: 0.4s; }
.purchases-table tbody tr:nth-child(5) { animation-delay: 0.5s; }

/* Responsive Design */
@media (max-width: 1200px) {
    .purchases-table {
        font-size: 0.85rem;
    }
    
    .purchases-table th,
    .purchases-table td {
        padding: 0.8rem 0.6rem;
    }
    
    .numbers-cell {
        max-width: 120px;
    }
    
    .actions-cell {
        min-width: 180px;
    }
}

@media (max-width: 768px) {
    .purchases-controls {
        padding: 1rem;
        gap: 1rem;
    }
    
    .filter-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-tab {
        width: 100%;
        min-width: auto;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .purchases-pagination-controls {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .purchases-table-container {
        overflow-x: auto;
        border-radius: 10px;
    }
    
    .purchases-table {
        min-width: 800px;
        font-size: 0.8rem;
    }
    
    .purchases-table th,
    .purchases-table td {
        padding: 0.6rem 0.4rem;
    }
    
    .numbers-cell {
        max-width: 100px;
        font-size: 0.75rem;
    }
    
    .actions-cell {
        min-width: 150px;
    }
    
    .detail-btn, .approve-btn, .reject-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
        margin: 0.1rem;
    }
    
    .status-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
        min-width: 70px;
    }
    
    .purchases-pagination {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
        gap: 0.25rem;
    }
    
    .pagination-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        min-width: 40px;
    }
}

@media (max-width: 480px) {
    .purchases-controls {
        padding: 0.5rem;
    }
    
    .purchases-table {
        min-width: 700px;
        font-size: 0.75rem;
    }
    
    .purchases-table th,
    .purchases-table td {
        padding: 0.5rem 0.3rem;
    }
    
    .numbers-cell {
        max-width: 80px;
        font-size: 0.7rem;
    }
    
    .actions-cell {
        min-width: 120px;
    }
    
    .detail-btn, .approve-btn, .reject-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
        margin: 0.05rem;
    }
    
    .status-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
        min-width: 60px;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 35px;
    }
    
    .search-container {
        padding: 0.3rem;
    }
    
    #purchasesSearchInput {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .search-btn, .clear-search-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        min-width: 40px;
    }
}

/* Efectos especiales para interacciones */
.purchases-table tbody tr:hover .status-badge {
    transform: scale(1.05);
}

.purchases-table tbody tr:hover .detail-btn,
.purchases-table tbody tr:hover .approve-btn,
.purchases-table tbody tr:hover .reject-btn {
    transform: translateY(-1px);
}

/* Animación de pulso para elementos activos */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.filter-tab.active {
    animation: pulse 2s infinite;
}

/* Indicadores de carga */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Estilos para estados de carga */
.purchases-table.loading {
    opacity: 0.7;
    pointer-events: none;
}

.purchases-table.loading tbody::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilos adicionales para compatibilidad con el sistema existente */
.filter-section {
    margin-bottom: 1rem;
    text-align: center;
}

.filter-btn {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.filter-btn.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
}
